-- Add biometric_id to hr_employees and create biometric_logs table
ALTER TABLE hr_employees ADD COLUMN biometric_id VARCHAR(50) UNIQUE AFTER department_id;

CREATE TABLE IF NOT EXISTS hr_biometric_logs (
    id INT AUTO_INCREMENT PRIMARY KEY,
    biometric_id VARCHAR(50) NOT NULL,
    employee_id INT,
    timestamp DATETIME NOT NULL,
    type ENUM('check_in', 'check_out', 'unknown') DEFAULT 'unknown',
    processed TINYINT(1) DEFAULT 0,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    FOREIGN KEY (employee_id) REFERENCES hr_employees(id) ON DELETE SET NULL
);
