CREATE TABLE dafdir_admin (
  id INT AUTO_INCREMENT PRIMARY KEY,
  username VARCHAR(50) UNIQUE NOT NULL,
  password VARCHAR(255) NOT NULL
);

CREATE TABLE dafdir_event (
  id_event INT AUTO_INCREMENT PRIMARY KEY,
  nama_event VARCHAR(100) NOT NULL,
  tanggal_event DATE NOT NULL,
  pengesah VARCHAR(100),
  status ENUM('aktif','nonaktif') DEFAULT 'nonaktif',
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);


CREATE TABLE dafdir_absensi (
  id_absensi INT AUTO_INCREMENT PRIMARY KEY,
  id_event INT,
  nama_lengkap VARCHAR(100) NOT NULL,
  jabatan VARCHAR(100),
  tanda_tangan TEXT, -- base64 dari canvas
  waktu_isi DATETIME DEFAULT CURRENT_TIMESTAMP,
  sequence INT,
  FOREIGN KEY (id_event) REFERENCES dafdir_event(id_event)
);