-- =====================================================================
-- SANGGRALOKA ONE — Migration 0017_seed_dummy_full
-- ======================= DUMMY DATA DEMO ============================
-- HAPUS SEBELUM PRODUKSI. Seluruh baris di file ini adalah DATA DUMMY
-- (nama tamu/kandidat/insiden/dsb ditandai eksplisit "(DUMMY demo)")
-- untuk mengisi SEMUA tabel yang masih kosong per inventaris 8 Jul 2026,
-- supaya tiap halaman aplikasi punya isi (permintaan owner). BUKAN fakta
-- resort, BUKAN data karyawan/tamu/klien nyata.
--
-- TIDAK DUPLIKAT dgn 0016_seed_dummy_demo.sql — 0016 sudah mengisi
-- attendance/leaves/roster/tasks/quotations/bookings/KOL/guest cards/
-- briefing/discipline/kpi_scores; migrasi ini HANYA menyentuh tabel yang
-- masih 0 baris per SELECT COUNT(*) inventaris (lihat db/README.md).
--
-- ATURAN ANTI-KARANG tetap berlaku:
--   - mkt_products.price TIDAK disentuh (tetap NULL).
--   - TIDAK ada kode kompetensi baru (hanya referensi id existing dari 0010:
--     HK-01=id5, GEN-21=id4).
--   - TIDAK ada fakta resort baru; room type di mkt_reservations memakai
--     6 tipe kamar resmi (sanggraloka.md §2). Outlet F&B pada mkt_menus
--     memakai 4 outlet resmi (Meditera Restaurant/Bar, Segening, Sunken
--     Pool Bar).
--   - hr_payroll_items (kolom ciphertext earnings/deductions/gross/net/
--     pph21) SENGAJA TIDAK diisi — lihat catatan §1.18 di bawah.
--
-- Semua tanggal CREW/FIX dibangun relatif thd CURDATE()/NOW() (dashboard
-- selalu segar). Data SELL reservasi/snapshot memakai tahun tetap 2026
-- (report_year kolom eksplisit), konsisten dgn mkt_bookings 0011 yang
-- juga memakai tanggal tetap 2026.
--
-- Referensi FK dipakai (SEMUA sudah ada di seed sebelumnya):
--   hr_employees 1-8 (0010, HK): 1=EHK(user 504) 2=Coordinator(user 514)
--     3=RA(user 525) 4=RA(user 526) 5=RA(user 527) 6=RA(user 528)
--     7=PA(user 529) 8=Linen(user 530).
--   hr_positions 1=Room Attendant 2=Public Area Attendant 3=Linen Attendant
--     4=HK Coordinator 5=Executive Housekeeper (semua department housekeeping,
--     satu-satunya divisi contoh per keputusan PM-PLAN §1).
--   hr_competencies: HK-01=id5, GEN-21=id4 (0010, existing — bukan kode baru).
--   users: 501=GM, 502=FC, 546=HR Admin nyata; akun QC 900=gm 901=hr_admin
--     902=hr_staff 903=fc 904=supervisor 905=employee; users teknisi FIX
--     4=tech.candra 7=tech.budi 8=tech.agus; user front office 531
--     (kadek.kusumadewi, dipakai 0016 sbg importer guest list); users sales
--     520=komang.widyastuti 521=wayan.rahyuni 562=wayan.ratni(manager)
--     582=kadek.juliana (role S&M nyata per 0015, sama seperti dipakai 0016).
--   mkt_partners 1-3, mkt_products 1-24 (0011). mkt_kols 1(deal)/2(delivered),
--     mkt_kol_visits 1(dijadwalkan, kol1)/2(selesai, kol2) (0016).
--   vendors 1-2, work_orders (55 baris 0004/0005), checklists 1-12 +
--     checklist_items (0003), locations 1-25 (0001/0002).
--   audit_logs.module ENUM hanya ('fix','crew') di skema 0008 — TIDAK ada
--     'sell' meski AuditService::log() dipanggil dgn 'sell' di beberapa
--     Page SELL (bug pre-existing di luar scope Agent DB, dicatat di
--     laporan/sanggraloka.md, BUKAN diperbaiki di sini). Baris audit_logs
--     dummy di file ini HANYA memakai 'fix'/'crew' supaya migrasi valid.
-- =====================================================================

SET NAMES utf8mb4;

-- =====================================================================
-- BAGIAN 1 — CREW (HotelCrew)
-- =====================================================================

-- ---------------------------------------------------------------------
-- 1.1 hr_documents — 2 baris, expiry dekat (utk reminder F1)
-- ---------------------------------------------------------------------
INSERT INTO hr_documents (employee_id, type, title, file, expiry_date, reminder_days) VALUES
(1, 'ktp', 'KTP — perlu perpanjangan alamat (DUMMY demo)', 'hr_documents/1/ktp-demo.jpg (DUMMY)', DATE_ADD(CURDATE(), INTERVAL 20 DAY), 30),
(7, 'mcu', 'MCU Tahunan (DUMMY demo)', 'hr_documents/7/mcu-demo.pdf (DUMMY)', DATE_ADD(CURDATE(), INTERVAL 27 DAY), 30);

-- ---------------------------------------------------------------------
-- 1.2 hr_contracts — 1 PKWT berakhir ~50 hari lagi (employee 3, konsisten
-- dgn hr_exit §1.16 di bawah: kontrak tidak diperpanjang)
-- ---------------------------------------------------------------------
INSERT INTO hr_contracts (employee_id, type, start_date, end_date, file, status) VALUES
(3, 'pkwt', '2025-01-10', DATE_ADD(CURDATE(), INTERVAL 50 DAY), 'hr_contracts/3/pkwt-2025-demo.pdf (DUMMY)', 'active');

-- ---------------------------------------------------------------------
-- 1.3 hr_shift_swaps — 1 permintaan pending
-- ---------------------------------------------------------------------
INSERT INTO hr_shift_swaps (property_id, requester_id, partner_id, date, status) VALUES
(1, 4, 5, DATE_ADD(CURDATE(), INTERVAL 3 DAY), 'pending');

-- ---------------------------------------------------------------------
-- 1.4 hr_mod_roster — minggu ini (hari ini s/d +2), day+night bergantian
-- Coordinator(514)/EHK(504), set_by HR admin nyata (546)
-- ---------------------------------------------------------------------
INSERT INTO hr_mod_roster (property_id, date, shift, user_id, set_by, published_at) VALUES
(1, CURDATE(), 'day', 514, 546, NOW()),
(1, CURDATE(), 'night', 504, 546, NOW()),
(1, DATE_ADD(CURDATE(), INTERVAL 1 DAY), 'day', 514, 546, NOW()),
(1, DATE_ADD(CURDATE(), INTERVAL 1 DAY), 'night', 504, 546, NOW()),
(1, DATE_ADD(CURDATE(), INTERVAL 2 DAY), 'day', 514, 546, NOW()),
(1, DATE_ADD(CURDATE(), INTERVAL 2 DAY), 'night', 504, 546, NOW());

-- ---------------------------------------------------------------------
-- 1.5 hr_challenges (2) + hr_challenge_results (2, utk challenge closed)
-- competency_id memakai kode existing 0010 (HK-01=id5), BUKAN kode baru.
-- ---------------------------------------------------------------------
INSERT INTO hr_challenges (id, property_id, name, department, type, metric, rules, schedule, prize, budget_source, competency_id, status) VALUES
(1, 1, 'HK Speed Cleaning Challenge (DUMMY demo)', 'housekeeping', 'timed',
 'Waktu bersih kamar standar (menit)', 'Kamar checkout standar, dinilai waktu + checklist 30 titik lolos (DUMMY demo).',
 'Mingguan tiap Jumat (DUMMY demo)', 'Voucher spa staff (DUMMY demo)', 'HR engagement budget (DUMMY demo)', 5, 'closed'),
(2, 1, 'Kreasi Konten Butterfly Sanctuary (DUMMY demo)', NULL, 'judged',
 'Engagement media sosial (like/share/komentar)', 'Video/foto edukasi Butterfly Sanctuary, dinilai kreativitas + akurasi (DUMMY demo).',
 'Bulanan (DUMMY demo)', 'Sertifikat & poin service charge (DUMMY demo)', NULL, 4, 'open');

INSERT INTO hr_challenge_results (challenge_id, participant_id, score, time_seconds, rank, judged_by, evidence, awarded) VALUES
(1, 3, 95.0, 900, 1, 514, JSON_ARRAY('challenge/1/participant3-demo.jpg (DUMMY)'), JSON_OBJECT('prize', 'Voucher spa (DUMMY demo)')),
(1, 7, 90.0, 960, 2, 514, JSON_ARRAY('challenge/1/participant7-demo.jpg (DUMMY)'), NULL);

-- ---------------------------------------------------------------------
-- 1.6 hr_inspections (2) — inspeksi mendadak Executive Housekeeper
-- ---------------------------------------------------------------------
INSERT INTO hr_inspections (property_id, department, template, scored_by, employee_id, location_id, score, ts) VALUES
(1, 'housekeeping',
 JSON_ARRAY('Kebersihan kamar mandi', 'Kerapian tempat tidur', 'Kelengkapan amenities'),
 514, 3, 1, 92.5, DATE_SUB(NOW(), INTERVAL 1 DAY)),
(1, 'housekeeping',
 JSON_ARRAY('Kebersihan kamar mandi', 'Kerapian tempat tidur', 'Kelengkapan amenities'),
 504, 5, 4, 78.0, DATE_SUB(NOW(), INTERVAL 3 DAY));

-- ---------------------------------------------------------------------
-- 1.7 hr_loans — 1 kasbon aktif, cicilan berjalan
-- ---------------------------------------------------------------------
INSERT INTO hr_loans (property_id, employee_id, amount, installments, balance, approvals, status) VALUES
(1, 8, 2000000.00, 4, 1500000.00,
 JSON_OBJECT('hod', JSON_OBJECT('by', 504, 'at', DATE_FORMAT(DATE_SUB(NOW(), INTERVAL 20 DAY), '%Y-%m-%d %H:%i:%s'))),
 'active');

-- ---------------------------------------------------------------------
-- 1.8 hr_vacancies (1) + hr_candidates (3, stage berbeda)
-- ---------------------------------------------------------------------
INSERT INTO hr_vacancies (id, property_id, position_id, headcount, budget_approved, status) VALUES
(1, 1, 1, 2, 1, 'open');

INSERT INTO hr_candidates (property_id, vacancy_id, data, stage, test_token) VALUES
(1, 1, JSON_OBJECT('full_name', 'Ni Made Ayu Kandidat (DUMMY demo)', 'phone', '0812000000 1 (DUMMY)', 'email', 'demo.kandidat1@example.com'), 'applied', NULL),
(1, 1, JSON_OBJECT('full_name', 'I Made Kandidat Dua (DUMMY demo)', 'phone', '0812000000 2 (DUMMY)', 'email', 'demo.kandidat2@example.com'), 'interview', 'demo0000000000000000000000000002'),
(1, 1, JSON_OBJECT('full_name', 'Kadek Kandidat Tiga (DUMMY demo)', 'phone', '0812000000 3 (DUMMY)', 'email', 'demo.kandidat3@example.com'), 'offer', 'demo0000000000000000000000000003');

-- ---------------------------------------------------------------------
-- 1.9 hr_onboarding — 1 baris (checklist d1 selesai, d7 sebagian)
-- ---------------------------------------------------------------------
INSERT INTO hr_onboarding (employee_id, checklist, buddy_id) VALUES
(6, JSON_OBJECT(
    'd1', JSON_ARRAY(
        JSON_OBJECT('label', 'Serah terima seragam & locker', 'done', TRUE),
        JSON_OBJECT('label', 'Perkenalan tim & buddy', 'done', TRUE),
        JSON_OBJECT('label', 'Tur area kerja', 'done', TRUE)
    ),
    'd7', JSON_ARRAY(
        JSON_OBJECT('label', 'Selesai course faculty GEN', 'done', TRUE),
        JSON_OBJECT('label', 'Cek kelengkapan dokumen', 'done', FALSE)
    ),
    'd30', JSON_ARRAY(JSON_OBJECT('label', 'Review kinerja awal dengan supervisor', 'done', FALSE)),
    'd60', JSON_ARRAY(JSON_OBJECT('label', 'Assessment kompetensi dasar posisi', 'done', FALSE)),
    'd90', JSON_ARRAY(JSON_OBJECT('label', 'Evaluasi akhir masa percobaan', 'done', FALSE))
 ), 3);

-- ---------------------------------------------------------------------
-- 1.10 hr_dw_pool — 4 Daily Worker siap panggil
-- ---------------------------------------------------------------------
INSERT INTO hr_dw_pool (property_id, full_name, phone, departments, rating_avg, last_called) VALUES
(1, 'Ketut Darma Wijaya (DUMMY demo)', '0813000001 (DUMMY)', JSON_ARRAY('housekeeping'), 4.50, DATE_SUB(CURDATE(), INTERVAL 10 DAY)),
(1, 'Nyoman Sri Astuti (DUMMY demo)', '0813000002 (DUMMY)', JSON_ARRAY('housekeeping', 'fbs'), 4.20, DATE_SUB(CURDATE(), INTERVAL 25 DAY)),
(1, 'Wayan Bagus Suartana (DUMMY demo)', '0813000003 (DUMMY)', JSON_ARRAY('engineering'), 3.80, NULL),
(1, 'Made Dwi Lestari (DUMMY demo)', '0813000004 (DUMMY)', JSON_ARRAY('housekeeping'), NULL, NULL);

-- ---------------------------------------------------------------------
-- 1.11 hr_trainees — 2 trainee magang
-- ---------------------------------------------------------------------
INSERT INTO hr_trainees (property_id, full_name, school, mou_file, mentor_id, batch, start_date, end_date, monthly_scores) VALUES
(1, 'Putu Trainee Satu (DUMMY demo)', 'SMK Pariwisata Ubud (DUMMY demo)', 'hr_trainees/mou-1-demo.pdf (DUMMY)', 2, '2026-A',
 DATE_SUB(CURDATE(), INTERVAL 30 DAY), DATE_ADD(CURDATE(), INTERVAL 60 DAY), JSON_OBJECT('bulan1', 82)),
(1, 'Ayu Trainee Dua (DUMMY demo)', 'SMK Pariwisata Ubud (DUMMY demo)', 'hr_trainees/mou-2-demo.pdf (DUMMY)', 1, '2026-A',
 DATE_SUB(CURDATE(), INTERVAL 15 DAY), DATE_ADD(CURDATE(), INTERVAL 75 DAY), NULL);

-- ---------------------------------------------------------------------
-- 1.12 hr_handover_logs — 2 baris (housekeeping + front_office, BUKAN
-- engineering — handover engineering ada di HotelFix)
-- ---------------------------------------------------------------------
INSERT INTO hr_handover_logs (property_id, department, shift, notes, by_user_id, ack_by, ack_at) VALUES
(1, 'housekeeping', 'A', 'Kamar 1203 sudah dibersihkan ulang pasca komplain; linen menipis di lantai 12 (DUMMY demo).', 514, 504, DATE_SUB(NOW(), INTERVAL 2 HOUR)),
(1, 'front_office', 'N', '2 arrival VIP besok pagi (Mr Kim, Mme Dubois) — welcome amenity sudah disiapkan HK (DUMMY demo).', 531, NULL, NULL);

-- ---------------------------------------------------------------------
-- 1.13 hr_incidents — 2 baris
-- ---------------------------------------------------------------------
INSERT INTO hr_incidents (property_id, type, description, location_id, reported_by, routed_to, status) VALUES
(1, 'guest', 'Tamu komplain AC kamar 1202 kurang dingin (DUMMY demo).', 2, 525, 'engineering', 'resolved'),
(1, 'safety', 'Lantai licin dekat Sunken Pool Bar, dipasang tanda peringatan sementara (DUMMY demo).', 8, 529, 'engineering', 'investigating');

-- ---------------------------------------------------------------------
-- 1.14 hr_lost_found — 2 baris
-- ---------------------------------------------------------------------
INSERT INTO hr_lost_found (property_id, item, location_id, found_by, stored_at, returned_to, status) VALUES
(1, 'Dompet kulit coklat (DUMMY demo)', 1, 525, 'Loker HRD (DUMMY demo)', NULL, 'stored'),
(1, 'Kacamata renang anak (DUMMY demo)', 8, 529, 'Loker HRD (DUMMY demo)', 'Tamu kamar 1201 (DUMMY demo)', 'claimed');

-- ---------------------------------------------------------------------
-- 1.15 hr_grievances — 2 baris (1 normal, 1 format "[eNPS n] ..." sesuai
-- kontrak HrEngagementPage::submit_enps)
-- ---------------------------------------------------------------------
INSERT INTO hr_grievances (property_id, employee_id, channel, text, status) VALUES
(1, 7, 'normal', 'Usul: sediakan tambahan kipas angin di area loker staff HK (DUMMY demo).', 'open'),
(1, NULL, 'normal', '[eNPS 9] Lingkungan kerja nyaman, komunikasi antar-shift lancar (DUMMY demo).', 'open');

-- ---------------------------------------------------------------------
-- 1.16 hr_exit — 1 baris (employee 3, selaras hr_contracts §1.2: PKWT
-- tidak diperpanjang, last_day = tanggal akhir kontrak)
-- ---------------------------------------------------------------------
INSERT INTO hr_exit (employee_id, checklist, interview, reason, last_day) VALUES
(3, JSON_OBJECT('seragam_dikembalikan', FALSE, 'locker_dikosongkan', FALSE, 'akun_dinonaktifkan', FALSE),
 JSON_OBJECT('alasan_utama', 'Kontrak PKWT tidak diperpanjang (DUMMY demo)', 'catatan', 'Kinerja baik, tidak ada isu disiplin (DUMMY demo)'),
 'Kontrak PKWT berakhir, tidak diperpanjang (DUMMY demo)', DATE_ADD(CURDATE(), INTERVAL 50 DAY));

-- ---------------------------------------------------------------------
-- 1.17 hr_ai_intakes — 1 baris (stub HrAiService, F15C)
-- ---------------------------------------------------------------------
INSERT INTO hr_ai_intakes (property_id, raw_text, source_type, parsed, model, tokens_in, tokens_out, cost_idr) VALUES
(1, 'Tamu kamar 1203 komplain AC berisik malam ini, tolong dicek sebelum jam 21.00 (DUMMY demo).', 'guest_request',
 JSON_OBJECT('summary', 'AC berisik kamar 1203 (DUMMY demo)', 'suggested_department', 'engineering', 'suggested_priority', 'urgent'),
 'stub-haiku (DUMMY demo, belum tersambung API nyata)', 120, 45, 150.00);

-- ---------------------------------------------------------------------
-- 1.18 hr_payroll_periods (1 draft) + hr_service_charge (1) — ZONA MERAH
-- CATATAN PENTING: hr_payroll_items (earnings/deductions/employer_costs/
-- gross/net/pph21) SENGAJA TIDAK DIISI. Kolom-kolom itu didokumentasikan
-- di skema (0008_hr_init.sql) sbg TEXT ciphertext yang "dienkripsi level
-- aplikasi (kunci TIDAK disimpan di DB)" — namun src/Page/HrPayrollPage.php
-- eksplisit menyatakan "Nominal per-karyawan (ciphertext) di luar scope v1"
-- dan tidak ada satu pun kelas enkripsi/dekripsi (src/**/*Crypt*,
-- openssl_encrypt, sodium_*) di codebase saat ini. Mengisi kolom itu dengan
-- teks biasa akan MENYESATKAN (terlihat seperti ciphertext valid padahal
-- bukan) dan melanggar kontrak skema. hr_service_charge.detail BUKAN
-- ciphertext (JSON polos di skema) sehingga tetap diisi di bawah.
-- ---------------------------------------------------------------------
INSERT INTO hr_payroll_periods (id, property_id, month, cutoff, status) VALUES
(1, 1, DATE_FORMAT(DATE_SUB(CURDATE(), INTERVAL 1 MONTH), '%Y-%m'), LAST_DAY(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)), 'draft');

INSERT INTO hr_service_charge (period_id, total_collected, risk_pct, hr_dev_pct, dist_method, point_value, detail) VALUES
(1, 42000000.00, 5.00, 3.00, 'point', 966000.0000,
 JSON_ARRAY(
   JSON_OBJECT('employee_id', 1, 'points', 5, 'amount', 4830000, 'note', 'DUMMY demo'),
   JSON_OBJECT('employee_id', 2, 'points', 5, 'amount', 4830000, 'note', 'DUMMY demo'),
   JSON_OBJECT('employee_id', 3, 'points', 5, 'amount', 4830000, 'note', 'DUMMY demo'),
   JSON_OBJECT('employee_id', 4, 'points', 5, 'amount', 4830000, 'note', 'DUMMY demo'),
   JSON_OBJECT('employee_id', 5, 'points', 5, 'amount', 4830000, 'note', 'DUMMY demo'),
   JSON_OBJECT('employee_id', 6, 'points', 5, 'amount', 4830000, 'note', 'DUMMY demo'),
   JSON_OBJECT('employee_id', 7, 'points', 5, 'amount', 4830000, 'note', 'DUMMY demo'),
   JSON_OBJECT('employee_id', 8, 'points', 5, 'amount', 4830000, 'note', 'DUMMY demo')
 ));

-- ---------------------------------------------------------------------
-- 1.19 hr_employee_comp — 6 baris (matriks level kompetensi F6, heatmap
-- HrCompetenciesPage/ProfilePage). Kode kompetensi HANYA existing 0010
-- (HK-01=id5, HK-09=id9, HK-12=id11, GEN-18=id2, LDR-01=id20) — bukan baru.
-- ---------------------------------------------------------------------
INSERT INTO hr_employee_comp (employee_id, competency_id, level, assessed_by, assessed_at, evidence_type, valid_until) VALUES
(3, 5, 3, 514, DATE_SUB(NOW(), INTERVAL 10 DAY), 'practical', NULL),
(4, 5, 2, 514, DATE_SUB(NOW(), INTERVAL 10 DAY), 'practical', NULL),
(5, 2, 2, 504, DATE_SUB(NOW(), INTERVAL 30 DAY), 'test', NULL),
(7, 9, 3, 514, DATE_SUB(NOW(), INTERVAL 15 DAY), 'practical', NULL),
(8, 11, 2, 514, DATE_SUB(NOW(), INTERVAL 15 DAY), 'practical', NULL),
(2, 20, 4, 504, DATE_SUB(NOW(), INTERVAL 60 DAY), 'cert', NULL);

-- ---------------------------------------------------------------------
-- 1.20 hr_briefing_acks — 4 acknowledge utk hr_briefings id=1 (0016,
-- briefing housekeeping hari ini)
-- ---------------------------------------------------------------------
INSERT INTO hr_briefing_acks (briefing_id, user_id, ack_at) VALUES
(1, 504, NOW()),
(1, 514, NOW()),
(1, 525, NOW()),
(1, 529, NOW());

-- =====================================================================
-- BAGIAN 2 — SELL (HotelSell)
-- =====================================================================

-- ---------------------------------------------------------------------
-- 2.1 mkt_ai_chats (1) + mkt_ai_messages (4) — persona event_menu
-- ---------------------------------------------------------------------
INSERT INTO mkt_ai_chats (id, property_id, user_id, persona, title) VALUES
(1, 1, 520, 'event_menu', 'Brainstorm ide sunset event Q3 (DUMMY demo)');

INSERT INTO mkt_ai_messages (chat_id, role, content, tokens_in, tokens_out, cost_idr) VALUES
(1, 'user', 'Kita butuh ide event romantic sunset untuk promo Q3, ada saran untuk Sanggraloka? (DUMMY demo)', NULL, NULL, NULL),
(1, 'assistant', 'Beberapa ide: (1) Sunset Movie Night di Valley dengan picnic set, (2) Romantic dinner tepi kolam infinity, (3) Sesi foto golden hour di Butterfly Sanctuary (DUMMY demo, contoh jawaban AI).', 180, 96, 420.00),
(1, 'user', 'Menarik — tolong detailkan konsep venue dan menu ringan untuk opsi (1). (DUMMY demo)', NULL, NULL, NULL),
(1, 'assistant', 'Venue: area rumput tepi valley dekat Sunken Pool Bar, layar portable + proyektor, alas piknik & bantal. Menu ringan: sharing platter hasil farm, mocktail Herbal Elixir, dessert buah organik (DUMMY demo, contoh jawaban AI).', 210, 130, 540.00);

-- ---------------------------------------------------------------------
-- 2.2 mkt_event_ideas (3, 1 tersambung ke chat di atas)
-- ---------------------------------------------------------------------
INSERT INTO mkt_event_ideas (property_id, title, target_date, concept, status, source_chat_id) VALUES
(1, 'Sunset Movie Night Valley (DUMMY demo)', DATE_ADD(CURDATE(), INTERVAL 45 DAY),
 'Nonton film outdoor tepi valley dgn picnic set, tema romantic, dari brainstorm Studio AI (DUMMY demo).', 'ide', 1),
(1, 'Family Fun Day Farm (DUMMY demo)', DATE_ADD(CURDATE(), INTERVAL 70 DAY),
 'Aktivitas keluarga di farm organik: panen mini, feeding time, cooking class anak (DUMMY demo).', 'disetujui_gm', NULL),
(1, 'Chef Table Preview Meditera (DUMMY demo)', DATE_ADD(CURDATE(), INTERVAL 100 DAY),
 'Preview menu degustasi baru Meditera Restaurant, tamu undangan terbatas (DUMMY demo).', 'ide', NULL);

-- ---------------------------------------------------------------------
-- 2.3 mkt_menus (2, 1 tersambung ke chat di atas) — outlet resmi
-- (Meditera Restaurant / Sunken Pool Bar, sanggraloka.md §2)
-- ---------------------------------------------------------------------
INSERT INTO mkt_menus (property_id, name, outlet, items, proposed_price, status, source_chat_id) VALUES
(1, 'Meditera Harvest Tasting Menu (DUMMY demo)', 'Meditera Restaurant',
 JSON_ARRAY('Amuse bouche hasil kebun organik', 'Ikan bakar bumbu Mediterania', 'Dessert buah farm'), 850000.00, 'draft', 1),
(1, 'Sunken Pool Bar Mocktail Set (DUMMY demo)', 'Sunken Pool Bar',
 JSON_ARRAY('Butterfly Pea Fizz', 'Herbal Elixir Cooler'), 95000.00, 'disetujui_gm', NULL);

-- ---------------------------------------------------------------------
-- 2.4 mkt_keywords — 8 (2 per pasar EN/FR/KR/ID)
-- ---------------------------------------------------------------------
INSERT INTO mkt_keywords (property_id, keyword, cluster, market, intent, target_page, last_position, checked_at) VALUES
(1, 'eco luxury resort ubud', 'eco-luxury-ubud', 'EN', 'navigational', '/', 8, DATE_SUB(CURDATE(), INTERVAL 5 DAY)),
(1, 'farm to table dining bali', 'farm-dining', 'EN', 'informational', '/meditera-restaurant', NULL, NULL),
(1, 'hotel luxe bali foret', 'luxe-bali-fr', 'FR', 'informational', '/', NULL, NULL),
(1, 'resort bio bali romantique', 'bio-romantique-fr', 'FR', 'navigational', '/', 14, DATE_SUB(CURDATE(), INTERVAL 5 DAY)),
(1, '발리 럭셔리 리조트', 'bali-luxury-kr', 'KR', 'navigational', '/', 11, DATE_SUB(CURDATE(), INTERVAL 5 DAY)),
(1, '발리 신혼여행 호텔', 'honeymoon-kr', 'KR', 'transactional', '/book', NULL, NULL),
(1, 'resort organik ubud', 'resort-organik-ubud', 'ID', 'navigational', '/', 6, DATE_SUB(CURDATE(), INTERVAL 5 DAY)),
(1, 'villa kolam pribadi ubud', 'villa-private-pool-ubud', 'ID', 'transactional', '/book', 9, DATE_SUB(CURDATE(), INTERVAL 5 DAY));

-- ---------------------------------------------------------------------
-- 2.5 mkt_generated_content — 3, status berbeda, bulan berjalan
-- ---------------------------------------------------------------------
INSERT INTO mkt_generated_content (property_id, type, month, content, status, reviewer_id, notes) VALUES
(1, 'blog', DATE_FORMAT(CURDATE(), '%Y-%m'),
 'Draft artikel blog: "5 Alasan Sanggraloka Ubud Cocok untuk Family Retreat" (DUMMY demo, draft AI belum direview).', 'draft', NULL, NULL),
(1, 'gads', DATE_FORMAT(CURDATE(), '%Y-%m'),
 'Draft RSA Google Ads: headline & deskripsi kampanye eco-luxury Ubud (DUMMY demo).', 'direview', 562, NULL),
(1, 'ig', DATE_FORMAT(CURDATE(), '%Y-%m'),
 '12 ide caption Instagram bulan ini (DUMMY demo).', 'dipublikasikan', 562, 'Disetujui & dipublikasikan tim design (DUMMY demo).');

-- ---------------------------------------------------------------------
-- 2.6 mkt_kol_results — +1 (kol_id=1, visit_id NULL — konten organik di
-- luar visit terjadwal yg dilacak mkt_kol_visits)
-- ---------------------------------------------------------------------
INSERT INTO mkt_kol_results (kol_id, visit_id, content_link, reach, promo_code) VALUES
(1, NULL, 'https://instagram.com/p/demo-kol-id-sanggraloka (DUMMY link)', 48000, 'DEMOKOLID15');

-- ---------------------------------------------------------------------
-- 2.7 mkt_reservations — 30 baris 2026 (resv_no unik, codegen deterministik
-- via scratchpad/gen_reservations.php) + mkt_otb_snapshots — 2 snapshot
-- beda tanggal (kolom persis 0009_mkt_init.sql: property_id, report_year,
-- resv_no, guest_name, partner_id, agent_raw, arrival, departure, nights,
-- room_type, pax, status_raw, cancelled, rate, revenue, segment,
-- created_pms, first_seen, last_seen). Room type = 6 tipe kamar resmi.
-- 3 baris cancelled (i=6,17,24) utk variasi dashboard.
-- ---------------------------------------------------------------------
INSERT INTO mkt_reservations
  (property_id, report_year, resv_no, guest_name, partner_id, agent_raw, arrival, departure,
   nights, room_type, pax, status_raw, cancelled, rate, revenue, segment, created_pms, first_seen, last_seen) VALUES
(1, 2026, 'RSV-2026-0001', 'Demo Guest - Kim Household 1', NULL, '', '2026-07-08', '2026-07-10', 2.0, 'Premiere Suite', 3.0, 'Confirmed', 0, 7700000, 15400000, 'Direct', '2026-06-17', '2026-06-17', CURDATE()),
(1, 2026, 'RSV-2026-0002', 'Demo Guest - Park Wedding Party 2', NULL, '', '2026-07-15', '2026-07-17', 2.0, 'Deluxe Private Pool Villa', 4.0, 'Confirmed', 0, 6800000, 13600000, 'Travel Agent', '2026-06-23', '2026-06-23', CURDATE()),
(1, 2026, 'RSV-2026-0003', 'Demo Guest - Martin Honeymoon 3', 1, '', '2026-07-22', '2026-07-25', 3.0, 'Premiere Private Pool Villa', 2.0, 'Confirmed', 0, 5900000, 17700000, 'Corporate', '2026-06-29', '2026-06-29', CURDATE()),
(1, 2026, 'RSV-2026-0004', 'Demo Guest - Lee Corporate Group 4', NULL, '', '2026-07-02', '2026-07-05', 3.0, 'One-Bedroom Presidential Pool Villa', 3.0, 'Confirmed', 0, 5000000, 15000000, 'Wholesaler', '2026-06-08', '2026-06-08', CURDATE()),
(1, 2026, 'RSV-2026-0005', 'Demo Guest - Fontaine Couple 5', NULL, '', '2026-07-09', '2026-07-13', 4.0, 'Two-Bedroom Presidential Pool Villa', 4.0, 'Confirmed', 0, 4100000, 16400000, 'OTA', '2026-06-14', '2026-06-14', CURDATE()),
(1, 2026, 'RSV-2026-0006', 'Demo Guest - Choi Retreat 6', 2, '', '2026-08-16', '2026-08-21', 5.0, 'Deluxe Suite', 2.0, 'Cancelled', 1, 3200000, 0, 'Direct', '2026-07-21', '2026-07-21', CURDATE()),
(1, 2026, 'RSV-2026-0007', 'Demo Guest - Laurent Family 7', NULL, '', '2026-08-23', '2026-08-30', 7.0, 'Premiere Suite', 3.0, 'Tentative', 0, 7700000, 53900000, 'Travel Agent', '2026-07-27', '2026-07-27', CURDATE()),
(1, 2026, 'RSV-2026-0008', 'Demo Guest - Han Business Trip 8', NULL, '', '2026-08-03', '2026-08-04', 1.0, 'Deluxe Private Pool Villa', 4.0, 'Tentative', 0, 6800000, 6800000, 'Corporate', '2026-07-06', '2026-07-06', CURDATE()),
(1, 2026, 'RSV-2026-0009', 'Demo Guest - Bernard Anniversary 9', 3, '', '2026-08-10', '2026-08-12', 2.0, 'Premiere Private Pool Villa', 2.0, 'Tentative', 0, 5900000, 11800000, 'Wholesaler', '2026-07-12', '2026-07-12', CURDATE()),
(1, 2026, 'RSV-2026-0010', 'Demo Guest - Yoon Solo Traveler 10', NULL, '', '2026-08-17', '2026-08-19', 2.0, 'One-Bedroom Presidential Pool Villa', 3.0, 'Tentative', 0, 5000000, 10000000, 'OTA', '2026-07-18', '2026-07-18', CURDATE()),
(1, 2026, 'RSV-2026-0011', 'Demo Guest - Moreau Group 11', NULL, '', '2026-09-24', '2026-09-27', 3.0, 'Two-Bedroom Presidential Pool Villa', 4.0, 'Tentative', 0, 4100000, 12300000, 'Direct', '2026-08-24', '2026-08-24', CURDATE()),
(1, 2026, 'RSV-2026-0012', 'Demo Guest - Dubois Family 12', 1, '', '2026-09-04', '2026-09-07', 3.0, 'Deluxe Suite', 2.0, 'Tentative', 0, 3200000, 9600000, 'Travel Agent', '2026-08-03', '2026-08-03', CURDATE()),
(1, 2026, 'RSV-2026-0013', 'Demo Guest - Kim Household 13', NULL, '', '2026-09-11', '2026-09-15', 4.0, 'Premiere Suite', 3.0, 'Tentative', 0, 7700000, 30800000, 'Corporate', '2026-08-09', '2026-08-09', CURDATE()),
(1, 2026, 'RSV-2026-0014', 'Demo Guest - Park Wedding Party 14', NULL, '', '2026-09-18', '2026-09-23', 5.0, 'Deluxe Private Pool Villa', 4.0, 'Tentative', 0, 6800000, 34000000, 'Wholesaler', '2026-08-15', '2026-08-15', CURDATE()),
(1, 2026, 'RSV-2026-0015', 'Demo Guest - Martin Honeymoon 15', 2, '', '2026-09-25', '2026-10-02', 7.0, 'Premiere Private Pool Villa', 2.0, 'Tentative', 0, 5900000, 41300000, 'OTA', '2026-08-21', '2026-08-21', CURDATE()),
(1, 2026, 'RSV-2026-0016', 'Demo Guest - Lee Corporate Group 16', NULL, '', '2026-10-05', '2026-10-06', 1.0, 'One-Bedroom Presidential Pool Villa', 3.0, 'Tentative', 0, 5000000, 5000000, 'Direct', '2026-08-30', '2026-08-30', CURDATE()),
(1, 2026, 'RSV-2026-0017', 'Demo Guest - Fontaine Couple 17', NULL, '', '2026-10-12', '2026-10-14', 2.0, 'Two-Bedroom Presidential Pool Villa', 4.0, 'Cancelled', 1, 4100000, 0, 'Travel Agent', '2026-09-05', '2026-09-05', CURDATE()),
(1, 2026, 'RSV-2026-0018', 'Demo Guest - Choi Retreat 18', 3, '', '2026-10-19', '2026-10-21', 2.0, 'Deluxe Suite', 2.0, 'Tentative', 0, 3200000, 6400000, 'Corporate', '2026-09-11', '2026-09-11', CURDATE()),
(1, 2026, 'RSV-2026-0019', 'Demo Guest - Laurent Family 19', NULL, '', '2026-10-26', '2026-10-29', 3.0, 'Premiere Suite', 3.0, 'Tentative', 0, 7700000, 23100000, 'Wholesaler', '2026-09-17', '2026-09-17', CURDATE()),
(1, 2026, 'RSV-2026-0020', 'Demo Guest - Han Business Trip 20', NULL, '', '2026-10-06', '2026-10-09', 3.0, 'Deluxe Private Pool Villa', 4.0, 'Tentative', 0, 6800000, 20400000, 'OTA', '2026-08-27', '2026-08-27', CURDATE()),
(1, 2026, 'RSV-2026-0021', 'Demo Guest - Bernard Anniversary 21', 1, '', '2026-11-13', '2026-11-17', 4.0, 'Premiere Private Pool Villa', 2.0, 'Tentative', 0, 5900000, 23600000, 'Direct', '2026-10-03', '2026-10-03', CURDATE()),
(1, 2026, 'RSV-2026-0022', 'Demo Guest - Yoon Solo Traveler 22', NULL, '', '2026-11-20', '2026-11-25', 5.0, 'One-Bedroom Presidential Pool Villa', 3.0, 'Tentative', 0, 5000000, 25000000, 'Travel Agent', '2026-10-09', '2026-10-09', CURDATE()),
(1, 2026, 'RSV-2026-0023', 'Demo Guest - Moreau Group 23', NULL, '', '2026-11-27', '2026-12-04', 7.0, 'Two-Bedroom Presidential Pool Villa', 4.0, 'Tentative', 0, 4100000, 28700000, 'Corporate', '2026-10-15', '2026-10-15', CURDATE()),
(1, 2026, 'RSV-2026-0024', 'Demo Guest - Dubois Family 24', 2, '', '2026-11-07', '2026-11-08', 1.0, 'Deluxe Suite', 2.0, 'Cancelled', 1, 3200000, 0, 'Wholesaler', '2026-09-24', '2026-09-24', CURDATE()),
(1, 2026, 'RSV-2026-0025', 'Demo Guest - Kim Household 25', NULL, '', '2026-11-14', '2026-11-16', 2.0, 'Premiere Suite', 3.0, 'Tentative', 0, 7700000, 15400000, 'OTA', '2026-09-30', '2026-09-30', CURDATE()),
(1, 2026, 'RSV-2026-0026', 'Demo Guest - Park Wedding Party 26', NULL, '', '2026-12-21', '2026-12-23', 2.0, 'Deluxe Private Pool Villa', 4.0, 'Tentative', 0, 6800000, 13600000, 'Direct', '2026-11-05', '2026-11-05', CURDATE()),
(1, 2026, 'RSV-2026-0027', 'Demo Guest - Martin Honeymoon 27', 3, '', '2026-12-01', '2026-12-04', 3.0, 'Premiere Private Pool Villa', 2.0, 'Tentative', 0, 5900000, 17700000, 'Travel Agent', '2026-10-15', '2026-10-15', CURDATE()),
(1, 2026, 'RSV-2026-0028', 'Demo Guest - Lee Corporate Group 28', NULL, '', '2026-12-08', '2026-12-11', 3.0, 'One-Bedroom Presidential Pool Villa', 3.0, 'Tentative', 0, 5000000, 15000000, 'Corporate', '2026-10-21', '2026-10-21', CURDATE()),
(1, 2026, 'RSV-2026-0029', 'Demo Guest - Fontaine Couple 29', NULL, '', '2026-12-15', '2026-12-19', 4.0, 'Two-Bedroom Presidential Pool Villa', 4.0, 'Tentative', 0, 4100000, 16400000, 'Wholesaler', '2026-10-27', '2026-10-27', CURDATE()),
(1, 2026, 'RSV-2026-0030', 'Demo Guest - Choi Retreat 30', 1, '', '2026-12-22', '2026-12-27', 5.0, 'Deluxe Suite', 2.0, 'Tentative', 0, 3200000, 16000000, 'OTA', '2026-11-02', '2026-11-02', CURDATE());

-- Snapshot 1 = 7 hari lalu (baseline lebih rendah, revenue ~82% dari
-- snapshot terkini, utk simulasi pickup positif di dashboard);
-- snapshot 2 = hari ini (agregat OTB aktual dari 30 baris di atas).
INSERT INTO mkt_otb_snapshots (property_id, report_year, report_date, filename, rows_total, rows_new, rows_changed, rows_cancelled, otb_json, uploaded_by) VALUES
(1, 2026, DATE_SUB(CURDATE(), INTERVAL 7 DAY), 'reservations_2026_snapshot_lama-demo.xlsx (DUMMY)', 24, 24, 0, 2,
 '{"2026-07":{"n":4,"rn":12,"rev":64042000},"2026-08":{"n":3,"rn":10,"rev":67650000},"2026-09":{"n":4,"rn":20,"rev":104960000},"2026-10":{"n":3,"rn":7,"rev":45018000},"2026-11":{"n":3,"rn":16,"rev":76014000},"2026-12":{"n":4,"rn":15,"rev":64534000}}',
 562),
(1, 2026, CURDATE(), 'reservations_2026_snapshot_terkini-demo.xlsx (DUMMY)', 30, 6, 3, 3,
 '{"2026-07":{"n":5,"rn":14,"rev":78100000},"2026-08":{"n":4,"rn":12,"rev":82500000},"2026-09":{"n":5,"rn":22,"rev":128000000},"2026-10":{"n":4,"rn":9,"rev":54900000},"2026-11":{"n":4,"rn":18,"rev":92700000},"2026-12":{"n":5,"rn":17,"rev":78700000}}',
 562);

-- ---------------------------------------------------------------------
-- 2.8 mkt_upload_maps — 1 pemetaan kolom tersimpan utk tahun 2026
-- (field system persis App\Service\MktUploadService::RESV_FIELDS)
-- ---------------------------------------------------------------------
INSERT INTO mkt_upload_maps (property_id, report_year, map_json) VALUES
(1, 2026, '{"resv_no":0,"guest_name":1,"agent_name":2,"arrival":3,"departure":4,"nights":5,"room_type":6,"pax":7,"status":8,"rate":9,"revenue":10,"segment":11,"created":12}');

-- =====================================================================
-- BAGIAN 3 — FIX (HotelFix) — isi tabel kosong seperlunya, TIDAK
-- menyentuh work_orders/wo_costs/meter_readings/utility_*/vendors/
-- broadcasts existing (sudah terisi 0016, anti-duplikat).
-- =====================================================================

-- ---------------------------------------------------------------------
-- 3.1 photos — 3 baris (WO 21 verified, checklist genset mingguan)
-- ---------------------------------------------------------------------
INSERT INTO photos (wo_id, type, filename, uploaded_by) VALUES
(21, 'before', 'wo_photos/21/before-demo.jpg (DUMMY)', 4),
(21, 'after', 'wo_photos/21/after-demo.jpg (DUMMY)', 4),
(1, 'evidence', 'wo_photos/1/evidence-demo.jpg (DUMMY)', 7);

-- ---------------------------------------------------------------------
-- 3.2 wo_checklist_results — WO 21 (checklist 1, Genset Mingguan, item
-- id 1-5) + WO 22 (checklist 4, HACCP Suhu Harian, item id 48-49)
-- ---------------------------------------------------------------------
INSERT INTO wo_checklist_results (wo_id, item_id, result, value_numeric, note) VALUES
(21, 1, 'ok', NULL, NULL),
(21, 2, 'ok', NULL, NULL),
(21, 3, 'ok', NULL, NULL),
(21, 4, 'ok', 12.6, 'Tegangan aki starter normal (DUMMY demo)'),
(21, 5, 'ok', NULL, NULL),
(22, 48, 'ok', 2.1, 'Suhu cold room 1 dlm rentang aman (DUMMY demo)'),
(22, 49, 'ok', 2.4, 'Suhu cold room 2 dlm rentang aman (DUMMY demo)');

-- ---------------------------------------------------------------------
-- 3.3 generator_log — 2 baris jejak eksekusi PM generator (bin/generate-pm.php)
-- ---------------------------------------------------------------------
INSERT INTO generator_log (property_id, run_at, schedules_processed, wo_created, status, message) VALUES
(1, DATE_SUB(NOW(), INTERVAL 1 DAY), 6, 2, 'success', 'Auto-generate PM run harian (DUMMY demo — cron belum live di server ini).'),
(1, DATE_SUB(NOW(), INTERVAL 2 DAY), 6, 1, 'partial', '1 schedule dilewati karena aset non-aktif (DUMMY demo).');

-- CATATAN: push_tokens SENGAJA TIDAK diisi — kolom `token` butuh token FCM/
-- APNs nyata dari device terpasang; token dummy tidak berguna (push akan
-- gagal terkirim & tidak merepresentasikan apa pun yang bisa diuji) dan
-- bisa keliru dikira device asli oleh NotificationService. Dicatat sbg
-- pengecualian yang disengaja (sama seperti keputusan 0016).

-- =====================================================================
-- BAGIAN 4 — AUDIT & STEP-UP (satu tabel utk FIX+CREW, F10 zona merah)
-- =====================================================================

-- ---------------------------------------------------------------------
-- 4.1 audit_logs — 5 contoh. HANYA module 'fix'/'crew' (lihat catatan
-- header ttg audit_logs.module ENUM tidak memuat 'sell').
-- ---------------------------------------------------------------------
INSERT INTO audit_logs (ts, user_id, role, property_id, module, action, entity, entity_id, before_data, after_data, note) VALUES
(DATE_SUB(NOW(), INTERVAL 3 HOUR), 901, 'hr_admin', 1, 'crew', 'login', 'users', '901', NULL, NULL, 'Login QC demo HR Manager (DUMMY demo log)'),
(DATE_SUB(NOW(), INTERVAL 2 HOUR), 901, 'hr_admin', 1, 'crew', 'view_sensitive', 'hr_employees', '3', NULL, NULL, 'Lihat data sensitif karyawan utk proses exit (DUMMY demo log)'),
(DATE_SUB(NOW(), INTERVAL 90 MINUTE), 501, 'gm', 1, 'crew', 'stepup_ok', 'hr_payroll_periods', '1', NULL, NULL, 'Verifikasi PIN payroll sukses (DUMMY demo log)'),
(DATE_SUB(NOW(), INTERVAL 95 MINUTE), 501, 'gm', 1, 'crew', 'stepup_fail', 'hr_payroll_periods', NULL, NULL, NULL, 'PIN salah pada percobaan pertama (DUMMY demo log)'),
(DATE_SUB(NOW(), INTERVAL 1 HOUR), 4, 'technician', 1, 'fix', 'logout', 'users', '4', NULL, NULL, 'Logout teknisi selesai shift (DUMMY demo log)');

-- ---------------------------------------------------------------------
-- 4.2 auth_stepup — 1 baris kedaluwarsa (OTP WA terkirim tapi tak
-- diverifikasi tepat waktu)
-- ---------------------------------------------------------------------
INSERT INTO auth_stepup (user_id, zone, pin_hash, otp_hash, wa_msisdn, sent_at, expires_at, verified_at, fail_count) VALUES
(501, 'payroll', NULL, NULL, '+62895000000 (DUMMY)', DATE_SUB(NOW(), INTERVAL 2 HOUR), DATE_SUB(NOW(), INTERVAL 105 MINUTE), NULL, 1);

-- =====================================================================
-- END 0017_seed_dummy_full.sql
-- =====================================================================
