<?php

use App\Enums\Channel;
use App\Enums\ContentType;
use App\Enums\SocialMedia;
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->foreignId('classification_id')->constrained()->cascadeOnDelete();
            $table->text('title');
            $table->text('link')->nullable();
            $table->date('posting_date')->index();
            $table->enum('type', ContentType::values())->nullable()->default(ContentType::FOTO->value)->comment(ContentType::comment())->index();
            $table->enum('channel', Channel::values())->default(Channel::WEBSITE->value)->comment(Channel::comment())->index();
            $table->enum('social_media', SocialMedia::values())->default(SocialMedia::DISKOMINFO_PURWAKARTA->value)->comment(SocialMedia::comment())->index();
            $table->timestamp('created_at')->useCurrent();
            $table->timestamp('updated_at')->nullable()->useCurrentOnUpdate();
            $table->softDeletes();
        });
    }

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