-- =====================================================================
-- HotelFix v2 — Migration 0005_seed_expand (REVISI: penomoran aman DB live)
-- Perluasan data demo (DEV-ONLY, jangan di produksi):
--   A. 7 karyawan baru (3 teknisi eng, 2 IT, 2 sipil) + akses + skills
--   B. 9 lokasi baru + 3 kategori pelengkap + 36 aset area utama
--   C. 25 work order baru (WO-000101..WO-000125) tersebar ke staf baru
--      + wo_costs + history + notifications
--   D. 2 pm_schedules baru (HACCP harian dapur, pompa kolam mingguan)
--
-- Prasyarat: 0001-0004 sudah diterapkan. Semua tanggal relatif NOW().
-- property_id = 1. Tabel `photos` TIDAK disentuh.
--
-- PENOMORAN AMAN — DB live sudah membuat baris sendiri (generator PM,
-- smoke test), maka id eksplisit dipindah ke rentang yang tidak akan
-- tersentuh auto_increment dalam waktu dekat:
--   users 7-13, locations 17-25, asset_categories 33-35 (aplikasi tidak
--     menulis tabel-tabel ini saat ini — id lanjutan aman),
--   assets 61-96, work_orders 101-125 (WO-000101+), pm_schedules 11-12,
--   wo_costs / wo_parts / history / notifications TANPA id eksplisit
--     (murni AUTO_INCREMENT).
-- =====================================================================


INSERT INTO user_property_access (user_id, property_id, role, department) VALUES
(7,  1, 'technician', 'engineering'),
(8,  1, 'technician', 'engineering'),
(9,  1, 'technician', 'engineering'),
(10, 1, 'technician', 'it'),
(11, 1, 'technician', 'it'),
(12, 1, 'technician', 'engineering'),
(13, 1, 'technician', 'engineering');

-- Skills (category_id dari 0002: 4 AC, 7 UPS, 8 Pompa, 18 Cat, 19 Kayu,
-- 20 Lantai, 21 Basah&Sealant, 22 Server&Jaringan, 23 CCTV, 24 Guest)
INSERT INTO skills (user_id, category_id, level, cert_document, valid_until) VALUES
(7,  4,  'advanced',  NULL, NULL),
(7,  8,  'advanced',  NULL, NULL),
(8,  4,  'advanced',  NULL, NULL),
(8,  7,  'advanced',  NULL, NULL),
(9,  4,  'basic',     NULL, NULL),
(9,  8,  'advanced',  NULL, NULL),
(10, 22, 'advanced',  NULL, NULL),
(11, 23, 'advanced',  'sertifikat_cctv_joko.pdf', DATE_ADD(CURDATE(), INTERVAL 200 DAY)),
(11, 24, 'advanced',  NULL, NULL),
(12, 18, 'advanced',  NULL, NULL),
(12, 19, 'advanced',  NULL, NULL),
(13, 20, 'advanced',  NULL, NULL),
(13, 21, 'certified', 'sertifikat_aplikator_waterproofing_wawan.pdf', DATE_ADD(CURDATE(), INTERVAL 40 DAY));

-- ---------------------------------------------------------------------
-- B1. Lokasi baru (17-25)
-- ---------------------------------------------------------------------
INSERT INTO locations (id, property_id, code, name, building, wing, floor, type, active) VALUES
(17, 1, 'ROOFTOP',  'Area Rooftop',              'Main Tower', NULL, 'RF', 'external',      1),
(18, 1, 'CORR-05',  'Koridor Lantai 5',          'Main Tower', 'A',  '05', 'public_area',   1),
(19, 1, 'CORR-08',  'Koridor Lantai 8',          'Main Tower', 'B',  '08', 'public_area',   1),
(20, 1, 'RM-0803',  'Kamar 0803',                'Main Tower', 'B',  '08', 'room',          1),
(21, 1, 'RM-0805',  'Kamar 0805',                'Main Tower', 'B',  '08', 'room',          1),
(22, 1, 'RM-1207',  'Kamar 1207',                'Main Tower', 'A',  '12', 'room',          1),
(23, 1, 'RM-1501',  'Kamar 1501 (balkon)',       'Main Tower', 'A',  '15', 'room',          1),
(24, 1, 'CORR-03',  'Koridor Lantai 3',          'Main Tower', 'A',  '03', 'public_area',   1),
(25, 1, 'BASEMENT', 'Basement Parkir & Servis',  'Main Tower', NULL, 'B1', 'back_of_house', 1);

-- ---------------------------------------------------------------------
-- B2. Kategori pelengkap (33-35) — taksonomi §3 yang belum ter-seed
-- ---------------------------------------------------------------------
INSERT INTO asset_categories (id, property_id, parent_id, name, department, restricted, default_checklist_id) VALUES
(33, 1, NULL, 'Plumbing - Tangki Air (Roof Tank/GWT)',        'engineering', 0, NULL),
(34, 1, NULL, 'Kelistrikan - Penangkal Petir & Grounding',    'engineering', 0, NULL),
(35, 1, NULL, 'HVAC - Exhaust Fan & Ventilasi',               'engineering', 0, NULL);

-- ---------------------------------------------------------------------
-- B3. Aset baru (61-96, rentang aman) — area utama
-- ---------------------------------------------------------------------
INSERT INTO assets
(id, property_id, asset_code, accounting_asset_no, name, category_id, location_id, brand,
 purchase_date, purchase_price, warranty_until, criticality, status, notes) VALUES
-- Lobby (loc 6)
(61, 1, 'AST-000061', 'FA-2024-201', 'AC Cassette Lobby 1',            4,  6,  'Daikin',    '2024-01-10', 18500000.00,  DATE_ADD(CURDATE(), INTERVAL 6 MONTH),  'normal',   'active', 'AC cassette area lobby sisi timur'),
(62, 1, 'AST-000062', 'FA-2024-202', 'AC Cassette Lobby 2',            4,  6,  'Daikin',    '2024-01-10', 18500000.00,  DATE_ADD(CURDATE(), INTERVAL 6 MONTH),  'normal',   'active', 'AC cassette area lobby sisi barat'),
(63, 1, 'AST-000063', 'FA-2024-203', 'CCTV Dome Lobby',                23, 6,  'Hikvision', '2024-02-01', 3500000.00,   NULL,                                    'normal',   'active', 'Kamera dome pintu utama'),
(64, 1, 'AST-000064', 'FA-2024-204', 'Access Control Pintu Utama',     23, 6,  'ZKTeco',    '2024-02-01', 8000000.00,   NULL,                                    'high',     'active', 'Access control pintu utama staff'),
(65, 1, 'AST-000065', 'FA-2024-205', 'Digital Signage Lobby',          25, 6,  'Samsung',   '2024-03-01', 15000000.00,  DATE_ADD(CURDATE(), INTERVAL 9 MONTH),  'low',      'active', 'Layar informasi 55 inch'),
-- Kolam renang (loc 8)
(66, 1, 'AST-000066', 'FA-2023-210', 'Pompa Sirkulasi Kolam 2',        15, 8,  'Pentair',   '2023-06-01', 35000000.00,  NULL,                                    'high',     'active', 'Pompa sirkulasi cadangan/paralel'),
(67, 1, 'AST-000067', 'FA-2023-211', 'Sand Filter Kolam',              15, 8,  'Emaux',     '2023-06-01', 28000000.00,  NULL,                                    'high',     'active', 'Filter pasir utama kolam'),
(68, 1, 'AST-000068', 'FA-2023-212', 'Dosing Pump Chlorine',           15, 8,  'Etatron',   '2023-06-01', 7500000.00,   NULL,                                    'high',     'active', 'Dosing otomatis chlorine'),
(69, 1, 'AST-000069', 'FA-2023-213', 'Pool Heater',                    15, 8,  'Hayward',   '2023-06-01', 45000000.00,  NULL,                                    'normal',   'active', 'Pemanas kolam jacuzzi'),
-- Dapur utama (loc 13)
(70, 1, 'AST-000070', 'FA-2022-220', 'Ice Maker Kitchen',              26, 13, 'Hoshizaki', '2022-08-01', 38000000.00,  NULL,                                    'high',     'active', 'Mesin es dapur utama'),
(71, 1, 'AST-000071', 'FA-2022-221', 'Combi Oven',                     27, 13, 'Rational',  '2022-08-01', 185000000.00, NULL,                                    'high',     'active', 'Combi oven 10 tray'),
(72, 1, 'AST-000072', 'FA-2022-222', 'Exhaust Hood Dapur Utama',       28, 13, 'Custom',    '2022-08-01', 65000000.00,  NULL,                                    'high',     'active', 'Hood + duct, risiko kebakaran grease'),
(73, 1, 'AST-000073', 'FA-2022-223', 'Dishwasher Kitchen',             27, 13, 'Winterhalter','2022-08-01', 95000000.00, NULL,                                   'normal',   'active', 'Dishwasher rack conveyor'),
-- Ruang server (loc 15)
(74, 1, 'AST-000074', 'FA-2023-230', 'Rack UPS Server',                22, 15, 'APC',       '2023-03-01', 28000000.00,  DATE_ADD(CURDATE(), INTERVAL 3 MONTH),  'high',     'active', 'UPS rack 6kVA ruang server'),
(75, 1, 'AST-000075', 'FA-2023-231', 'Core Switch',                    22, 15, 'Cisco',     '2023-03-01', 45000000.00,  NULL,                                    'critical', 'active', 'Core switch jaringan gedung'),
(76, 1, 'AST-000076', 'FA-2023-232', 'Router Utama',                   22, 15, 'MikroTik',  '2023-03-01', 25000000.00,  NULL,                                    'high',     'active', 'Router gateway ISP'),
(77, 1, 'AST-000077', 'FA-2023-233', 'NAS Backup',                     22, 15, 'Synology',  '2023-03-01', 32000000.00,  NULL,                                    'high',     'active', 'NAS backup harian PMS'),
(78, 1, 'AST-000078', 'FA-2023-234', 'AC Presisi Ruang Server',        4,  15, 'Stulz',     '2023-03-01', 85000000.00,  NULL,                                    'high',     'active', 'AC presisi 24 jam ruang server'),
-- Ruang genset/panel (loc 12)
(79, 1, 'AST-000079', 'FA-2020-240', 'Trafo 1250 kVA',                 6,  12, 'Trafindo',  '2020-01-15', 450000000.00, NULL,                                    'critical', 'active', 'Trafo distribusi utama'),
(80, 1, 'AST-000080', 'FA-2020-241', 'Panel SDP Podium',               6,  12, 'Schneider', '2020-01-15', 120000000.00, NULL,                                    'high',     'active', 'Sub distribution panel podium'),
(81, 1, 'AST-000081', 'FA-2020-242', 'Capacitor Bank',                 6,  12, 'Schneider', '2020-01-15', 65000000.00,  NULL,                                    'normal',   'active', 'Perbaikan faktor daya'),
-- Rooftop (loc 17)
(82, 1, 'AST-000082', 'FA-2020-250', 'Roof Tank 1',                    33, 17, 'Penguin',   '2020-02-01', 40000000.00,  NULL,                                    'high',     'active', 'Tangki air atap 10 m3'),
(83, 1, 'AST-000083', 'FA-2020-251', 'Pompa Booster Rooftop',          8,  17, 'Grundfos',  '2020-02-01', 48000000.00,  NULL,                                    'high',     'active', 'Booster distribusi lantai atas'),
(84, 1, 'AST-000084', 'FA-2020-252', 'Penangkal Petir',                34, 17, 'Kurn',      '2020-02-01', 35000000.00,  NULL,                                    'normal',   'active', 'Penangkal petir elektrostatis + grounding'),
(85, 1, 'AST-000085', 'FA-2020-253', 'Exhaust Fan Rooftop',            35, 17, 'KDK',       '2020-02-01', 8500000.00,   NULL,                                    'normal',   'active', 'Exhaust shaft toilet umum'),
-- Gym (loc 9)
(86, 1, 'AST-000086', 'FA-2023-260', 'Treadmill 1',                    29, 9,  'Life Fitness','2023-05-01', 45000000.00, DATE_ADD(CURDATE(), INTERVAL 4 MONTH), 'normal',   'active', 'Treadmill komersial'),
(87, 1, 'AST-000087', 'FA-2023-261', 'Treadmill 2',                    29, 9,  'Life Fitness','2023-05-01', 45000000.00, DATE_ADD(CURDATE(), INTERVAL 4 MONTH), 'normal',   'active', 'Treadmill komersial'),
(88, 1, 'AST-000088', 'FA-2023-262', 'Sepeda Statis',                  29, 9,  'Matrix',    '2023-05-01', 25000000.00,  NULL,                                    'low',      'active', 'Upright bike'),
(89, 1, 'AST-000089', 'FA-2023-263', 'Sauna Generator',                29, 9,  'Harvia',    '2023-05-01', 55000000.00,  NULL,                                    'normal',   'active', 'Generator sauna gym'),
-- Laundry (loc 14)
(90, 1, 'AST-000090', 'FA-2022-270', 'Dryer Laundry Industrial',       16, 14, 'Electrolux','2022-04-01', 120000000.00, NULL,                                    'normal',   'active', 'Dryer 30kg — lint trap risiko kebakaran'),
(91, 1, 'AST-000091', 'FA-2022-271', 'Flatwork Ironer',                16, 14, 'Electrolux','2022-04-01', 150000000.00, NULL,                                    'normal',   'active', 'Roll ironer linen'),
-- Basement (loc 25)
(92, 1, 'AST-000092', 'FA-2024-280', 'CCTV Basement',                  23, 25, 'Hikvision', '2024-02-01', 3000000.00,   NULL,                                    'normal',   'active', 'Kamera bullet area parkir basement'),
(93, 1, 'AST-000093', 'FA-2020-281', 'Pompa Sump Pit Basement',        8,  25, 'Grundfos',  '2020-03-01', 18000000.00,  NULL,                                    'high',     'active', 'Pompa banjir sump pit + float switch'),
-- Koridor lantai 3 (loc 24)
(94, 1, 'AST-000094', 'FA-2024-282', 'Access Point Lantai 3',          22, 24, 'Ruckus',    '2024-01-05', 4500000.00,   DATE_ADD(CURDATE(), INTERVAL 8 MONTH),  'normal',   'active', 'AP Wi-Fi koridor & kamar lantai 3'),
-- Fire safety tersebar
(95, 1, 'AST-000095', 'FA-2021-290', 'APAR Lobby',                     14, 6,  'Servvo',    '2021-01-01', 1200000.00,   NULL,                                    'high',     'active', 'APAR powder 6kg dekat resepsionis'),
(96, 1, 'AST-000096', 'FA-2021-291', 'Hydrant Box Basement',           14, 25, 'Ozeki',     '2021-01-01', 6500000.00,   NULL,                                    'high',     'active', 'Hydrant box indoor basement');

-- ---------------------------------------------------------------------
-- D. pm_schedules baru (11-12, rentang aman)
-- ---------------------------------------------------------------------
INSERT INTO pm_schedules
(id, property_id, name, scope, asset_id, location_id, category_id, department, checklist_id,
 frequency_type, frequency_value, weekly_days, monthly_day, lead_time_days, grace_days,
 schedule_base, executor, vendor_id, auto_assign, spread, estimated_minutes, priority, active,
 next_due_date, next_due_meter) VALUES
(11, 1, 'HACCP Suhu - Harian Dapur',   'category', NULL, NULL, 26, 'kitchen',     4,
 'daily',  1, NULL,  NULL, 1, 0, 'fixed', 'internal', NULL, 1, 0, 20, 'high',   1, DATE_ADD(CURDATE(), INTERVAL 1 DAY), NULL),
(12, 1, 'Pompa Kolam - Mingguan',      'asset',    66,  NULL, NULL, 'engineering', NULL,
 'weekly', 1, 'thu', NULL, 2, 1, 'fixed', 'internal', NULL, 0, 0, 30, 'normal', 1, DATE_ADD(CURDATE(), INTERVAL 7 DAY), NULL);

-- =====================================================================
-- C. WORK ORDERS baru (101-125, WO-000101..WO-000125 — rentang aman)
-- =====================================================================

-- --- C1. In progress (staf baru sedang bekerja)
INSERT INTO work_orders
(id, property_id, wo_number, type, source, asset_id, location_id, category_id,
 reporter_id, assignee_id, description, priority, status, created_at, due_date, started_at) VALUES
(101, 1, 'WO-000101', 'corrective', 'report', 94, 24, 22, 5, 10,
 'AP lantai 3 mati - tamu komplain Wi-Fi koridor', 'high', 'in_progress',
 NOW() - INTERVAL 3 HOUR, CURDATE(), NOW() - INTERVAL 1 HOUR),
(105, 1, 'WO-000105', 'corrective', 'report', NULL, 18, 18, 5, 12,
 'Cat koridor lantai 5 mengelupas area depan lift', 'normal', 'in_progress',
 NOW() - INTERVAL 1 DAY, CURDATE(), NOW() - INTERVAL 4 HOUR),
(109, 1, 'WO-000109', 'corrective', 'report', 61, 6, 4, 5, 7,
 'AC cassette lobby 1 kurang dingin', 'normal', 'in_progress',
 NOW() - INTERVAL 5 HOUR, CURDATE(), NOW() - INTERVAL 2 HOUR),
(118, 1, 'WO-000118', 'corrective', 'report', NULL, 21, 8, 5, 9,
 'Kran air panas kamar 0805 menetes', 'normal', 'in_progress',
 NOW() - INTERVAL 6 HOUR, CURDATE(), NOW() - INTERVAL 3 HOUR),
(122, 1, 'WO-000122', 'corrective', 'manual', 68, 8, 15, NULL, 9,
 'Dosing pump chlorine tidak menyedot', 'high', 'in_progress',
 NOW() - INTERVAL 2 HOUR, CURDATE(), NOW() - INTERVAL 1 HOUR),
(123, 1, 'WO-000123', 'corrective', 'manual', 71, 13, 27, NULL, 8,
 'Combi oven error E13 - burner tidak menyala', 'urgent', 'in_progress',
 NOW() - INTERVAL 90 MINUTE, CURDATE(), NOW() - INTERVAL 30 MINUTE);

-- --- C2. Reported (laporan baru, termasuk 1 urgent key card)
INSERT INTO work_orders
(id, property_id, wo_number, type, source, asset_id, location_id, category_id,
 reporter_id, description, priority, status, created_at, due_date) VALUES
(102, 1, 'WO-000102', 'corrective', 'report', 92, 25, 23, 5,
 'CCTV basement gambar blur/berembun', 'normal', 'reported',
 NOW() - INTERVAL 5 HOUR, DATE_ADD(CURDATE(), INTERVAL 1 DAY)),
(104, 1, 'WO-000104', 'corrective', 'report', NULL, 22, 24, 5,
 'Key card reader kamar 1207 error - tamu tidak bisa masuk', 'urgent', 'reported',
 NOW() - INTERVAL 8 HOUR, CURDATE()),
(106, 1, 'WO-000106', 'corrective', 'report', NULL, 20, 21, 5,
 'Sealant kamar mandi 0803 berjamur', 'normal', 'reported',
 NOW() - INTERVAL 6 HOUR, DATE_ADD(CURDATE(), INTERVAL 2 DAY)),
(120, 1, 'WO-000120', 'corrective', 'report', 70, 13, 26, 5,
 'Ice maker produksi es lambat', 'high', 'reported',
 NOW() - INTERVAL 4 HOUR, DATE_ADD(CURDATE(), INTERVAL 1 DAY)),
(121, 1, 'WO-000121', 'corrective', 'report', 87, 9, 29, 5,
 'Treadmill 2 belt selip saat dipakai', 'normal', 'reported',
 NOW() - INTERVAL 7 HOUR, DATE_ADD(CURDATE(), INTERVAL 1 DAY));

-- --- C3. Waiting parts (sipil.wawan — material waterproofing dipesan)
INSERT INTO work_orders
(id, property_id, wo_number, type, source, asset_id, location_id, category_id,
 reporter_id, assignee_id, description, priority, status, created_at, due_date, started_at) VALUES
(108, 1, 'WO-000108', 'corrective', 'report', NULL, 23, 21, 5, 13,
 'Waterproofing balkon kamar 1501 rembes saat hujan', 'high', 'waiting_parts',
 NOW() - INTERVAL 2 DAY, CURDATE(), NOW() - INTERVAL 1 DAY);

-- --- C4. Done kemarin (belum diverifikasi)
INSERT INTO work_orders
(id, property_id, wo_number, type, source, asset_id, location_id, category_id,
 reporter_id, assignee_id, description, priority, status, repair_note,
 created_at, due_date, started_at, done_at, labor_minutes, cost_parts, cost_other) VALUES
(103, 1, 'WO-000103', 'corrective', 'report', NULL, 21, 24, 5, 11,
 'Telepon kamar 0805 mati (PABX)', 'normal', 'done',
 'Re-punch kabel ekstensi di MDF, tes panggilan keluar-masuk OK',
 NOW() - INTERVAL 30 HOUR, DATE_SUB(CURDATE(), INTERVAL 1 DAY),
 NOW() - INTERVAL 26 HOUR, NOW() - INTERVAL 24 HOUR, 45, 0, 50000.00),
(119, 1, 'WO-000119', 'corrective', 'report', NULL, 19, 14, 5, 8,
 'Emergency lamp koridor lantai 8 mati', 'normal', 'done',
 'Ganti unit emergency lamp LED, tes tombol OK',
 NOW() - INTERVAL 20 HOUR, DATE_SUB(CURDATE(), INTERVAL 1 DAY),
 NOW() - INTERVAL 18 HOUR, NOW() - INTERVAL 17 HOUR, 30, 120000.00, 0);

-- --- C5. Done + verified (dengan biaya)
INSERT INTO work_orders
(id, property_id, wo_number, type, source, asset_id, location_id, category_id,
 reporter_id, assignee_id, supervisor_id, description, priority, status, repair_note,
 created_at, due_date, started_at, done_at, verified_at, labor_minutes, cost_parts, cost_other) VALUES
(112, 1, 'WO-000112', 'corrective', 'report', 11, 1, 4, 5, 7, 3,
 'AC kamar 1201 bunyi berisik dari unit indoor', 'normal', 'verified',
 'Ganti kapasitor fan indoor, bersihkan blower, bunyi hilang',
 NOW() - INTERVAL 3 DAY, DATE_SUB(CURDATE(), INTERVAL 2 DAY),
 NOW() - INTERVAL 60 HOUR, NOW() - INTERVAL 58 HOUR, NOW() - INTERVAL 30 HOUR,
 45, 0, 220000.00),
(113, 1, 'WO-000113', 'corrective', 'manual', 85, 17, 35, NULL, 8, 3,
 'Exhaust fan rooftop bunyi kasar', 'normal', 'verified',
 'Ganti bearing, balancing impeller, vibrasi normal kembali',
 NOW() - INTERVAL 3 DAY, DATE_SUB(CURDATE(), INTERVAL 2 DAY),
 NOW() - INTERVAL 55 HOUR, NOW() - INTERVAL 52 HOUR, NOW() - INTERVAL 28 HOUR,
 120, 0, 350000.00),
(114, 1, 'WO-000114', 'corrective', 'manual', 93, 25, 8, NULL, 9, 3,
 'Pompa sump pit basement macet', 'high', 'verified',
 'Bersihkan impeller dari lumpur, ganti seal, tes float switch OK',
 NOW() - INTERVAL 2 DAY, DATE_SUB(CURDATE(), INTERVAL 1 DAY),
 NOW() - INTERVAL 30 HOUR, NOW() - INTERVAL 27 HOUR, NOW() - INTERVAL 20 HOUR,
 90, 0, 225000.00);

-- --- C6. Preventif terjadwal (due hari ini per teknisi baru + masa depan)
INSERT INTO work_orders
(id, property_id, wo_number, type, source, asset_id, location_id, category_id,
 schedule_id, checklist_version_id, assignee_id, description, priority, status, created_at, due_date) VALUES
(107, 1, 'WO-000107', 'preventive', 'manual', NULL, 6, 20, NULL, NULL, 13,
 'Poles marmer lobby (3-bulanan)', 'normal', 'scheduled',
 NOW() - INTERVAL 1 DAY, DATE_ADD(CURDATE(), INTERVAL 3 DAY)),
(110, 1, 'WO-000110', 'preventive', 'schedule', 62, 6, 4, 3, 2, 7,
 'PM bulanan AC cassette lobby 2', 'normal', 'scheduled',
 NOW() - INTERVAL 3 DAY, CURDATE()),
(111, 1, 'WO-000111', 'preventive', 'schedule', 78, 15, 4, 3, 2, 8,
 'PM bulanan AC presisi ruang server', 'high', 'scheduled',
 NOW() - INTERVAL 3 DAY, CURDATE()),
(115, 1, 'WO-000115', 'preventive', 'schedule', 66, 8, 15, 12, NULL, 9,
 'PM mingguan pompa sirkulasi kolam 2', 'normal', 'scheduled',
 NOW() - INTERVAL 2 DAY, CURDATE()),
(116, 1, 'WO-000116', 'preventive', 'manual', 86, 9, 29, NULL, NULL, 7,
 'PM bulanan treadmill 1', 'normal', 'scheduled',
 NOW() - INTERVAL 2 DAY, CURDATE()),
(117, 1, 'WO-000117', 'preventive', 'manual', 92, 25, 23, NULL, 5, 11,
 'PM bulanan CCTV basement', 'normal', 'scheduled',
 NOW() - INTERVAL 2 DAY, CURDATE()),
(124, 1, 'WO-000124', 'preventive', 'schedule', NULL, 13, 26, 11, 4, 4,
 'HACCP suhu harian dapur (besok pagi)', 'high', 'scheduled',
 NOW() - INTERVAL 6 HOUR, DATE_ADD(CURDATE(), INTERVAL 1 DAY)),
(125, 1, 'WO-000125', 'preventive', 'schedule', 66, 8, 15, 12, NULL, 9,
 'PM mingguan pompa sirkulasi kolam 2 (minggu depan)', 'normal', 'scheduled',
 NOW() - INTERVAL 6 HOUR, DATE_ADD(CURDATE(), INTERVAL 7 DAY));

-- ---------------------------------------------------------------------
-- C7. wo_parts & wo_costs (TANPA id eksplisit — AUTO_INCREMENT;
--     roll-up sudah diisi di kolom ringkasan work_orders)
-- ---------------------------------------------------------------------
INSERT INTO wo_parts (wo_id, part_id, qty, unit_price_snapshot) VALUES
(119, 3, 1, 120000.00);

INSERT INTO wo_costs (wo_id, kind, description, qty, unit_price, amount, incurred_at, entered_by, invoice_file, approved_by, approved_at) VALUES
(103, 'labor',    'Jasa IT 45 menit',              NULL, NULL,      50000.00,  NOW() - INTERVAL 24 HOUR, 11, NULL, NULL, NULL),
(112, 'material', 'Kapasitor fan indoor',          1,    175000.00, 175000.00, NOW() - INTERVAL 58 HOUR, 7,  NULL, NULL, NULL),
(112, 'labor',    'Jasa teknisi 45 menit',         NULL, NULL,      45000.00,  NOW() - INTERVAL 58 HOUR, 7,  NULL, NULL, NULL),
(113, 'material', 'Bearing exhaust fan',           1,    250000.00, 250000.00, NOW() - INTERVAL 52 HOUR, 8,  NULL, NULL, NULL),
(113, 'labor',    'Jasa teknisi 120 menit',        NULL, NULL,      100000.00, NOW() - INTERVAL 52 HOUR, 8,  NULL, NULL, NULL),
(114, 'material', 'Seal pompa sump pit',           1,    150000.00, 150000.00, NOW() - INTERVAL 27 HOUR, 9,  NULL, NULL, NULL),
(114, 'labor',    'Jasa teknisi 90 menit',         NULL, NULL,      75000.00,  NOW() - INTERVAL 27 HOUR, 9,  NULL, NULL, NULL),
(119, 'part',     'Lampu Emergency LED x1',        1,    120000.00, 120000.00, NOW() - INTERVAL 17 HOUR, 8,  NULL, NULL, NULL);

-- ---------------------------------------------------------------------
-- C8. History (TANPA id eksplisit)
-- ---------------------------------------------------------------------
INSERT INTO history (wo_id, user_id, action, created_at) VALUES
(101, 5,  'reported',                          NOW() - INTERVAL 3 HOUR),
(101, 3,  'assigned to it.rina',               NOW() - INTERVAL 2 HOUR),
(101, 10, 'started',                           NOW() - INTERVAL 1 HOUR),
(103, 5,  'reported',                          NOW() - INTERVAL 30 HOUR),
(103, 11, 'done',                              NOW() - INTERVAL 24 HOUR),
(104, 5,  'reported',                          NOW() - INTERVAL 8 HOUR),
(105, 12, 'started',                           NOW() - INTERVAL 4 HOUR),
(112, 7,  'done',                              NOW() - INTERVAL 58 HOUR),
(112, 3,  'verified',                          NOW() - INTERVAL 30 HOUR),
(114, 9,  'done',                              NOW() - INTERVAL 27 HOUR),
(114, 3,  'verified',                          NOW() - INTERVAL 20 HOUR),
(123, 8,  'started (urgent combi oven)',       NOW() - INTERVAL 30 MINUTE);

-- ---------------------------------------------------------------------
-- C9. Notifications untuk user baru (TANPA id eksplisit, sebagian unread)
-- ---------------------------------------------------------------------
INSERT INTO notifications (property_id, user_id, type, severity, title, body, link, read_at, created_at) VALUES
(1, 7,  'wo_assigned',  'info',    'Tugas baru: PM AC cassette lobby 2',
 'WO-000110 ditugaskan kepada Anda, due hari ini', '/wo/110', NULL, NOW() - INTERVAL 8 HOUR),
(1, 8,  'wo_assigned',  'warning', 'WO urgent: Combi oven error E13',
 'WO-000123 combi oven dapur utama tidak menyala, tangani segera', '/wo/123', NULL, NOW() - INTERVAL 90 MINUTE),
(1, 9,  'pm_due_today', 'warning', 'PM due hari ini',
 'PM mingguan pompa kolam (WO-000115) jatuh tempo hari ini', '/wo/115', NULL, NOW() - INTERVAL 4 HOUR),
(1, 10, 'wo_assigned',  'info',    'Tugas baru: AP lantai 3 mati',
 'WO-000101 ditugaskan kepada Anda, prioritas high', '/wo/101', NOW() - INTERVAL 2 HOUR, NOW() - INTERVAL 3 HOUR),
(1, 11, 'wo_assigned',  'info',    'Tugas baru: PM CCTV basement',
 'WO-000117 ditugaskan kepada Anda, due hari ini', '/wo/117', NULL, NOW() - INTERVAL 6 HOUR),
(1, 12, 'wo_assigned',  'info',    'Tugas baru: cat koridor lantai 5',
 'WO-000105 ditugaskan kepada Anda', '/wo/105', NOW() - INTERVAL 5 HOUR, NOW() - INTERVAL 1 DAY),
(1, 13, 'wo_assigned',  'info',    'Tugas baru: poles marmer lobby',
 'WO-000107 ditugaskan kepada Anda, due 3 hari lagi', '/wo/107', NULL, NOW() - INTERVAL 10 HOUR),
(1, 13, 'cert_expiry',  'warning', 'Sertifikat aplikator waterproofing segera habis',
 'Sertifikat Anda habis dalam 40 hari, segera ajukan perpanjangan', '/profile', NULL, NOW() - INTERVAL 1 DAY);

-- =====================================================================
-- END 0005_seed_expand.sql (revisi penomoran aman DB live)
-- =====================================================================
