<?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::create('intent_phrases', function (Blueprint $table): void {
            $table->id();
            $table->foreignId('organization_id')->constrained()->cascadeOnDelete();
            $table->foreignId('intent_id')->constrained()->cascadeOnDelete();
            $table->string('locale', 12)->default('bn');
            $table->text('phrase');
            $table->string('status')->default('approved');
            $table->timestamps();

            $table->index(['intent_id', 'status']);
            $table->index(['organization_id', 'locale', 'status']);
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('intent_phrases');
    }
};
