<?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::create('ai_keywords', function (Blueprint $table) {
			$table->id();
			$table->string('keyword')->unique()->comment('Keyword for AI content generation');
			$table->string('slug')->unique()->comment('URL-friendly slug of the keyword');
			$table->integer('volume')->nullable()->comment('Search volume or competition metric');
			$table->string('intent')->nullable()->comment('Search intent (Commercial, Informational, etc.)');
			$table->string('persona')->nullable()->comment('Target persona for this keyword');
			$table->enum('priority', ['high', 'medium', 'low'])->nullable()->comment('Priority level');
			$table->string('status')->default('processing')->comment('Processing status');
			$table->timestamps();
			
			// Indexes for better performance
			$table->index('keyword');
			$table->index('intent');
			$table->index('priority');
			$table->index('status');
			$table->index(['priority', 'status']);
		});
	}
	
	/**
	 * Reverse the migrations.
	 */
	public function down(): void
	{
		Schema::dropIfExists('ai_keywords');
	}
};
