export const COMMERCIAL_API_HOLD_CODE = "QMD_COMMERCIAL_API_HOLD" as const;

/** Fail-closed result for learned-model work without an approved commercial API. */
export class CommercialApiHoldError extends Error {
  readonly code = COMMERCIAL_API_HOLD_CODE;
  readonly disposition = "HOLD" as const;

  constructor(reason: string) {
    super(`[${COMMERCIAL_API_HOLD_CODE}] HOLD: ${reason}`);
    this.name = "CommercialApiHoldError";
  }
}

export function commercialApiHold(reason: string): CommercialApiHoldError {
  return new CommercialApiHoldError(reason);
}
