<?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('barbers', function (Blueprint $table) {
            $table->boolean('booking_enabled')->default(true)->after('display_order');
            $table->json('weekly_time_off')->nullable()->after('booking_enabled');
        });

        Schema::table('barber_blocks', function (Blueprint $table) {
            $table->enum('kind', ['block', 'open'])->default('block')->after('barber_id');
        });
    }

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

        Schema::table('barbers', function (Blueprint $table) {
            $table->dropColumn(['booking_enabled', 'weekly_time_off']);
        });
    }
};
