<?php

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

class CreateDoctorsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('doctors', function (Blueprint $table) {
            $table->id();

            $table->string('name');
            $table->string('slug')->unique();

            // Foreign keys
            $table->foreignId('specialty_id')
                ->constrained('specialties')
                ->onUpdate('cascade');

            $table->foreignId('department_id')
                ->constrained('departments')
                ->onUpdate('cascade');

            // Doctor info
            $table->string('experience');
            $table->string('degree');
            $table->string('designation');
            $table->text('desc'); // Use text instead of string for longer description
            $table->string('image')->nullable();

            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('doctors');
    }
}
