<?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('hotels', function (Blueprint $table) {
            if (!Schema::hasColumn('hotels', 'check_in_time')) {
                $table->string('check_in_time')->default('14:00')->nullable();
            }
            if (!Schema::hasColumn('hotels', 'check_out_time')) {
                $table->string('check_out_time')->default('12:00')->nullable();
            }
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('hotels', function (Blueprint $table) {
            if (Schema::hasColumn('hotels', 'check_in_time')) {
                $table->dropColumn('check_in_time');
            }
            if (Schema::hasColumn('hotels', 'check_out_time')) {
                $table->dropColumn('check_out_time');
            }
        });
    }
};
