<?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
    {
        if (! Schema::hasTable('interviews')) {
            Schema::create('interviews', function (Blueprint $table) {
                $table->id();
                $table->unsignedBigInteger('company_id')->nullable()->index();
                $table->unsignedBigInteger('applicant_id')->nullable()->index();
                $table->unsignedBigInteger('interviewer_id')->nullable()->index();
                $table->string('interview_type')->default('video');
                $table->dateTime('scheduled_at');
                $table->string('status')->default('scheduled');
                $table->text('feedback')->nullable();
                $table->timestamps();
            });
        }
    }

    public function down(): void
    {
        Schema::dropIfExists('interviews');
    }
};
