export type ProjectErrorCode =
  | "generation_state_invalid"
  | "project_active_limit"
  | "project_history_limit"
  | "project_name_invalid"
  | "project_not_found"
  | "project_ratio_fixed"
  | "project_retry_not_allowed"
  | "project_state_conflict"
  | "project_state_invalid"
  | "project_state_idempotency_conflict";

export class ProjectError extends Error {
  readonly code: ProjectErrorCode;
  readonly latestStateVersion: number | undefined;

  constructor(code: ProjectErrorCode, latestStateVersion?: number) {
    super(code);
    this.code = code;
    this.latestStateVersion = latestStateVersion;
  }
}
