<?php

namespace App\Database\Migrations;

use CodeIgniter\Database\Migration;

/**
 * Menambah checkin_type untuk membedakan absen mapel vs masuk/pulang.
 * mapel = absen per jadwal (default); masuk = absen masuk sekolah; pulang = absen pulang.
 */
class AddCheckinTypeToAttendanceSessions extends Migration
{
    public function up()
    {
        $this->forge->addColumn('attendance_sessions', [
            'checkin_type' => [
                'type'       => 'ENUM',
                'constraint' => ['mapel', 'masuk', 'pulang'],
                'default'    => 'mapel',
                'null'       => false,
                'after'      => 'schedule_id',
            ],
        ]);
    }

    public function down()
    {
        $this->forge->dropColumn('attendance_sessions', 'checkin_type');
    }
}
