<?php

declare(strict_types=1);

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    public function up(): void
    {
        Schema::table('collections', function (Blueprint $table): void {
            $table->string('sponsorship_state', 40)->nullable()->after('sponsorship_label');
            $table->string('ownership_domain', 80)->nullable()->after('partner_label');
            $table->string('commercial_review_state', 40)->nullable()->after('ownership_domain');
            $table->string('legal_review_state', 40)->nullable()->after('commercial_review_state');

            $table->index('sponsorship_state');
            $table->index('ownership_domain');
        });
    }

    public function down(): void
    {
        Schema::table('collections', function (Blueprint $table): void {
            $table->dropIndex(['sponsorship_state']);
            $table->dropIndex(['ownership_domain']);
            $table->dropColumn([
                'sponsorship_state',
                'ownership_domain',
                'commercial_review_state',
                'legal_review_state',
            ]);
        });
    }
};