<?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
    {
        Schema::table('delivery_calendar_overrides', function (Blueprint $table) {
            $table->string('override_scope')->default('general')->after('supplier_id');
            $table->string('region')->nullable()->after('override_scope');
            $table->foreignId('profit_center_id')->nullable()->constrained()->nullOnDelete()->after('region');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('delivery_calendar_overrides', function (Blueprint $table) {
            $table->dropForeign(['profit_center_id']);
            $table->dropColumn(['override_scope', 'region', 'profit_center_id']);
        });
    }
};
