<?php

declare(strict_types=1);

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

/**
 * Marketing photography, managed from the admin panel.
 *
 * These live on the public disk rather than the private bucket: they are
 * published to every visitor by definition, and small JPEGs are exactly what
 * shared hosting is fine at serving. The private-bucket machinery stays for
 * things that must not be publicly addressable — audio, IDs, payment proofs.
 */
return new class extends Migration
{
    public function up(): void
    {
        Schema::create('gallery_images', function (Blueprint $table) {
            $table->id();
            $table->string('title');
            $table->string('disk', 40)->default('public');
            $table->string('path');
            $table->boolean('is_published')->default(true);
            $table->unsignedSmallInteger('sort_order')->default(0);
            $table->timestamps();

            $table->index(['is_published', 'sort_order']);
        });
    }

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