<?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('slides', function (Blueprint $table) {
            $table->id();
            $table->enum('type', ['information', 'moderation', 'sermon']);
            $table->foreignId('service_id')->nullable()->constrained()->nullOnDelete();
            $table->string('original_filename');
            $table->string('stored_filename');
            $table->string('thumbnail_filename');
            $table->date('expire_date')->nullable();
            $table->string('uploader_name')->nullable();
            $table->timestamp('uploaded_at');
            $table->softDeletes();
            $table->timestamps();

            $table->index('service_id');
            $table->index('expire_date');
            $table->index('type');
        });
    }

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