<?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('workers', function (Blueprint $table) {
            if (!Schema::hasColumn('workers', 'in_country')) {
                $table->boolean('in_country')->default(true)->after('nationality');
            }
            if (!Schema::hasColumn('workers', 'visa_status')) {
                $table->string('visa_status')->nullable()->after('in_country');
            }
            if (!Schema::hasColumn('workers', 'preferred_job_type')) {
                $table->string('preferred_job_type')->nullable()->after('live_in_out');
            }
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('workers', function (Blueprint $table) {
            $table->dropColumn(['in_country', 'visa_status', 'preferred_job_type']);
        });
    }
};
