<?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
    {
        Schema::table('companies', function (Blueprint $table) {
            // Correction quota settings
            $table->integer('correction_quota_max')->nullable()->after('backdate_enabled')
                ->comment('Maximum correction requests per period. NULL = unlimited');
            $table->string('correction_quota_period')->default('monthly')->after('correction_quota_max')
                ->comment('Quota period: daily, weekly, monthly, yearly');

            // Early leave quota settings
            $table->integer('early_leave_quota_max')->nullable()->after('correction_quota_period')
                ->comment('Maximum early leave requests per period. NULL = unlimited');
            $table->string('early_leave_quota_period')->default('monthly')->after('early_leave_quota_max')
                ->comment('Quota period: daily, weekly, monthly, yearly');

            // Late arrival quota settings
            $table->integer('late_arrival_quota_max')->nullable()->after('early_leave_quota_period')
                ->comment('Maximum late arrival requests per period. NULL = unlimited');
            $table->string('late_arrival_quota_period')->default('monthly')->after('late_arrival_quota_max')
                ->comment('Quota period: daily, weekly, monthly, yearly');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('companies', function (Blueprint $table) {
            $table->dropColumn([
                'correction_quota_max',
                'correction_quota_period',
                'early_leave_quota_max',
                'early_leave_quota_period',
                'late_arrival_quota_max',
                'late_arrival_quota_period',
            ]);
        });
    }
};
