-- ============================================================
-- Restaurant Time Clock - Seed Data
-- Run AFTER schema.sql
-- ============================================================

-- Default admin:  admin@restaurant.local / Admin1234!
-- Employees PIN:  1001 / 1002 / 1003

-- Both passwords hash to "Admin1234!" — change immediately after install

-- Location
INSERT INTO `locations` (`name`, `address`) VALUES
('Main Street Grill', '123 Main St, Springfield, IL 62701');

-- Sample punches for yesterday (replace date dynamically if needed)
-- We use a stored procedure to make dates relative
SET @yesterday = DATE_SUB(CURDATE(), INTERVAL 1 DAY);
SET @two_days  = DATE_SUB(CURDATE(), INTERVAL 2 DAY);

INSERT INTO `punches` (`employee_id`, `station_id`, `punch_type`, `punched_at`) VALUES
-- Maria yesterday: full shift
(1, 1, 'clock_in',    CONCAT(@yesterday, ' 09:00:00')),
(1, 1, 'break_start', CONCAT(@yesterday, ' 12:00:00')),
(1, 1, 'break_end',   CONCAT(@yesterday, ' 12:30:00')),
(1, 1, 'clock_out',   CONCAT(@yesterday, ' 17:00:00')),
-- Carlos yesterday
(2, 2, 'clock_in',    CONCAT(@yesterday, ' 10:00:00')),
(2, 2, 'break_start', CONCAT(@yesterday, ' 13:00:00')),
(2, 2, 'break_end',   CONCAT(@yesterday, ' 13:20:00')),
(2, 2, 'clock_out',   CONCAT(@yesterday, ' 18:30:00')),
-- Sam yesterday
(3, 1, 'clock_in',    CONCAT(@yesterday, ' 11:00:00')),
(3, 1, 'clock_out',   CONCAT(@yesterday, ' 15:00:00')),
-- Maria two days ago
(1, 1, 'clock_in',    CONCAT(@two_days, ' 08:45:00')),
(1, 1, 'break_start', CONCAT(@two_days, ' 12:15:00')),
(1, 1, 'break_end',   CONCAT(@two_days, ' 12:45:00')),
(1, 1, 'clock_out',   CONCAT(@two_days, ' 16:45:00'));

-- Sample audit log entry
INSERT INTO `audit_logs` (`user_id`, `action`, `entity`, `entity_id`, `ip_address`) VALUES
(1, 'seed_data_loaded', 'system', NULL, '127.0.0.1');
