<?php

namespace App\Support;

final class AgentSettlementProductionGuard
{
    public static function assertProductionCloseAllowed(): void
    {
        if (app()->environment('testing')) {
            return;
        }

        if (config('agent_settlement.allow_production_close', true)) {
            return;
        }

        throw new \RuntimeException(
            'Agent settlement period close is disabled. Set AGENT_SETTLEMENT_ALLOW_PRODUCTION_CLOSE=true to enable.',
        );
    }
}
