<?php

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
    {
        // Add indexes to marketplace_shortlists table
        // Indexes already exist from initial migration
        
        // Add indexes to marketplace_shortlist_creators table
        // Indexes already exist from initial migration
        
        // Add indexes to proposal_comments table
        // Indexes already exist from initial migration
        
        // Add indexes to proposal_transitions table
        // Indexes already exist from initial migration
        
        // Add indexes to contracts table
        // Indexes already exist from initial migration
        
        // Add indexes to payments table
        // Indexes already exist from initial migration
        
        // Add indexes to campaigns table
        Schema::table('campaigns', function (Blueprint $table) {
            $table->index('brand_id');
            $table->index('status');
            $table->index('start_date');
            $table->index('end_date');
            $table->index('created_by');
        });
        
        // Add indexes to campaign_creators table
        // Indexes already exist from initial migration
        
        // Add indexes to messages table
        // Indexes already exist from initial migration
        
        // Add indexes to recommendation_scores table
        // Indexes already exist from initial migration
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        // Remove indexes from marketplace_shortlists table
        // Indexes already exist from initial migration
        
        // Remove indexes from marketplace_shortlist_creators table
        // Indexes already exist from initial migration
        
        // Remove indexes from proposal_comments table
        // Indexes already exist from initial migration
        
        // Remove indexes from proposal_transitions table
        // Indexes already exist from initial migration
        
        // Remove indexes from contracts table
        // Indexes already exist from initial migration
        
        // Remove indexes from payments table
        // Indexes already exist from initial migration
        
        // Remove indexes from campaigns table
        Schema::table('campaigns', function (Blueprint $table) {
            $table->dropIndex(['brand_id']);
            $table->dropIndex(['status']);
            $table->dropIndex(['start_date']);
            $table->dropIndex(['end_date']);
            $table->dropIndex(['created_by']);
        });
        
        // Remove indexes from campaign_creators table
        // Indexes already exist from initial migration
        
        // Remove indexes from messages table
        // Indexes already exist from initial migration
        
        // Remove indexes from recommendation_scores table
        // Indexes already exist from initial migration
    }
};
