<?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::dropIfExists('appointment_time_slots');
        Schema::dropIfExists('appointment_settings');
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::create('appointment_settings', function (Blueprint $table) {
            $table->id();
            $table->integer('slot_duration')->default(30);
            $table->time('day_start_time')->default('09:00:00');
            $table->time('day_end_time')->default('17:00:00');
            $table->timestamps();
        });

        Schema::create('appointment_time_slots', function (Blueprint $table) {
            $table->id();
            $table->foreignId('doctor_id')->constrained('users');
            $table->dateTime('start_time');
            $table->dateTime('end_time');
            $table->boolean('is_available')->default(true);
            $table->timestamps();
        });
    }
};
