CREATE TABLE IF NOT EXISTS surat_masuk (
  id INT AUTO_INCREMENT PRIMARY KEY,
  nomor_surat VARCHAR(100) NULL,
  tanggal_surat DATE NOT NULL,
  pengirim VARCHAR(150) NOT NULL,
  perihal VARCHAR(200) NOT NULL,
  departemen_tujuan VARCHAR(120) NOT NULL,
  status ENUM('baru','diproses','selesai') NOT NULL DEFAULT 'baru',
  file_path VARCHAR(255) NULL,
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS surat_keluar (
  id INT AUTO_INCREMENT PRIMARY KEY,
  nomor_surat VARCHAR(120) NOT NULL,
  kode_surat VARCHAR(30) NOT NULL,
  urut INT NOT NULL,
  bulan INT NOT NULL,
  tahun INT NOT NULL,
  tanggal_surat DATE NOT NULL,
  tujuan VARCHAR(150) NOT NULL,
  perihal VARCHAR(200) NOT NULL,
  departemen_pengirim VARCHAR(120) NOT NULL,
  status ENUM('draft','review','approved','kirim') NOT NULL DEFAULT 'draft',
  file_path VARCHAR(255) NULL,
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  UNIQUE KEY uniq_nomor (nomor_surat)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
