USE `teguh`;

INSERT INTO `settings` (`id`, `site_name`, `homepage_title`, `homepage_description`, `support_contact`, `logo_original_name`, `logo_stored_name`, `logo_stored_path`, `logo_mime_type`, `created_at`, `updated_at`)
VALUES
  (1, 'Teguh', 'Portal Pengajuan Dokumen Sekolah', 'Unduh form resmi, lengkapi sesuai kebutuhan, lalu unggah kembali bersama dokumen pendukung.', 'Admin Helpdesk', NULL, NULL, NULL, NULL, NOW(), NOW())
ON DUPLICATE KEY UPDATE
  `site_name` = VALUES(`site_name`),
  `homepage_title` = VALUES(`homepage_title`),
  `homepage_description` = VALUES(`homepage_description`),
  `support_contact` = VALUES(`support_contact`),
  `logo_original_name` = VALUES(`logo_original_name`),
  `logo_stored_name` = VALUES(`logo_stored_name`),
  `logo_stored_path` = VALUES(`logo_stored_path`),
  `logo_mime_type` = VALUES(`logo_mime_type`),
  `updated_at` = NOW();

INSERT INTO `form_fields` (`field_key`, `field_label`, `field_type`, `section`, `is_required`, `is_active`, `is_locked`, `sort_order`, `created_at`, `updated_at`)
VALUES
  ('nama_admin', 'Nama Admin', 'text', 'identity', 1, 1, 1, 10, NOW(), NOW()),
  ('no_hp', 'No HP', 'tel', 'identity', 1, 1, 1, 20, NOW(), NOW()),
  ('sekolah', 'Sekolah', 'text', 'identity', 1, 1, 1, 30, NOW(), NOW()),
  ('file_form_resmi', 'Form Resmi yang Sudah Diisi', 'file', 'upload', 1, 1, 1, 40, NOW(), NOW()),
  ('file_ktp', 'KTP', 'file', 'upload', 1, 1, 1, 50, NOW(), NOW()),
  ('file_surat_permohonan', 'Surat Permohonan', 'file', 'upload', 1, 1, 1, 60, NOW(), NOW()),
  ('file_surat_kuasa', 'Surat Kuasa', 'file', 'upload', 0, 1, 1, 70, NOW(), NOW())
ON DUPLICATE KEY UPDATE
  `field_label` = VALUES(`field_label`),
  `field_type` = VALUES(`field_type`),
  `section` = VALUES(`section`),
  `is_required` = VALUES(`is_required`),
  `is_active` = VALUES(`is_active`),
  `is_locked` = VALUES(`is_locked`),
  `sort_order` = VALUES(`sort_order`),
  `updated_at` = NOW();
