export type FabroNativeRunStatus =
  "queued" | "running" | "waiting" | "completed" | "failed" | "cancelling" | "cancelled";

export interface FabroNativeRun {
  readonly id: string;
  readonly factoryRunId: string;
  readonly planRevisionId: string;
  readonly status: FabroNativeRunStatus;
  readonly currentStage?: string;
  readonly checkpointId?: string;
  readonly failureCode?: string;
  readonly url?: string;
}

export interface FabroNativeClient {
  findRunByIdempotencyKey(idempotencyKey: string): Promise<FabroNativeRun | undefined>;
  findRunByFactoryRunId(factoryRunId: string): Promise<FabroNativeRun | undefined>;
  startRun(input: {
    readonly factoryRunId: string;
    readonly planRevisionId: string;
    readonly idempotencyKey: string;
  }): Promise<FabroNativeRun>;
  cancelRun(nativeRunId: string): Promise<FabroNativeRun>;
  getRun(nativeRunId: string): Promise<FabroNativeRun | undefined>;
}
