<?php

use App\Enums\MediaClassification;
use App\Enums\MediaType;
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('partner_media', function (Blueprint $table) {
            $table->id();
            $table->foreignId('company_id')->constrained()->cascadeOnDelete();
            $table->string('name', 50)->index();
            $table->text('address');
            $table->string('link')->nullable();
            $table->enum('type', MediaType::values())->default(MediaType::ONLINE->value)->comment(MediaType::comment())->index();
            $table->enum('classification', MediaClassification::values())->comment(MediaClassification::comment())->index();
            $table->string('journalism_organization')->nullable();
            $table->string('press_council_certificate')->nullable();
            $table->timestamp('created_at')->useCurrent();
            $table->timestamp('updated_at')->nullable()->useCurrentOnUpdate();
            $table->softDeletes();
        });
    }

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