<?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('academy_prompt_packs', function (Blueprint $table): void {
            $table->id();
            $table->string('title');
            $table->string('slug')->unique();
            $table->text('excerpt')->nullable();
            $table->longText('description')->nullable();
            $table->string('access_level')->default('creator');
            $table->integer('one_time_price_cents')->nullable();
            $table->string('currency', 3)->default('EUR');
            $table->string('cover_image')->nullable();
            $table->json('tags')->nullable();
            $table->boolean('featured')->default(false);
            $table->boolean('active')->default(true);
            $table->timestamp('published_at')->nullable();
            $table->timestamps();
            $table->softDeletes();

            $table->index(['active', 'featured', 'access_level']);
        });
    }

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