<?php

use App\Enums\Channel;
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('media_monitorings', function (Blueprint $table) {
            $table->id();
            $table->string('code', 10);
            $table->string('media_name', 50)->index();
            $table->text('title', 255);
            $table->enum('channel', Channel::values())->default(Channel::WEBSITE->value)->comment(Channel::comment())->index();
            $table->string('writter', 50);
            $table->text('link')->nullable();
            $table->string('news_page', 20)->nullable();
            $table->text('quote')->nullable();
            $table->text('content');
            $table->string('influencer', 50)->nullable();
            $table->string('keyword', 100)->index();
            $table->date('release_date')->index();
            $table->timestamp('created_at')->useCurrent();
            $table->timestamp('updated_at')->nullable()->useCurrentOnUpdate();
            $table->softDeletes();
        });
    }

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