-- =====================================================================
-- SEED DATA  -  ogzguwwq_kiosk
-- Safe starter rows so the system is usable immediately after install.
-- PIN hash and admin pass are SHA-256. Defaults:
--   admin login : admin / admin123   (CHANGE AFTER FIRST LOGIN)
--   demo employee EMP001 , PIN 1234
-- =====================================================================

SET sql_mode = '';

INSERT INTO departments (dept_code, dept_name, is_active, created_at) VALUES
('ADMIN', 'Administration', 1, NOW()),
('ICT',   'ICT / MIS',      1, NOW()),
('FAC',   'Faculty',        1, NOW())
ON DUPLICATE KEY UPDATE dept_name = VALUES(dept_name);

INSERT INTO schedules (sched_name, time_in, time_out, grace_minutes, break_minutes, is_active, created_at) VALUES
('Regular Office 8-5', '08:00:00', '17:00:00', 15, 60, 1, NOW());

-- One kiosk device registered (Main Gate). kiosk_key is the shared secret.
INSERT INTO kiosks (kiosk_key, label, is_active, created_at) VALUES
('MAINGATE-7F3A9C2E', 'Main Gate', 1, NOW())
ON DUPLICATE KEY UPDATE label = VALUES(label);

-- Demo employee EMP001 with PIN 1234
INSERT INTO employees (emp_no, first_name, last_name, dept_id, position,
                       daily_rate, hourly_rate, schedule_id, is_active, created_at)
VALUES ('EMP001', 'Juan', 'Dela Cruz',
        (SELECT dept_id FROM departments WHERE dept_code='ICT' LIMIT 1),
        'IT Staff', 1000.00, 125.00,
        (SELECT schedule_id FROM schedules WHERE sched_name='Regular Office 8-5' LIMIT 1),
        1, NOW())
ON DUPLICATE KEY UPDATE first_name = VALUES(first_name);
