<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        // 1. Alter laporans table
        Schema::table('laporans', function (Blueprint $table) {
            // Change status from enum to string to allow 'ditolak' or other values easily
            $table->string('status')->change();
            $table->text('alasan_penolakan')->nullable();
        });

        // 2. Add columns to catatan_klinis_psikolog
        Schema::table('catatan_klinis_psikolog', function (Blueprint $table) {
            $table->string('jadwal_hari')->nullable();
            $table->date('jadwal_tanggal')->nullable();
            $table->string('jadwal_jam')->nullable();
        });

        // 3. Add columns to tindakan_penilai
        Schema::table('tindakan_penilai', function (Blueprint $table) {
            $table->string('sidang_etik_hari')->nullable();
            $table->date('sidang_etik_tanggal')->nullable();
            $table->string('sidang_etik_jam')->nullable();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('tindakan_penilai', function (Blueprint $table) {
            $table->dropColumn(['sidang_etik_hari', 'sidang_etik_tanggal', 'sidang_etik_jam']);
        });

        Schema::table('catatan_klinis_psikolog', function (Blueprint $table) {
            $table->dropColumn(['jadwal_hari', 'jadwal_tanggal', 'jadwal_jam']);
        });

        Schema::table('laporans', function (Blueprint $table) {
            $table->dropColumn('alasan_penolakan');
        });
    }
};
