<?php

use App\Enums\ContentType;
use App\Models\Classification;
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('content_recaps', function (Blueprint $table) {
            $table->id();
            $table->foreignIdFor(Classification::class)->constrained();
            $table->string('title', 255);
            $table->text('link', 50)->nullable();
            $table->date('posting_date');
            $table->enum('type', [ContentType::values()])->default(ContentType::FOTO);
            $table->string('channel', 20);
            $table->string('social_media', 50);
            $table->timestamp('created_at')->useCurrent();
            $table->timestamp('updated_at')->nullable()->useCurrentOnUpdate();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('content_recaps');
    }
};
