<?php
declare(strict_types=1);

return [
    'up' => "
CREATE TABLE IF NOT EXISTS facility_attendance (
    id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    grid_id INT UNSIGNED NOT NULL,
    schedule_id INT UNSIGNED NULL,
    monthly_plan_id INT UNSIGNED NULL,
    attendance_date DATE NOT NULL,
    hour_slot TIME NULL,
    entity_type VARCHAR(20) NOT NULL,
    entity_id INT UNSIGNED NOT NULL,
    entity_name_cache VARCHAR(200) NULL,
    status VARCHAR(20) NOT NULL DEFAULT 'present',
    check_in_time TIME NULL,
    notes TEXT NULL,
    recorded_by INT UNSIGNED NULL,
    created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    KEY idx_grid_date (grid_id, attendance_date),
    KEY idx_entity (entity_type, entity_id),
    KEY idx_plan (monthly_plan_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci",
    'down' => "DROP TABLE IF EXISTS facility_attendance",
];
