

CREATE TABLE IF NOT EXISTS attendance_logs (
    id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    staff_id INT UNSIGNED NOT NULL,
    punch_type ENUM('IN','OUT') NOT NULL,
    photo_path VARCHAR(255) NOT NULL,
    signature_path VARCHAR(255) NOT NULL,
    device_id VARCHAR(50) NOT NULL DEFAULT 'kiosk-01',
    created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    FOREIGN KEY (staff_id) REFERENCES staff(id),
    INDEX idx_staff_date (staff_id, created_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
