import { budgetConfigGuard } from '../../../../modules/token-accounting/entities/budget/budgetConfig.guard.js';
import { BUDGET_FLOOR_USD, BUDGET_CEILING_USD, } from '../../../../modules/token-accounting/entities/budget/budgetConfig.schema.js';
const RANGE_ERROR = `limitUsd must be between ${BUDGET_FLOOR_USD} and ${BUDGET_CEILING_USD}`;
export class UpdateBudgetUseCase {
    deps;
    constructor(deps) {
        this.deps = deps;
    }
    async execute({ limitUsd }) {
        const parsed = budgetConfigGuard.safeParse({ limitUsd });
        if (!parsed.success) {
            return { success: false, error: RANGE_ERROR };
        }
        await this.deps.budgetGateway.save(parsed.data);
        return { success: true, limitUsd: parsed.data.limitUsd };
    }
}
//# sourceMappingURL=updateBudget.usecase.js.map