CREATE DATABASE yppi_dbjadwal;
USE yppi_dbjadwal;

-- Tabel Data Rapat / Kegiatan
CREATE TABLE rapat (
    id INT AUTO_INCREMENT PRIMARY KEY,
    judul_rapat VARCHAR(255) NOT NULL,
    deskripsi TEXT,
    tanggal_kegiatan DATE NOT NULL,
    waktu_mulai TIME NOT NULL,
    waktu_selesai TIME NOT NULL,
    lokasi_ruangan VARCHAR(100) NOT NULL,
    link_zoom_google_meet VARCHAR(255) NULL,
    status_notifikasi ENUM('pending', 'sent') DEFAULT 'pending',
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

-- Tabel Peserta Rapat
CREATE TABLE peserta_rapat (
    id INT AUTO_INCREMENT PRIMARY KEY,
    rapat_id INT NOT NULL,
    nama_peserta VARCHAR(100) NOT NULL,
    email VARCHAR(100) NOT NULL,
    no_whatsapp VARCHAR(20) NOT NULL, -- Format: 628123456789
    status_kehadiran ENUM('pending', 'hadir', 'tidak_hadir') DEFAULT 'pending',
    FOREIGN KEY (rapat_id) REFERENCES rapat(id) ON DELETE CASCADE
);