<?php

use App\Enums\MediaClassification;
use App\Enums\MediaType;
use App\Enums\VerificationStatus;
use App\Models\Company;
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->foreignIdFor(Company::class);
            $table->string('name', 50);
            $table->text('address');
            $table->string('link', 50)->nullable();
            $table->enum('type', [MediaType::values()])->default(MediaType::ONLINE)->comment(MediaType::comment());
            $table->enum('classification', [MediaClassification::values()])->comment(MediaClassification::comment());
            $table->string('journalism_organization')->nullable();
            $table->string('press_council_certificate')->nullable();
            $table->enum('status', VerificationStatus::cases())->default(VerificationStatus::PENDING)->comment(VerificationStatus::comment());
            $table->timestamp('created_at')->useCurrent();
            $table->timestamp('updated_at')->nullable()->useCurrentOnUpdate();
            $table->softDeletes();
        });
    }

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