import type { AgentProfile } from "../../agent/profile-registry.js";
import { ProviderTurnBudget } from "./provider-turn-budget.js";

export function buildReplayProviderTurnBudget(input: {
  defaultMaxProviderTurns: number;
  enabled: boolean;
  maxProviderTurnsForProfile: (profile: AgentProfile) => number;
  profile?: AgentProfile;
  providerTurnCount?: number;
}): ProviderTurnBudget {
  return new ProviderTurnBudget({
    enabled: input.enabled,
    max: input.profile
      ? input.maxProviderTurnsForProfile(input.profile)
      : input.defaultMaxProviderTurns,
    used: input.providerTurnCount ?? 0,
  });
}
