<?php

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

return new class extends Migration
{
    public function up(): void
    {
        Schema::table('employees', function (Blueprint $table): void {
            $table->string('arabic_name', 255)->nullable()->after('full_name');
            $table->date('date_of_birth')->nullable()->after('gender');
            $table->string('marital_status', 32)->nullable()->after('date_of_birth');
            $table->string('company_email', 255)->nullable()->after('email');
            $table->string('passport_number', 80)->nullable()->after('national_id');
            $table->string('social_insurance_number', 80)->nullable()->after('passport_number');
            $table->string('bank_name', 120)->nullable()->after('social_insurance_number');
            $table->string('bank_account_number', 80)->nullable()->after('bank_name');
            $table->string('iban', 64)->nullable()->after('bank_account_number');
            $table->date('probation_end_date')->nullable()->after('hire_date');
            $table->date('confirmation_date')->nullable()->after('probation_end_date');
        });

        Schema::table('employee_documents', function (Blueprint $table): void {
            $table->date('expires_at')->nullable()->after('file_path');
        });
    }

    public function down(): void
    {
        Schema::table('employee_documents', function (Blueprint $table): void {
            $table->dropColumn('expires_at');
        });

        Schema::table('employees', function (Blueprint $table): void {
            $table->dropColumn([
                'arabic_name',
                'date_of_birth',
                'marital_status',
                'company_email',
                'passport_number',
                'social_insurance_number',
                'bank_name',
                'bank_account_number',
                'iban',
                'probation_end_date',
                'confirmation_date',
            ]);
        });
    }
};
