// This file is auto-generated by @hey-api/openapi-ts

export type ClientOptions = {
  baseUrl: `${string}://${string}` | (string & {})
}

/**
 * Response indicating whether a Hub username is available.
 */
export type HubUsernameCheckResponse = {
  /**
   * The username that was checked.
   */
  username: string
  /**
   * Whether the username is available for the caller's workspace.
   */
  available: boolean
  /**
   * Up to 5 available alternative usernames (only present when unavailable).
   */
  suggestions?: Array<string>
  /**
   * If the username format is invalid, describes the format requirement.
   */
  validation_error?: string
}

/**
 * Response containing a signed upload URL and the target asset path.
 */
export type HubAssetUploadUrlResponse = {
  /**
   * Presigned R2 URL for uploading the file via PUT.
   */
  upload_url: string
  /**
   * The public URL where the file will be accessible after upload.
   */
  public_url: string
  /**
   * Signed token to pass in the publish request. Has a server-determined TTL.
   */
  token: string
}

/**
 * Request body for requesting a signed upload URL for a Hub asset.
 */
export type HubAssetUploadUrlRequest = {
  /**
   * Original filename for display purposes. Not used in the storage key.
   */
  filename: string
  /**
   * MIME type of the file (e.g. "image/jpeg", "video/mp4"). Validated against a whitelist; the canonical file extension is derived from this value.
   *
   */
  content_type: string
}

/**
 * Partial update for a published hub workflow (admin moderation). All fields are optional. Semantics match UpdateHubProfileRequest / avatar_token:
 *
 * * field omitted or null — leave unchanged
 * * string field = ""     — clear (for clearable string fields)
 * * array field  = []     — clear the list
 * * any other value       — set to the provided value
 *
 * Array fields use full-replacement (PUT) semantics when a value is supplied. The two single-value thumbnail token fields accept only upload tokens (not existing URLs) since omitting them already expresses "keep the current value".
 * Backend note: cleared string columns are persisted as the empty string "" in the Ent schema (description, thumbnail_url, thumbnail_comparison_url, tutorial_url). thumbnail_type is the only true SQL-nullable column but is not clearable via this endpoint.
 *
 */
export type UpdateHubWorkflowRequest = {
  /**
   * Display name. Not clearable. Null/omit leaves unchanged; empty string is invalid.
   */
  name?: string | null
  /**
   * Workflow description. Send "" to clear. Null/omit leaves unchanged.
   */
  description?: string | null
  /**
   * Full replacement of tag slugs. Must exist in hub_labels. Send [] to clear. Null/omit leaves unchanged.
   */
  tags?: Array<string> | null
  /**
   * Full replacement of model slugs. Must exist in hub_labels. Send [] to clear. Null/omit leaves unchanged.
   */
  models?: Array<string> | null
  /**
   * Full replacement of custom_node slugs. Must exist in hub_labels. Send [] to clear. Null/omit leaves unchanged.
   */
  custom_nodes?: Array<string> | null
  /**
   * Tutorial URL. Send "" to clear. Null/omit leaves unchanged.
   */
  tutorial_url?: string | null
  /**
   * Thumbnail kind. Null/omit leaves unchanged; not clearable via this endpoint. If set to image_comparison, both the thumbnail and comparison thumbnail must resolve to a value on the stored record after this update is applied (either already present and not being cleared, or supplied as a token in this request).
   *
   */
  thumbnail_type?: 'image' | 'video' | 'image_comparison'
  /**
   * Token from POST /api/hub/assets/upload-url for a newly uploaded thumbnail. Null/omit leaves the existing thumbnail unchanged. Send "" to clear. (PATCH does not accept an existing public URL here — to keep the current thumbnail, simply omit the field.)
   *
   */
  thumbnail_token?: string | null
  /**
   * Token from POST /api/hub/assets/upload-url for a newly uploaded comparison thumbnail. Null/omit leaves unchanged. Send "" to clear. (PATCH does not accept an existing public URL here — to keep the current comparison thumbnail, simply omit the field.)
   *
   */
  thumbnail_comparison_token?: string | null
  /**
   * Full replacement of sample images. Each element is either a token from /api/hub/assets/upload-url or an existing public URL. Send [] to clear. Null/omit leaves unchanged.
   *
   */
  sample_image_tokens_or_urls?: Array<string> | null
  /**
   * Admin-only full replacement of the hub_workflow_detail.metadata JSON object. Null/omit leaves unchanged. Send {} to clear all keys. Accepts arbitrary JSON (size, vram, open_source, media_type, logos, etc.).
   *
   */
  metadata?: {
    [key: string]: unknown
  } | null
}

/**
 * Request body for publishing or updating a workflow on the Hub.
 */
export type PublishHubWorkflowRequest = {
  /**
   * Username of the hub profile to publish under. The authenticated user must belong to the workspace that owns this profile.
   */
  username: string
  /**
   * Display name for the published workflow on the hub.
   */
  name: string
  /**
   * Userdata path of the workflow file (e.g. "workflows/my-flow.json").
   */
  workflow_filename: string
  /**
   * IDs of assets (inputs and models) to snapshot.
   */
  asset_ids: Array<string>
  /**
   * Workflow description for the hub listing.
   */
  description?: string
  /**
   * Searchable tag slugs. Must exist in hub_labels.
   */
  tags?: Array<string>
  /**
   * Model slugs. Must exist in hub_labels.
   */
  models?: Array<string>
  /**
   * Custom node slugs. Must exist in hub_labels.
   */
  custom_nodes?: Array<string>
  /**
   * URL to a tutorial for this workflow.
   */
  tutorial_url?: string
  /**
   * Arbitrary metadata (size, vram, open_source, etc.). Reserved keys (extended_description, meta_description, how_to_use, suggested_use_cases, faq_items, content_template) are backend-managed and will be stripped if supplied.
   */
  metadata?: {
    [key: string]: unknown
  }
  thumbnail_type?: 'image' | 'video' | 'image_comparison'
  /**
   * Token (from /api/hub/assets/upload-url) for a new upload, or an existing public URL from the previous published version. Omit to have no thumbnail.
   *
   */
  thumbnail_token_or_url?: string
  /**
   * Token or existing public URL from the previous published version. Omit to have no comparison image.
   *
   */
  thumbnail_comparison_token_or_url?: string
  /**
   * Array of tokens or existing public URLs from the previous published version. Full replacement (PUT semantics). Omit or pass [] to have no sample images.
   *
   */
  sample_image_tokens_or_urls?: Array<string>
}

/**
 * Paginated list of Hub workflows matching search criteria.
 */
export type HubWorkflowListResponse = {
  /**
   * Array of HubWorkflowSummary (default) or HubWorkflowDetail (when detail=true).
   */
  workflows: Array<HubWorkflowSummary | HubWorkflowDetail>
  /**
   * Cursor for the next page, empty if no more results.
   */
  next_cursor?: string
}

/**
 * Lightweight asset reference used in workflow publishing payloads.
 */
export type AssetInfo = {
  /**
   * Asset identifier.
   */
  id: string
  name: string
  /**
   * Signed URL for previewing the asset.
   */
  preview_url: string
  storage_url: string
  /**
   * Whether this asset is a model.
   */
  model: boolean
  /**
   * Whether this is a public (platform-provided) asset.
   */
  public: boolean
  /**
   * Whether the caller already owns this asset.
   */
  in_library: boolean
}

/**
 * Full Hub workflow detail including versions, assets, and statistics.
 */
export type HubWorkflowDetail = {
  share_id: string
  workflow_id: string
  name: string
  status: HubWorkflowStatus
  description?: string
  tags?: Array<LabelRef>
  thumbnail_type?: 'image' | 'video' | 'image_comparison'
  thumbnail_url?: string
  thumbnail_comparison_url?: string
  models?: Array<LabelRef>
  custom_nodes?: Array<LabelRef>
  tutorial_url?: string
  metadata?: {
    [key: string]: unknown
  }
  sample_image_urls?: Array<string>
  publish_time?: string | null
  workflow_json: {
    [key: string]: unknown
  }
  /**
   * Published assets. Each asset's id is the published asset ID (not the original private asset ID).
   */
  assets: Array<AssetInfo>
  profile: HubProfileSummary
}

/**
 * Abbreviated Hub profile used in workflow listings.
 */
export type HubProfileSummary = {
  username: string
  display_name?: string
  /**
   * Public URL of the profile avatar image.
   */
  avatar_url?: string
}

/**
 * Reference to a Hub label by ID.
 */
export type LabelRef = {
  /**
   * Slug identifier (e.g. "video-generation", "flux").
   */
  name: string
  /**
   * Human-readable display name (e.g. "Video Generation", "Flux").
   */
  display_name: string
}

/**
 * Public workflow status. NULL in the database is represented as pending in API responses.
 */
export type HubWorkflowStatus =
  | 'pending'
  | 'approved'
  | 'rejected'
  | 'deprecated'

/**
 * Abbreviated Hub workflow metadata used in search and listing results.
 */
export type HubWorkflowSummary = {
  share_id: string
  name: string
  status: HubWorkflowStatus
  description?: string
  tags?: Array<LabelRef>
  models?: Array<LabelRef>
  custom_nodes?: Array<LabelRef>
  thumbnail_type?: 'image' | 'video' | 'image_comparison'
  thumbnail_url?: string
  thumbnail_comparison_url?: string
  publish_time?: string | null
  profile: HubProfileSummary
  metadata?: {
    [key: string]: unknown
  }
  tutorial_url?: string
  sample_image_urls?: Array<string>
}

/**
 * Metadata for a single Hub label.
 */
export type HubLabelInfo = {
  /**
   * Slug identifier.
   */
  name: string
  /**
   * Human-readable display name.
   */
  display_name: string
  /**
   * Optional description of the label.
   */
  description?: string
  /**
   * Label category.
   */
  type: 'tag' | 'model' | 'custom_node'
}

/**
 * List of available Hub labels for categorizing workflows.
 */
export type HubLabelListResponse = {
  /**
   * Available labels filtered by type (or all if no type specified).
   */
  labels: Array<HubLabelInfo>
}

/**
 * Entry in the curated workflow template gallery shown on the home page.
 */
export type HubWorkflowTemplateEntry = {
  /**
   * Slug identifier for the template
   */
  name: string
  title: string
  status: HubWorkflowStatus
  description?: string
  tags?: Array<string>
  models?: Array<string>
  requiresCustomNodes?: Array<string>
  thumbnailVariant?: string
  mediaType?: string
  mediaSubtype?: string
  /**
   * Workflow asset size in bytes.
   */
  size?: number
  /**
   * Approximate VRAM requirement in bytes.
   */
  vram?: number
  /**
   * Usage count reported upstream.
   */
  usage?: number
  /**
   * Search ranking score reported upstream.
   */
  searchRank?: number
  /**
   * Whether the template belongs to a module marked as essential.
   */
  isEssential?: boolean
  openSource?: boolean
  profile?: HubProfileSummary
  tutorialUrl?: string
  logos?: Array<{
    [key: string]: unknown
  }>
  /**
   * Publication date in YYYY-MM-DD format
   */
  date?: string
  io?: {
    inputs?: Array<{
      [key: string]: unknown
    }>
    outputs?: Array<{
      [key: string]: unknown
    }>
  }
  includeOnDistributions?: Array<string>
  /**
   * Public URL of the primary thumbnail
   */
  thumbnailUrl?: string
  /**
   * Public URL of the comparison thumbnail
   */
  thumbnailComparisonUrl?: string
  /**
   * Share ID for linking to the hub workflow detail
   */
  shareId?: string
  /**
   * AI-generated extended description of the workflow
   */
  extendedDescription?: string
  /**
   * AI-generated SEO meta description (under 160 chars)
   */
  metaDescription?: string
  /**
   * AI-generated step-by-step usage instructions
   */
  howToUse?: Array<string>
  /**
   * AI-generated suggested use cases
   */
  suggestedUseCases?: Array<string>
  /**
   * AI-generated FAQ items
   */
  faqItems?: Array<{
    question: string
    answer: string
  }>
  /**
   * Content template used for generation (tutorial, showcase, comparison, breakthrough)
   */
  contentTemplate?: string
}

/**
 * Request body for updating an existing Hub profile.
 */
export type UpdateHubProfileRequest = {
  display_name?: string
  description?: string
  /**
   * Token (from /api/hub/assets/upload-url) for a new avatar image. Omit or send null to leave unchanged; send empty string "" to remove.
   *
   */
  avatar_token?: string | null
  /**
   * List of website URLs.
   */
  website_urls?: Array<string>
}

/**
 * Request body for creating a new Hub profile.
 */
export type CreateHubProfileRequest = {
  /**
   * ID of the workspace to create the hub profile for. The authenticated user must belong to this workspace.
   */
  workspace_id: string
  /**
   * Unique URL-safe slug for the hub profile. Immutable after creation.
   */
  username: string
  display_name?: string
  description?: string
  /**
   * Token (from /api/hub/assets/upload-url) for an avatar image. Omit to have no avatar.
   *
   */
  avatar_token?: string
  /**
   * List of website URLs.
   */
  website_urls?: Array<string>
}

/**
 * Full public profile for a Hub creator.
 */
export type HubProfile = {
  username: string
  display_name?: string
  description?: string
  /**
   * Public URL of the profile avatar image.
   */
  avatar_url?: string
  /**
   * List of website URLs.
   */
  website_urls?: Array<string>
}

/**
 * Response after importing published workflow assets.
 */
export type ImportPublishedAssetsResponse = {
  assets: Array<AssetInfo>
}

/**
 * Request body for importing assets from a published workflow.
 */
export type ImportPublishedAssetsRequest = {
  /**
   * IDs of published assets (inputs and models) to import.
   */
  published_asset_ids: Array<string>
  /**
   * Optional. Share ID of the published workflow these assets belong to.
   * When provided (non-null, non-empty): all published_asset_ids must
   * belong to this share's workflow version; returns
   * 400/CodeInvalidAssets if the share is not found or any asset does
   * not belong to it.
   * When omitted, null, or empty string: no share-scoped validation is
   * performed and the assets are validated only against global rules
   * (legacy behaviour, preserved for clients that have not yet adopted
   * share_id).
   *
   */
  share_id?: string | null
}

/**
 * Full detail of a publicly published workflow on the Hub.
 */
export type PublishedWorkflowDetail = {
  share_id: string
  workflow_id: string
  /**
   * Human-readable workflow name.
   */
  name: string
  listed: boolean
  publish_time?: string | null
  /**
   * The workflow JSON content at publish time.
   */
  workflow_json: {
    [key: string]: unknown
  }
  /**
   * Published assets with their library status for the caller.
   */
  assets: Array<AssetInfo>
}

/**
 * Response containing assets associated with a workflow.
 */
export type WorkflowApiAssetsResponse = {
  assets: Array<AssetInfo>
}

/**
 * Request body for querying assets associated with a workflow.
 */
export type WorkflowApiAssetsRequest = {
  workflow_api_json: {
    [key: string]: unknown
  }
}

/**
 * Request body for publishing workflow assets to the Hub.
 */
export type PublishWorkflowAssetsRequest = {
  /**
   * IDs of assets (inputs and models) to snapshot.
   */
  asset_ids: Array<string>
}

/**
 * Publishing metadata for a workflow shared to the Hub.
 */
export type WorkflowPublishInfo = {
  workflow_id: string
  share_id: string
  publish_time?: string | null
  listed: boolean
  /**
   * Published assets (inputs and models).
   */
  assets: Array<AssetInfo>
}

/**
 * Request body for forking an existing workflow into the user's account.
 */
export type ForkWorkflowRequest = {
  /**
   * Version number to fork from
   */
  source_version: number
  /**
   * Name for the forked workflow
   */
  name?: string
}

/**
 * Full workflow version including the serialized workflow JSON.
 */
export type WorkflowVersionContentResponse = {
  id: string
  version: number
  workflow_json: {
    [key: string]: unknown
  }
  created_by: string
  created_at: string
  dependency_asset_ids?: Array<string>
}

/**
 * Metadata for a single workflow version.
 */
export type WorkflowVersionResponse = {
  id: string
  version: number
  latest_version: number
  created_by: string
  created_at: string
}

/**
 * Request body for creating a new version of a saved workflow.
 */
export type CreateWorkflowVersionRequest = {
  /**
   * The version number this change is based on (for optimistic concurrency)
   */
  base_version: number
  /**
   * The updated ComfyUI workflow JSON
   */
  workflow_json: {
    [key: string]: unknown
  }
}

/**
 * Paginated list of saved workflows.
 */
export type WorkflowListResponse = {
  data: Array<WorkflowResponse>
  pagination: PaginationInfo
}

/**
 * Offset/limit-based pagination metadata included in list responses.
 */
export type PaginationInfo = {
  /**
   * Current offset (0-based)
   */
  offset: number
  /**
   * Items per page
   */
  limit: number
  /**
   * Total number of items matching filters
   */
  total: number
  /**
   * Whether more items are available beyond this page
   */
  has_more: boolean
}

/**
 * Reference to the parent workflow from which this workflow was forked.
 */
export type WorkflowForkedFrom = {
  workflow_id?: string
  workflow_version_id?: string
}

/**
 * Full workflow entity including metadata and version history.
 */
export type WorkflowResponse = {
  id: string
  name?: string
  description?: string
  default_view?: 'workflow' | 'app'
  latest_version: number
  forked_from?: WorkflowForkedFrom
  created_by: string
  created_at: string
  updated_at: string
}

/**
 * Request body for updating an existing saved workflow.
 */
export type UpdateWorkflowRequest = {
  /**
   * New display name
   */
  name?: string
  /**
   * New description
   */
  description?: string
  /**
   * New default view mode
   */
  default_view?: 'workflow' | 'app'
}

/**
 * Request body for creating a new saved workflow.
 */
export type CreateWorkflowRequest = {
  /**
   * Display name for the workflow
   */
  name?: string
  /**
   * Description of the workflow
   */
  description?: string
  /**
   * Default view mode
   */
  default_view?: 'workflow' | 'app'
  /**
   * The ComfyUI workflow JSON
   */
  workflow_json: {
    [key: string]: unknown
  }
  /**
   * ID of the source workflow if forked
   */
  forked_from_workflow_id?: string
  /**
   * ID of the source workflow version if forked
   */
  forked_from_workflow_version_id?: string
}

/**
 * Response after recording partner usage data.
 */
export type PartnerUsageResponse = {
  /**
   * Result status (e.g., "ok")
   */
  status: string
}

/**
 * Request body for reporting partner resource usage (admin endpoint).
 */
export type PartnerUsageRequest = {
  /**
   * The workspace ID to bill usage against
   */
  workspace_id: string
  /**
   * The user who triggered the usage (for attribution)
   */
  user_id?: string
  /**
   * Unique transaction ID for idempotency
   */
  transaction_id: string
  /**
   * Type of usage event (e.g., "api_node_usage")
   */
  event_type: string
  /**
   * When the usage occurred. Defaults to current time if omitted.
   */
  timestamp?: string
  /**
   * Event-specific properties for billing
   */
  properties?: {
    [key: string]: unknown
  }
}

/**
 * Status of an asynchronous billing operation.
 */
export type BillingOpStatusResponse = {
  /**
   * Unique identifier for the billing operation
   */
  id: string
  /**
   * Current status of the operation
   */
  status: 'pending' | 'succeeded' | 'failed'
  /**
   * Error message if status is failed
   */
  error_message?: string
  /**
   * When the operation was initiated
   */
  started_at: string
  /**
   * When the operation completed (success or failure)
   */
  completed_at?: string
}

/**
 * Response after successfully purchasing a credit top-up.
 */
export type CreateTopupResponse = {
  /**
   * Billing operation ID to poll for status via GET /api/billing/ops/{id}
   */
  billing_op_id: string
  /**
   * Unique identifier for the top-up request (same as billing_op_id, deprecated)
   */
  topup_id: string
  /**
   * Current status of the top-up
   */
  status: 'pending' | 'completed' | 'failed'
  /**
   * Amount being charged in cents
   */
  amount_cents: number
}

/**
 * Request body for purchasing a one-time credit top-up.
 */
export type CreateTopupRequest = {
  /**
   * Amount to charge and grant as credits (in cents). Minimum $5.00.
   */
  amount_cents: number
  /**
   * Client-provided key to prevent duplicate operations.
   * If a billing op with this key already exists, returns the existing op instead of creating a new one.
   *
   */
  idempotency_key?: string
}

/**
 * Response containing a redirect URL to the payment portal.
 */
export type PaymentPortalResponse = {
  /**
   * Stripe Billing Portal URL
   */
  url: string
}

/**
 * Request body for generating a payment portal session URL.
 */
export type PaymentPortalRequest = {
  /**
   * URL to redirect after the user exits the portal
   */
  return_url?: string
}

/**
 * Response after successfully resubscribing to a billing plan.
 */
export type ResubscribeResponse = {
  /**
   * Billing operation ID to poll for status via GET /api/billing/ops/{id}
   */
  billing_op_id: string
  /**
   * The subscription status after resubscribing
   */
  status: 'active'
  /**
   * Human-readable confirmation message
   */
  message?: string
}

/**
 * Request body for reactivating a previously cancelled subscription.
 */
export type ResubscribeRequest = {
  /**
   * Client-provided key to prevent duplicate operations.
   * If a billing op with this key already exists, returns the existing op instead of creating a new one.
   *
   */
  idempotency_key?: string
}

/**
 * Response after successfully cancelling a subscription.
 */
export type CancelSubscriptionResponse = {
  /**
   * Billing operation ID to poll for status via GET /api/billing/ops/{id}
   */
  billing_op_id: string
  /**
   * The date when the subscription will end (end of current billing period)
   */
  cancel_at: string
}

/**
 * Request body for cancelling the current subscription.
 */
export type CancelSubscriptionRequest = {
  /**
   * Client-provided key to prevent duplicate operations.
   * If a billing op with this key already exists, returns the existing op instead of creating a new one.
   *
   */
  idempotency_key?: string
}

/**
 * Response after successfully subscribing to a billing plan.
 */
export type SubscribeResponse = {
  /**
   * Billing operation ID to poll for status via GET /api/billing/ops/{id}
   */
  billing_op_id: string
  /**
   * Status of the subscription operation:
   * - subscribed: Subscription is active immediately
   * - needs_payment_method: User must add payment method via payment_method_url
   * - pending_payment: Upgrade initiated, waiting for payment to complete
   *
   */
  status: 'subscribed' | 'needs_payment_method' | 'pending_payment'
  /**
   * When the subscription became/becomes active (present when status=subscribed or pending_payment)
   */
  effective_at?: string
  /**
   * URL to redirect user to add payment method (present when status=needs_payment_method)
   */
  payment_method_url?: string
}

/**
 * Request body for subscribing a workspace to a billing plan.
 */
export type SubscribeRequest = {
  /**
   * Target plan slug to subscribe to
   */
  plan_slug: string
  /**
   * Client-provided key to prevent duplicate operations.
   * If a billing op with this key already exists, returns the existing op instead of creating a new one.
   *
   */
  idempotency_key?: string
  /**
   * URL to redirect after payment method is added successfully.
   * Required if workspace has no payment method on file.
   *
   */
  return_url?: string
  /**
   * URL to redirect if user cancels the payment method flow.
   * If not provided, return_url is used for both success and cancel.
   *
   */
  cancel_url?: string
}

/**
 * Plan information for preview display
 */
export type PreviewPlanInfo = {
  /**
   * Plan slug
   */
  slug: string
  tier: SubscriptionTier
  duration: SubscriptionDuration
  /**
   * Per-seat price in cents
   */
  price_cents: number
  /**
   * Per-seat credits in cents
   */
  credits_cents: number
  seat_summary: PlanSeatSummary
  /**
   * Current billing period start (only for current_plan)
   */
  period_start?: string
  /**
   * Current billing period end (only for current_plan)
   */
  period_end?: string
}

/**
 * Summary of seat costs based on current workspace members
 */
export type PlanSeatSummary = {
  /**
   * Total number of seats (owner + members) that would be charged
   */
  seat_count: number
  /**
   * Total cost for all seats in cents
   */
  total_cost_cents: number
  /**
   * Total credits granted for all seats in cents
   */
  total_credits_cents: number
}

/**
 * Billing period (uppercase to match comfy-api)
 */
export type SubscriptionDuration = 'MONTHLY' | 'ANNUAL'

/**
 * Subscription tier (uppercase to match comfy-api)
 */
export type SubscriptionTier =
  | 'FREE'
  | 'STANDARD'
  | 'CREATOR'
  | 'PRO'
  | 'FOUNDERS_EDITION'

/**
 * Itemized cost preview for a pending subscription change.
 */
export type PreviewSubscribeResponse = {
  /**
   * Whether this subscription change is allowed
   */
  allowed: boolean
  /**
   * Reason why the change is not allowed (only present if allowed=false)
   */
  reason?: string
  /**
   * Type of subscription transition
   */
  transition_type:
    | 'new_subscription'
    | 'upgrade'
    | 'downgrade'
    | 'duration_change'
  /**
   * When the change takes effect
   */
  effective_at: string
  /**
   * Whether the change takes effect immediately (true) or at period end (false)
   */
  is_immediate: boolean
  /**
   * Amount to charge today in cents (0 for downgrades)
   */
  cost_today_cents: number
  /**
   * Amount that will be charged at next billing period in cents
   */
  cost_next_period_cents: number
  /**
   * Credits granted today in cents (prorated for mid-period upgrades)
   */
  credits_today_cents: number
  /**
   * Credits that will be granted at next billing period in cents
   */
  credits_next_period_cents: number
  current_plan?: PreviewPlanInfo
  new_plan: PreviewPlanInfo
}

/**
 * Request body for previewing the cost of a plan subscription change.
 */
export type PreviewSubscribeRequest = {
  /**
   * Target plan slug to preview subscribing to
   */
  plan_slug: string
}

/**
 * List of available billing plans for subscription.
 */
export type BillingPlansResponse = {
  /**
   * Current plan slug if subscribed
   */
  current_plan_slug?: string
  plans: Array<Plan>
}

/**
 * Reason why a plan is unavailable
 */
export type PlanAvailabilityReason =
  | 'same_plan'
  | 'incompatible_transition'
  | 'requires_team'
  | 'requires_personal'
  | 'exceeds_max_seats'

/**
 * Availability and eligibility information for a billing plan.
 */
export type PlanAvailability = {
  /**
   * Whether the workspace can subscribe to this plan
   */
  available: boolean
  reason?: PlanAvailabilityReason
}

/**
 * Billing plan details including pricing, limits, and features.
 */
export type Plan = {
  /**
   * Plan identifier (e.g., "pro-monthly", "team-standard-annual")
   */
  slug: string
  tier: SubscriptionTier
  duration: SubscriptionDuration
  /**
   * Per-member price in cents (base + one seat)
   */
  price_cents: number
  /**
   * Per-member credits in cents (base + one seat)
   */
  credits_cents: number
  /**
   * Maximum number of seats allowed for this plan
   */
  max_seats: number
  availability: PlanAvailability
  seat_summary: PlanSeatSummary
}

/**
 * List of user secrets with metadata only.
 */
export type SecretListResponse = {
  data: Array<SecretResponse>
}

/**
 * User secret metadata (the secret value itself is never returned after creation).
 */
export type SecretResponse = {
  /**
   * Unique identifier for the secret
   */
  id: string
  /**
   * User-provided label for the secret
   */
  name: string
  /**
   * Provider identifier (e.g., huggingface, civitai)
   */
  provider?: string
  /**
   * When the secret was last used for decryption
   */
  last_used_at?: string
  /**
   * When the secret was created
   */
  created_at: string
  /**
   * When the secret was last updated
   */
  updated_at: string
}

/**
 * Request body for updating an existing user secret.
 */
export type UpdateSecretRequest = {
  /**
   * New name for the secret
   */
  name?: string
  /**
   * New secret value (API key, token, etc.)
   */
  secret_value?: string
}

/**
 * Request body for creating a new user secret.
 */
export type CreateSecretRequest = {
  /**
   * User-provided label for the secret
   */
  name: string
  /**
   * Optional provider identifier (e.g., huggingface, civitai)
   */
  provider?: string
  /**
   * The plaintext secret to encrypt and store
   */
  secret_value: string
}

/**
 * Paginated list of billing events for a workspace.
 */
export type BillingEventsResponse = {
  /**
   * Total number of events
   */
  total: number
  events: Array<BillingEvent>
  /**
   * Current page number (1-indexed)
   */
  page: number
  /**
   * Items per page
   */
  limit: number
  /**
   * Total number of pages
   */
  totalPages: number
}

/**
 * A single billing event such as a charge, credit, or adjustment.
 */
export type BillingEvent = {
  /**
   * Type of billing event (e.g., subscription.created, payment.succeeded)
   */
  event_type: string
  /**
   * Unique event identifier
   */
  event_id: string
  /**
   * Event-specific parameters
   */
  params?: {
    [key: string]: unknown
  }
  /**
   * When the event occurred
   */
  createdAt: string
}

/**
 * Current credit balance and usage details for a workspace.
 */
export type BillingBalanceResponse = {
  /**
   * The total remaining balance in microamount (1/1,000,000 of the currency unit)
   */
  amount_micros: number
  /**
   * The remaining balance from prepaid commits in microamount
   */
  prepaid_balance_micros?: number
  /**
   * The remaining balance from cloud credits in microamount
   */
  cloud_credit_balance_micros?: number
  /**
   * The total amount of pending/unbilled charges from draft invoices in microamount
   */
  pending_charges_micros?: number
  /**
   * The effective balance (total balance minus pending charges). Can be negative if pending charges exceed the balance.
   */
  effective_balance_micros?: number
  /**
   * Currency code
   */
  currency: string
}

/**
 * Current billing and subscription status for a workspace.
 */
export type BillingStatusResponse = {
  /**
   * Whether the workspace has an active subscription
   */
  is_active: boolean
  /**
   * Subscription activity status (scheduled subscriptions are not returned)
   */
  subscription_status?: 'active' | 'ended' | 'canceled'
  subscription_tier?: SubscriptionTier
  subscription_duration?: SubscriptionDuration
  /**
   * Plan identifier (e.g., standard-monthly, team-pro-annual)
   */
  plan_slug?: string
  billing_status?: BillingStatus
  /**
   * Whether the workspace has available credits
   */
  has_funds: boolean
  /**
   * When the subscription will become inactive (if canceled)
   */
  cancel_at?: string
  /**
   * When the current billing period ends and the next one begins
   */
  renewal_date?: string
}

/**
 * Payment lifecycle status
 */
export type BillingStatus =
  | 'awaiting_payment_method'
  | 'pending_payment'
  | 'paid'
  | 'payment_failed'
  | 'inactive'

/**
 * A single JSON Web Key entry within a JWKS response.
 */
export type JwkKey = {
  kty: string
  crv: string
  kid: string
  use: string
  alg: string
  /**
   * Base64url-encoded X coordinate
   */
  x: string
  /**
   * Base64url-encoded Y coordinate
   */
  y: string
}

/**
 * RFC 6749 §5.2 error response.
 */
export type OAuthTokenError = {
  /**
   * RFC 6749 §5.2 error code: invalid_request, invalid_client, invalid_grant, unauthorized_client, unsupported_grant_type, invalid_scope.
   */
  error: string
  /**
   * Human-readable, no leak of internal storage state.
   */
  error_description?: string
}

/**
 * RFC 6749 §5.1 successful token response.
 */
export type OAuthTokenResponse = {
  /**
   * Resource-bound Cloud JWT (audience matches the protected resource).
   */
  access_token: string
  token_type: 'Bearer'
  /**
   * Access token lifetime in seconds.
   */
  expires_in: number
  /**
   * Opaque refresh token. Rotates on every successful refresh; presenting an already-rotated token revokes the entire family.
   */
  refresh_token: string
  /**
   * Space-delimited scopes granted with this token.
   */
  scope: string
}

/**
 * One workspace option presented in the OAuth consent challenge. Promoted to a named schema so the generated Go type is referenceable in handlers and tests rather than re-declared as an anonymous struct at every callsite.
 *
 */
export type OAuthConsentChallengeWorkspace = {
  id: string
  name: string
  type: 'personal' | 'team'
  role: 'owner' | 'member'
}

/**
 * Redirect target produced after a JSON consent submission. The frontend must navigate the browser to this URL so custom-scheme client callbacks work without relying on fetch-visible 302 headers.
 */
export type OAuthAuthorizeRedirectResponse = {
  /**
   * OAuth client redirect URI with either code+state for allow, or error+state for deny.
   */
  redirect_url: string
}

/**
 * Server-side state describing the OAuth consent decision the user is being asked to make. Returned by GET /oauth/authorize when a valid Cloud session exists; the frontend renders the consent UI from this payload and POSTs the decision back. Browser never sees the original OAuth params on resume.
 *
 */
export type OAuthConsentChallenge = {
  /**
   * Opaque server-side identifier for the authorization-request row. Carried back unchanged in the consent submission.
   */
  oauth_request_id: string
  /**
   * Per-row CSRF token bound to this authorization request (not to the session). Must be echoed back on POST.
   */
  csrf_token: string
  /**
   * Human-readable name of the OAuth client requesting authorization, from oauth_clients.display_name.
   */
  client_display_name: string
  /**
   * Human-readable name of the protected resource, from oauth_resources.display_name.
   */
  resource_display_name: string
  /**
   * Scopes the client is requesting for this resource. The frontend should present these for the user to approve.
   */
  scopes: Array<string>
  /**
   * Workspaces the user can select from. Membership is re-checked on POST.
   */
  workspaces: Array<OAuthConsentChallengeWorkspace>
}

/**
 * OAuth 2.1 protected-resource metadata (RFC 9728).
 */
export type OAuthProtectedResourceMetadata = {
  resource: string
  authorization_servers: Array<string>
  scopes_supported: Array<string>
  bearer_methods_supported?: Array<string>
}

/**
 * RFC 7591 §3.2.2 error response.
 */
export type OAuthRegisterError = {
  error: 'invalid_redirect_uri' | 'invalid_client_metadata'
  error_description?: string | null
}

/**
 * Union of the two 400 shapes /oauth/register can emit. `OAuthRegisterError` is the handler-shaped RFC 7591 §3.2.2 error; `ErrorResponse` is the strict-server binding-layer error fired when the request body fails OpenAPI-schema validation before the handler runs, normalized to the standard {code, message} shape by the custom Echo HTTPErrorHandler (BE-1178).
 *
 */
export type OAuthRegisterBadRequestResponse = OAuthRegisterError | ErrorResponse

/**
 * Standard error response with a machine-readable code and human-readable message.
 */
export type ErrorResponse = {
  code: string
  message: string
  /**
   * Optional open object carrying structured, machine-readable context about the error (e.g. offending field names, validation specifics). Absent for most errors; consumers must not assume any particular shape.
   */
  details?: {
    [key: string]: unknown
  }
}

/**
 * RFC 7591 §3.2.1 successful registration response.
 */
export type OAuthRegisterResponse = {
  /**
   * Server-generated client_id. Always carries the `comfy-dyn-` prefix.
   */
  client_id: string
  /**
   * Unix timestamp (seconds) when the client was registered.
   */
  client_id_issued_at: number
  client_name?: string
  redirect_uris: Array<string>
  grant_types: Array<string>
  response_types: Array<string>
  token_endpoint_auth_method: 'none'
  application_type: 'native' | 'web'
}

/**
 * RFC 7591 §2 client metadata document. Only the fields the server honors are listed; presence of `scope` or `resource_grants` in the request is rejected (`invalid_client_metadata`) because those are server-owned for dynamic clients. `additionalProperties: false` mirrors the runtime middleware that rejects any unknown metadata key.
 *
 */
export type OAuthRegisterRequest = {
  /**
   * 1–5 redirect URIs. Validated against `application_type` policy.
   */
  redirect_uris: Array<string>
  /**
   * Human-readable name shown in the consent UI. Reserved-name list rejects impersonation of major MCP clients.
   */
  client_name?: string
  /**
   * RFC 7591 §2 application_type. **OPTIONAL** — omit the field to default to `native` (the loopback-friendly policy), rather than the RFC's nominal `web` default; the MCP SDK's DCR client omits it. `native` for desktop / CLI / MCP-spec-strict clients (loopback redirects); `web` for hosted clients (HTTPS only, host must be allowlisted). The realistic MCP-client population is overwhelmingly native/loopback, so defaulting to `web` would silently bounce those clients off the wrong redirect policy. A *present* value must be one of the enum members; any other value rejects with `invalid_client_metadata`. (The server has no runtime enum validation and defensively coerces a null/empty value to `native`, but spec-validating clients should omit the field rather than send `""` — the enum does not permit it.)
   *
   */
  application_type?: 'native' | 'web'
  /**
   * Public clients only this phase — must be `none` if present. The server forces `none` regardless.
   */
  token_endpoint_auth_method?: 'none'
  /**
   * Optional. Defaults to `["authorization_code","refresh_token"]`.
   */
  grant_types?: Array<'authorization_code' | 'refresh_token'>
  /**
   * Optional. Defaults to `["code"]`.
   */
  response_types?: Array<'code'>
  /**
   * **REJECTED IF PRESENT.** Dynamic clients do not pick scopes — the server assigns scopes from the active MCP resource's published list. Sending `scope` in the registration body is treated as a privilege-escalation attempt and returns `invalid_client_metadata`. The field is documented here so clients see a well-defined error rather than silent drop.
   *
   */
  scope?: string | null
  /**
   * **REJECTED IF PRESENT.** Same reason as `scope`. The set of resources and scopes a dynamic client may request is server-policy, not request-driven.
   *
   */
  resource_grants?: {
    [key: string]: Array<string>
  } | null
  /**
   * **REJECTED IF PRESENT.** Unsupported RFC 7591 metadata for this public MCP-client phase.
   */
  client_uri?: string | null
  /**
   * **REJECTED IF PRESENT.** Unsupported RFC 7591 metadata for this public MCP-client phase.
   */
  logo_uri?: string | null
  /**
   * **REJECTED IF PRESENT.** Unsupported RFC 7591 metadata for this public MCP-client phase.
   */
  tos_uri?: string | null
  /**
   * **REJECTED IF PRESENT.** Unsupported RFC 7591 metadata for this public MCP-client phase.
   */
  policy_uri?: string | null
  /**
   * **REJECTED IF PRESENT.** Unsupported RFC 7591 metadata for this public MCP-client phase.
   */
  software_id?: string | null
  /**
   * **REJECTED IF PRESENT.** Unsupported RFC 7591 metadata for this public MCP-client phase.
   */
  software_version?: string | null
  /**
   * **REJECTED IF PRESENT.** Unsupported RFC 7591 metadata for this public MCP-client phase.
   */
  contacts?: Array<string> | null
  /**
   * **REJECTED IF PRESENT.** Unsupported RFC 7591 metadata for this public MCP-client phase.
   */
  jwks?: {
    [key: string]: unknown
  } | null
  /**
   * **REJECTED IF PRESENT.** Unsupported RFC 7591 metadata for this public MCP-client phase.
   */
  jwks_uri?: string | null
}

/**
 * OAuth 2.1 authorization-server metadata (RFC 8414).
 */
export type OAuthAuthorizationServerMetadata = {
  issuer: string
  authorization_endpoint: string
  token_endpoint: string
  jwks_uri: string
  /**
   * RFC 7591 §3.1 Dynamic Client Registration endpoint. Advertised so MCP-spec-compliant clients can auto-discover and self-register without operator involvement. Present only when DCR is enabled.
   *
   */
  registration_endpoint?: string
  response_types_supported: Array<string>
  grant_types_supported: Array<string>
  code_challenge_methods_supported: Array<string>
  token_endpoint_auth_methods_supported: Array<string>
  scopes_supported?: Array<string>
}

/**
 * JSON Web Key Set containing the public keys used to verify Cloud JWTs.
 */
export type JwksResponse = {
  keys: Array<JwkKey>
}

/**
 * Response after synchronizing an API key into the local database.
 */
export type SyncApiKeyResponse = {
  /**
   * `revoked` — matching row found, was active, now revoked.
   * `already_revoked` — matching row found, already revoked.
   * `no_op` — no row matches the supplied hash.
   *
   */
  result: 'revoked' | 'already_revoked' | 'no_op'
}

/**
 * Request body for synchronizing an API key from the external registry.
 */
export type SyncApiKeyRequest = {
  /**
   * Lifecycle event type. Only `delete` is supported in Phase 1.
   */
  event: 'delete'
  /**
   * SHA-256 hex digest of the plaintext API key (64 hex characters).
   * Case-insensitive: the server lowercases the value before lookup, so
   * producers may emit lowercase or uppercase hex. The lowercase form
   * is recommended for consistency with the rest of the codebase, which
   * computes hashes via `hex.EncodeToString`.
   *
   */
  key_hash: string
  /**
   * Firebase UID of the key's owner according to comfy-api. Required on
   * the request so cloud can detect drift between the two systems, but
   * **advisory only**: `key_hash` is the sole authoritative identifier
   * for the revocation. A mismatch against cloud's stored `user_id` is
   * logged and emits `admin.api_key_sync.delete.customer_mismatch`, but
   * does not change the outcome — the matching row is still revoked so
   * a subsequent sync call can repair drift.
   *
   */
  customer_id: string
}

/**
 * Response confirming the validity and scope of a workspace API key.
 */
export type VerifyApiKeyResponse = {
  /**
   * Firebase UID of the key creator
   */
  user_id: string
  /**
   * User's email address
   */
  email: string
  /**
   * User's display name
   */
  name: string
  /**
   * Whether the user is an admin
   */
  is_admin: boolean
  /**
   * Workspace ID for billing attribution
   */
  workspace_id: string
  /**
   * Type of workspace
   */
  workspace_type: 'personal' | 'team'
  /**
   * User's role in the workspace
   */
  role: 'owner' | 'member'
  /**
   * Whether the workspace has available funds for usage
   */
  has_funds: boolean
  /**
   * Whether the workspace has an active subscription
   */
  is_active: boolean
  /**
   * Permissions granted by this key. Always includes the role permission
   * (`owner:*` or `member:*`). May also include `partner-node:use`,
   * which is a **staging-only shim** used to gate partner-node access
   * for non-admin users during testing. No production code path checks
   * this permission today; it is emitted for parity with the Cloud JWT
   * claim set so JWT and API-key callers see the same permissions.
   *
   */
  permissions: Array<string>
}

/**
 * Request body for verifying a workspace API key (admin endpoint).
 */
export type VerifyApiKeyRequest = {
  /**
   * The full plaintext API key to verify
   */
  api_key: string
}

/**
 * Response after bulk-revoking API keys for a workspace member.
 */
export type BulkRevokeApiKeysResponse = {
  /**
   * Number of API keys that were revoked
   */
  revoked_count: number
}

/**
 * List of API keys associated with the current workspace.
 */
export type ListWorkspaceApiKeysResponse = {
  api_keys: Array<WorkspaceApiKeyInfo>
}

/**
 * Metadata for a workspace-scoped API key (secret is never returned).
 */
export type WorkspaceApiKeyInfo = {
  /**
   * API key ID
   */
  id: string
  /**
   * Workspace this key belongs to
   */
  workspace_id: string
  /**
   * User who created this key
   */
  user_id: string
  /**
   * User-provided label
   */
  name: string
  /**
   * User-provided description of the key's purpose. Limit is byte-based (UTF-8 encoding); 5000 bytes equals 5000 ASCII characters or fewer multi-byte characters.
   */
  description: string
  /**
   * First 8 chars after prefix for display
   */
  key_prefix: string
  /**
   * When the key expires (if set)
   */
  expires_at?: string
  /**
   * Last time the key was used
   */
  last_used_at?: string
  /**
   * When the key was revoked (if revoked)
   */
  revoked_at?: string
  /**
   * When the key was created
   */
  created_at: string
}

/**
 * Response containing the newly created workspace API key.
 */
export type CreateWorkspaceApiKeyResponse = {
  /**
   * API key ID
   */
  id: string
  /**
   * User-provided label
   */
  name: string
  /**
   * User-provided description of the key's purpose. Limit is byte-based (UTF-8 encoding); 5000 bytes equals 5000 ASCII characters or fewer multi-byte characters.
   */
  description: string
  /**
   * The full plaintext API key (only shown once)
   */
  key: string
  /**
   * First 8 chars after prefix for display
   */
  key_prefix: string
  /**
   * When the key expires (if set)
   */
  expires_at?: string
  /**
   * When the key was created
   */
  created_at: string
}

/**
 * Request body for creating a new workspace-scoped API key.
 */
export type CreateWorkspaceApiKeyRequest = {
  /**
   * User-provided label for the key
   */
  name: string
  /**
   * User-provided description of the key's purpose. Limit is byte-based (UTF-8 encoding); 5000 bytes equals 5000 ASCII characters or fewer multi-byte characters.
   */
  description?: string
  /**
   * Optional expiration timestamp
   */
  expires_at?: string
}

/**
 * Response returned after successfully accepting a workspace invitation.
 */
export type AcceptInviteResponse = {
  /**
   * ID of the workspace joined
   */
  workspace_id: string
  /**
   * Name of the workspace joined
   */
  workspace_name: string
}

/**
 * Request body for inviting a user to a workspace.
 */
export type CreateInviteRequest = {
  /**
   * Email address to invite
   */
  email: string
}

/**
 * List of pending invitations for the current workspace.
 */
export type ListInvitesResponse = {
  invites: Array<PendingInvite>
}

/**
 * An outstanding workspace invitation that has not yet been accepted.
 */
export type PendingInvite = {
  /**
   * Invite ID
   */
  id: string
  /**
   * Email address of the invited user
   */
  email: string
  /**
   * Invite token for constructing invite links. Empty for expired invites.
   */
  token?: string
  /**
   * When the invite was created
   */
  invited_at: string
  /**
   * When the invite expires
   */
  expires_at: string
}

/**
 * List of members in the current workspace.
 */
export type ListMembersResponse = {
  members: Array<Member>
  pagination: PaginationInfo
}

/**
 * Workspace member with profile and role information.
 */
export type Member = {
  /**
   * User ID
   */
  id: string
  /**
   * User's display name
   */
  name: string
  /**
   * User's email address
   */
  email: string
  /**
   * User's role in the workspace
   */
  role: 'owner' | 'member'
  /**
   * When the user joined the workspace
   */
  joined_at: string
}

/**
 * Request body for updating an existing workspace's settings.
 */
export type UpdateWorkspaceRequest = {
  /**
   * New display name for the workspace
   */
  name?: string
}

/**
 * Request body for creating a new workspace.
 */
export type CreateWorkspaceRequest = {
  /**
   * Display name for the workspace
   */
  name: string
}

/**
 * Workspace entity annotated with the requesting user's role.
 */
export type WorkspaceWithRole = {
  id: string
  name: string
  type: 'personal' | 'team'
  role: 'owner' | 'member'
  /**
   * When the workspace was created
   */
  created_at: string
  /**
   * When the user joined the workspace (same as created_at for the workspace creator)
   */
  joined_at: string
  subscription_tier?: SubscriptionTier
}

/**
 * Paginated list of workspaces the authenticated user belongs to.
 */
export type ListWorkspacesResponse = {
  workspaces: Array<WorkspaceWithRole>
}

/**
 * Full workspace entity with configuration and ownership details.
 */
export type Workspace = {
  id: string
  name: string
  type: 'personal' | 'team'
  created_at: string
}

/**
 * Abbreviated workspace metadata used in list responses.
 */
export type WorkspaceSummary = {
  id: string
  name: string
  type: 'personal' | 'team'
}

/**
 * Response containing the issued Cloud JWT and its expiry.
 */
export type ExchangeTokenResponse = {
  /**
   * Cloud JWT token
   */
  token: string
  /**
   * Token expiration time (RFC 3339)
   */
  expires_at: string
  workspace: WorkspaceSummary
  /**
   * User's role in the workspace
   */
  role: 'owner' | 'member'
  /**
   * Permission strings for the role
   */
  permissions: Array<string>
}

/**
 * Optional request body for the token exchange endpoint. The Firebase JWT
 * being exchanged is supplied via the `Authorization: Bearer` header; this
 * body only carries workspace-selection input.
 *
 */
export type ExchangeTokenRequest = {
  /**
   * Workspace ID to get token for. Defaults to personal workspace if omitted.
   */
  workspace_id?: string
}

/**
 * Full task details including payload and result
 */
export type TaskResponse = {
  /**
   * Unique task identifier
   */
  id: string
  /**
   * Caller-provided key for idempotent task creation
   */
  idempotency_key: string
  /**
   * Task type name (e.g., model_upload)
   */
  task_name: string
  /**
   * Task input data
   */
  payload: {
    [key: string]: unknown
  }
  /**
   * Current task status
   */
  status: 'created' | 'running' | 'completed' | 'failed'
  /**
   * Task output data (null if not completed)
   */
  result?: {
    [key: string]: unknown
  }
  /**
   * Error message on failure (null if not failed)
   */
  error_message?: string
  /**
   * Task creation timestamp
   */
  create_time: string
  /**
   * Task last update timestamp
   */
  update_time: string
  /**
   * When task execution started (null if not started)
   */
  started_at?: string
  /**
   * When task completed or failed (null if not finished)
   */
  completed_at?: string
}

/**
 * Task data for list views
 */
export type TaskEntry = {
  /**
   * Unique task identifier
   */
  id: string
  /**
   * Task type name (e.g., model_upload)
   */
  task_name: string
  /**
   * Current task status
   */
  status: 'created' | 'running' | 'completed' | 'failed'
  /**
   * Task creation timestamp
   */
  create_time: string
  /**
   * When task execution started (null if not started)
   */
  started_at?: string
  /**
   * When task completed or failed (null if not finished)
   */
  completed_at?: string
}

/**
 * Paginated list of background tasks for the authenticated user.
 */
export type TasksListResponse = {
  /**
   * Array of tasks ordered by create_time
   */
  tasks: Array<TaskEntry>
  pagination: PaginationInfo
}

/**
 * Details of a pending or completed user data deletion request.
 */
export type DeletionRequest = {
  /**
   * Unique identifier for the deletion request
   */
  id: string
  /**
   * The Firebase ID of the user being deleted
   */
  firebase_id: string
  /**
   * The time the deletion request was created
   */
  create_time: string
  /**
   * Array of deletion status objects
   */
  deletion_status: Array<DeletionStatus>
}

/**
 * Current status of a user data deletion request.
 */
export type DeletionStatus = {
  /**
   * The name of the deletion status
   */
  status_name: string
  /**
   * Additional details about the deletion status
   */
  status_details: string
}

/**
 * Detailed execution error information from ComfyUI
 */
export type ExecutionError = {
  /**
   * ID of the node that failed
   */
  node_id: string
  /**
   * Type name of the node (e.g., "KSampler")
   */
  node_type: string
  /**
   * Human-readable error message
   */
  exception_message: string
  /**
   * Python exception type (e.g., "RuntimeError")
   */
  exception_type: string
  /**
   * Array of traceback lines (empty array if not available)
   */
  traceback: Array<string>
  /**
   * Input values at time of failure (empty object if not available)
   */
  current_inputs: {
    [key: string]: unknown
  }
  /**
   * Output values at time of failure (empty object if not available)
   */
  current_outputs: {
    [key: string]: unknown
  }
}

/**
 * Full job details including workflow and outputs
 */
export type JobDetailResponse = {
  /**
   * Unique job identifier
   */
  id: string
  /**
   * User-friendly job status
   */
  status: 'pending' | 'in_progress' | 'completed' | 'failed' | 'cancelled'
  /**
   * Full ComfyUI workflow (10-100KB, omitted if not available).
   *
   * Sensitive credentials are redacted before the response is returned:
   * `extra_data.api_key_comfy_org`, when present, is replaced with the
   * literal string `"[REDACTED]"`. The field is preserved (not removed)
   * so existence checks still pass, but the value is not usable.
   *
   */
  workflow?: {
    [key: string]: unknown
  }
  /**
   * Detailed execution error from ComfyUI (only for failed jobs with structured error data)
   */
  execution_error?: ExecutionError
  /**
   * Job creation timestamp (Unix timestamp in milliseconds)
   */
  create_time: number
  /**
   * Last update timestamp (Unix timestamp in milliseconds)
   */
  update_time: number
  /**
   * Full outputs object from ComfyUI (only for terminal states)
   */
  outputs?: {
    [key: string]: unknown
  }
  /**
   * Primary preview output (only for terminal states)
   */
  preview_output?: {
    [key: string]: unknown
  }
  /**
   * Total number of output files (omitted for non-terminal states)
   */
  outputs_count?: number
  /**
   * UUID identifying the workflow graph definition
   */
  workflow_id?: string
  /**
   * ComfyUI execution status and timeline (only for terminal states)
   */
  execution_status?: {
    [key: string]: unknown
  }
  /**
   * Node-level execution metadata (only for terminal states)
   */
  execution_meta?: {
    [key: string]: unknown
  }
}

/**
 * Response for POST /api/jobs/{job_id}/cancel. Returned on both fresh cancels and idempotent no-ops.
 */
export type JobCancelResponse = {
  /**
   * True when a cancel event was successfully dispatched by this call.
   * False when the job was already in a terminal or cancelling state,
   * in which case the call is a no-op (still 200 — idempotent).
   *
   */
  cancelled: boolean
}

/**
 * Lightweight job data for list views (workflow and full outputs excluded)
 */
export type JobEntry = {
  /**
   * Unique job identifier
   */
  id: string
  /**
   * User-friendly job status
   */
  status: 'pending' | 'in_progress' | 'completed' | 'failed' | 'cancelled'
  /**
   * Detailed execution error from ComfyUI (only for failed jobs with structured error data)
   */
  execution_error?: ExecutionError
  /**
   * Job creation timestamp (Unix timestamp in milliseconds)
   */
  create_time: number
  /**
   * Primary preview output (only present for terminal states)
   */
  preview_output?: {
    [key: string]: unknown
  }
  /**
   * Total number of output files (omitted for non-terminal states)
   */
  outputs_count?: number
  /**
   * UUID identifying the workflow graph definition
   */
  workflow_id?: string
  /**
   * Workflow execution start timestamp (Unix milliseconds, only present for terminal states)
   */
  execution_start_time?: number
  /**
   * Workflow execution completion timestamp (Unix milliseconds, only present for terminal states)
   */
  execution_end_time?: number
}

/**
 * Paginated list of jobs for the authenticated user.
 */
export type JobsListResponse = {
  /**
   * Array of jobs ordered by specified sort field
   */
  jobs: Array<JobEntry>
  pagination: PaginationInfo
}

/**
 * Response after adding, updating, or removing tags on an asset.
 */
export type TagsModificationResponse = {
  /**
   * Tags that were successfully added (for add operation)
   */
  added?: Array<string>
  /**
   * Tags that were successfully removed (for remove operation)
   */
  removed?: Array<string>
  /**
   * Tags that were already present (for add operation)
   */
  already_present?: Array<string>
  /**
   * Tags that were not present (for remove operation)
   */
  not_present?: Array<string>
  /**
   * All tags on the asset after the operation
   */
  total_tags: Array<string>
}

/**
 * Details of a single validation error encountered during asset operations.
 */
export type ValidationError = {
  /**
   * Machine-readable error code
   */
  code: string
  /**
   * Human-readable error message
   */
  message: string
  /**
   * Field that failed validation
   */
  field: string
}

/**
 * Result of validating a set of asset operations.
 */
export type ValidationResult = {
  /**
   * Overall validation status (true if all checks passed)
   */
  is_valid: boolean
  /**
   * Blocking validation errors that prevent download
   */
  errors?: Array<ValidationError>
  /**
   * Non-blocking validation warnings (informational only)
   */
  warnings?: Array<ValidationError>
}

/**
 * Acknowledgement of an async asset download task; clients poll GET /api/tasks/{task_id} for status.
 */
export type AssetDownloadResponse = {
  /**
   * Task ID for tracking download progress via GET /api/tasks/{task_id}
   */
  task_id: string
  /**
   * Current task status
   */
  status: 'created' | 'running' | 'completed' | 'failed'
  /**
   * Human-readable message
   */
  message?: string
}

/**
 * Metadata for a remotely hosted asset resolved by URL.
 */
export type AssetMetadataResponse = {
  /**
   * Size of the asset in bytes (-1 if unknown)
   */
  content_length: number
  /**
   * MIME type of the asset
   */
  content_type?: string
  /**
   * Suggested filename for the asset from source
   */
  filename?: string
  /**
   * Display name or title for the asset from source
   */
  name?: string
  /**
   * Tags for categorization from source
   */
  tags?: Array<string>
  /**
   * Preview image as base64-encoded data URL
   */
  preview_image?: string
  /**
   * Validation results for the file
   */
  validation?: ValidationResult
}

/**
 * Histogram of tag counts used for refining asset search results.
 */
export type AssetTagHistogramResponse = {
  /**
   * Map of tag names to their occurrence counts on matching assets
   */
  tag_counts: {
    [key: string]: number
  }
}

/**
 * Paginated list of available asset tags.
 */
export type ListTagsResponse = {
  /**
   * List of tags
   */
  tags: Array<TagInfo>
  /**
   * Total number of tags
   */
  total: number
  /**
   * Whether more tags are available
   */
  has_more: boolean
}

/**
 * Metadata for a single tag that can be applied to assets.
 */
export type TagInfo = {
  /**
   * Tag name
   */
  name: string
  /**
   * Number of assets using this tag
   */
  count: number
}

/**
 * Paginated list of assets belonging to the authenticated user.
 */
export type ListAssetsResponse = {
  /**
   * List of assets matching the query
   */
  assets: Array<Asset>
  /**
   * Total number of assets matching the filters
   */
  total: number
  /**
   * Whether more assets are available beyond this page
   */
  has_more: boolean
  /**
   * Opaque cursor to pass as the `after` query parameter to fetch the
   * next page. Omitted from the response when there are no more results.
   *
   */
  next_cursor?: string
}

/**
 * Represents a user-owned asset (image, video, or other generated output).
 */
export type Asset = {
  /**
   * Unique identifier for the asset
   */
  id: string
  /**
   * Name of the asset file
   */
  name: string
  /**
   * Display name of the asset. Mirrors name for backwards compatibility.
   */
  display_name?: string | null
  /**
   * Blake3 hash of the asset content.
   */
  hash?: string
  /**
   * Size of the asset in bytes
   */
  size?: number
  /**
   * MIME type of the asset
   */
  mime_type?: string
  /**
   * Tags associated with the asset
   */
  tags?: Array<string>
  /**
   * Custom user metadata for the asset
   */
  user_metadata?: {
    [key: string]: unknown
  }
  /**
   * System-managed metadata from download sources (HuggingFace, CivitAI, etc.) - read-only, not user-modifiable
   */
  readonly metadata?: {
    [key: string]: unknown
  }
  /**
   * URL for asset preview/thumbnail
   */
  preview_url?: string
  /**
   * ID of the preview asset if available
   */
  preview_id?: string | null
  /**
   * ID of the job that created this asset, if available
   */
  job_id?: string | null
  /**
   * Timestamp when the asset was created
   */
  created_at: string
  /**
   * Timestamp when the asset was last updated
   */
  updated_at: string
  /**
   * Timestamp when the asset was last accessed
   */
  last_access_time?: string
  /**
   * Whether this asset is immutable (cannot be modified or deleted)
   */
  is_immutable?: boolean
}

/**
 * Response returned when an existing asset is successfully updated.
 */
export type AssetUpdated = {
  /**
   * Asset ID
   */
  id: string
  /**
   * Updated name of the asset
   */
  name?: string
  /**
   * Display name of the asset. Mirrors name for backwards compatibility.
   */
  display_name?: string | null
  /**
   * Blake3 hash of the asset content.
   */
  hash?: string
  /**
   * Tags associated with the asset
   */
  tags?: Array<string>
  /**
   * Updated MIME type of the asset
   */
  mime_type?: string
  /**
   * Updated custom metadata
   */
  user_metadata?: {
    [key: string]: unknown
  }
  /**
   * ID of the job that created this asset, if available
   */
  job_id?: string | null
  /**
   * Timestamp of the update
   */
  updated_at: string
}

/**
 * Response returned when a new asset is successfully created.
 */
export type AssetCreated = Asset & {
  /**
   * Whether this was a new asset creation (true) or returned existing (false)
   */
  created_new: boolean
}

/**
 * Response after updating the review status of a Hub workflow.
 */
export type SetReviewStatusResponse = {
  /**
   * The share IDs that were submitted for review
   */
  share_ids: Array<string>
  /**
   * The applied review status
   */
  status: 'approved' | 'rejected'
}

/**
 * Request body for setting the review status of a Hub workflow.
 */
export type SetReviewStatusRequest = {
  /**
   * The share IDs of the hub workflows to review
   */
  share_ids: Array<string>
  /**
   * The review decision for the workflows
   */
  status: 'approved' | 'rejected'
}

/**
 * Response after deleting a session cookie
 */
export type DeleteSessionResponse = {
  /**
   * Whether the session was deleted successfully
   */
  success: boolean
}

/**
 * Response after creating a session cookie
 */
export type CreateSessionResponse = {
  /**
   * Whether the session was created successfully
   */
  success: boolean
  /**
   * Session expiration time in seconds (5 days)
   */
  expiresIn?: number
}

/**
 * User information response
 */
export type UserResponse = {
  /**
   * Firebase UID of the authenticated user
   */
  id: string
  /**
   * User status (always "active" for authenticated users)
   */
  status: string
}

/**
 * System statistics response
 */
export type SystemStatsResponse = {
  system: {
    /**
     * Operating system
     */
    os: string
    /**
     * Python version
     */
    python_version: string
    /**
     * Whether using embedded Python
     */
    embedded_python: boolean
    /**
     * ComfyUI version
     */
    comfyui_version: string
    /**
     * ComfyUI frontend version (commit hash or tag)
     */
    comfyui_frontend_version?: string
    /**
     * Workflow templates version
     */
    workflow_templates_version?: string
    /**
     * Cloud ingest service version (commit hash)
     */
    cloud_version?: string
    /**
     * PyTorch version
     */
    pytorch_version: string
    /**
     * Command line arguments
     */
    argv: Array<string>
    /**
     * Total RAM in bytes
     */
    ram_total: number
    /**
     * Free RAM in bytes
     */
    ram_free: number
  }
  devices: Array<{
    /**
     * Device name
     */
    name: string
    /**
     * Device type
     */
    type: string
    /**
     * Total VRAM in bytes
     */
    vram_total?: number
    /**
     * Free VRAM in bytes
     */
    vram_free?: number
  }>
}

/**
 * System logs response
 */
export type LogsResponse = Array<{
  /**
   * When the log entry was created
   */
  timestamp?: string
  /**
   * Log level
   */
  level?: 'debug' | 'info' | 'warn' | 'error'
  /**
   * Log message
   */
  message?: string
  /**
   * Source of the log entry
   */
  source?: string
  /**
   * Additional log metadata
   */
  metadata?: {
    [key: string]: unknown
  }
}>

/**
 * Response after submitting feedback
 */
export type FeedbackResponse = {
  [key: string]: unknown
}

/**
 * Request to submit user feedback
 */
export type FeedbackRequest = {
  /**
   * Type of feedback being submitted
   */
  type: 'missing_nodes' | 'general' | 'missing_models'
  /**
   * The feedback content or message
   */
  content?: string
  /**
   * User's rating of ComfyUI Cloud experience (1-5 stars)
   */
  rating?: number
  /**
   * Additional metadata about the feedback
   */
  metadata?: {
    [key: string]: unknown
  }
}

/**
 * Represents a model file with metadata
 */
export type ModelFile = {
  /**
   * The filename of the model
   */
  name: string
  /**
   * Index of the path where this model is located
   */
  pathIndex: number
}

/**
 * Represents a folder containing models
 */
export type ModelFolder = {
  /**
   * The name of the model folder
   */
  name: string
  /**
   * List of paths where models of this type are stored
   */
  folders: Array<string>
}

/**
 * Error response for ComfyUI prompt execution.
 */
export type PromptErrorResponse = {
  [key: string]: unknown
}

/**
 * Individual file entry within a full user data response.
 */
export type GetUserDataResponseFullFile = {
  /**
   * File name or path relative to the user directory.
   */
  path?: string
  /**
   * File size in bytes.
   */
  size?: number
  /**
   * UNIX timestamp of the last modification in milliseconds.
   */
  modified?: number
}

/**
 * List of user data file entries (each with path, size, and modification time) returned when full_info=true.
 */
export type GetUserDataResponseFull = Array<GetUserDataResponseFullFile>

/**
 * User data listing entry with file metadata (path, size, modification time).
 */
export type UserDataResponseFull = {
  path?: string
  size?: number
  /**
   * UNIX timestamp of the last modification in milliseconds.
   */
  modified?: number
}

/**
 * Request to manage history operations
 */
export type HistoryManageRequest = {
  /**
   * Array of job IDs to delete from history
   */
  delete?: Array<string>
  /**
   * If true, clear all history for the authenticated user
   */
  clear?: boolean
}

/**
 * Job status information
 */
export type JobStatusResponse = {
  /**
   * The job ID
   */
  id: string
  /**
   * Current job status
   */
  status:
    | 'waiting_to_dispatch'
    | 'pending'
    | 'in_progress'
    | 'completed'
    | 'error'
    | 'cancelled'
  /**
   * When the job was created
   */
  created_at: string
  /**
   * When the job was last updated
   */
  updated_at: string
  /**
   * When the job status was last changed
   */
  last_state_update?: string
  /**
   * The inference instance assigned to this job (if any)
   */
  assigned_inference?: string | null
  /**
   * Error message if the job failed
   */
  error_message?: string | null
}

/**
 * Response after a queue management action (delete or clear).
 */
export type QueueManageResponse = {
  /**
   * Array of job IDs that were successfully cancelled
   */
  deleted?: Array<string>
  /**
   * Whether the queue was cleared
   */
  cleared?: boolean
}

/**
 * Request to manage queue operations
 */
export type QueueManageRequest = {
  /**
   * Array of PENDING job IDs to cancel
   */
  delete?: Array<string>
  /**
   * If true, clear all pending jobs from the queue
   */
  clear?: boolean
}

/**
 * Queue information with pending and running jobs
 */
export type QueueInfo = {
  /**
   * Array of currently running job items
   */
  queue_running?: Array<[unknown, unknown, unknown, unknown, unknown]>
  /**
   * Array of pending job items (ordered by creation time, oldest first)
   */
  queue_pending?: Array<[unknown, unknown, unknown, unknown, unknown]>
}

/**
 * Detailed execution history response for a specific prompt.
 * Returns a dictionary with prompt_id as key and full history data as value.
 *
 */
export type HistoryDetailResponse = {
  [key: string]: HistoryDetailEntry
}

/**
 * History entry with full prompt data
 */
export type HistoryDetailEntry = {
  /**
   * Full prompt execution data
   */
  prompt?: {
    /**
     * Execution priority
     */
    priority?: number
    /**
     * The prompt ID
     */
    prompt_id?: string
    /**
     * The workflow nodes
     */
    prompt?: {
      [key: string]: unknown
    }
    /**
     * Additional execution data
     */
    extra_data?: {
      [key: string]: unknown
    }
    /**
     * Output nodes to execute
     */
    outputs_to_execute?: Array<string>
  }
  /**
   * Output data from execution (generated images, files, etc.)
   */
  outputs?: {
    [key: string]: unknown
  }
  /**
   * Execution status and timeline information
   */
  status?: {
    [key: string]: unknown
  }
  /**
   * Metadata about the execution and nodes
   */
  meta?: {
    [key: string]: unknown
  }
}

/**
 * History entry with prompt_id and execution data
 */
export type HistoryEntry = {
  /**
   * Unique identifier for this prompt execution
   */
  prompt_id: string
  /**
   * Job creation timestamp (Unix timestamp in milliseconds)
   */
  create_time?: number
  /**
   * UUID identifying the workflow graph definition
   */
  workflow_id?: string
  /**
   * Filtered prompt execution data (lightweight format)
   */
  prompt?: {
    /**
     * Execution priority
     */
    priority?: number
    /**
     * The prompt ID
     */
    prompt_id?: string
    /**
     * Additional execution data (workflow removed from extra_pnginfo)
     */
    extra_data?: {
      [key: string]: unknown
    }
  }
  /**
   * Output data from execution (generated images, files, etc.)
   */
  outputs?: {
    [key: string]: unknown
  }
  /**
   * Execution status and timeline information
   */
  status?: {
    [key: string]: unknown
  }
  /**
   * Metadata about the execution and nodes
   */
  meta?: {
    [key: string]: unknown
  }
}

/**
 * Execution history response with history array.
 * Returns an object with a "history" key containing an array of history entries.
 * Each entry includes prompt_id as a property along with execution data.
 *
 */
export type HistoryResponse = {
  /**
   * Array of history entries ordered by creation time (newest first)
   */
  history: Array<HistoryEntry>
}

/**
 * Full data for a global subgraph blueprint
 */
export type GlobalSubgraphData = {
  /**
   * Source type of the subgraph - "templates" for workflow templates or "custom_node" for custom node subgraphs
   */
  source: string
  /**
   * Display name of the subgraph blueprint
   */
  name: string
  /**
   * Additional information about the subgraph
   */
  info: {
    /**
     * The node pack/module that provides this subgraph
     */
    node_pack: string
  }
  /**
   * The full subgraph JSON data as a string
   */
  data: string
}

/**
 * Metadata for a global subgraph blueprint (without full data)
 */
export type GlobalSubgraphInfo = {
  /**
   * Source type of the subgraph - "templates" for workflow templates or "custom_node" for custom node subgraphs
   */
  source: string
  /**
   * Display name of the subgraph blueprint
   */
  name: string
  /**
   * Additional information about the subgraph
   */
  info: {
    /**
     * The node pack/module that provides this subgraph
     */
    node_pack: string
  }
  /**
   * The full subgraph JSON data (may be empty in list view)
   */
  data?: string
}

/**
 * Metadata describing a single ComfyUI node type and its inputs/outputs.
 */
export type NodeInfo = {
  /**
   * Input specifications for the node
   */
  input?: {
    [key: string]: unknown
  }
  /**
   * Order of inputs for display
   */
  input_order?: {
    [key: string]: Array<string>
  }
  /**
   * Output types of the node
   */
  output?: Array<string>
  /**
   * Whether each output is a list
   */
  output_is_list?: Array<boolean>
  /**
   * Names of the outputs
   */
  output_name?: Array<string>
  /**
   * Internal name of the node
   */
  name?: string
  /**
   * Display name of the node
   */
  display_name?: string
  /**
   * Description of the node
   */
  description?: string
  /**
   * Python module implementing the node
   */
  python_module?: string
  /**
   * Category of the node
   */
  category?: string
  /**
   * Whether this is an output node
   */
  output_node?: boolean
  /**
   * Tooltips for outputs
   */
  output_tooltips?: Array<string>
  /**
   * Whether the node is deprecated
   */
  deprecated?: boolean
  /**
   * Whether the node is experimental
   */
  experimental?: boolean
  /**
   * Whether this is an API node
   */
  api_node?: boolean
}

/**
 * Metadata about the currently running and queued prompts.
 */
export type PromptInfo = {
  exec_info?: {
    /**
     * Number of items remaining in the queue
     */
    queue_remaining?: number
  }
}

/**
 * Response containing a signed download URL for an exported asset archive.
 */
export type ExportDownloadUrlResponse = {
  /**
   * Signed URL for downloading the export ZIP file
   */
  url: string
  /**
   * When the signed URL expires
   */
  expires_at?: string
}

/**
 * Response returned after successfully queuing a workflow prompt.
 */
export type PromptResponse = {
  /**
   * Unique identifier for the prompt execution
   */
  prompt_id?: string
  /**
   * Priority number in the queue
   */
  number?: number
  /**
   * Any errors in the nodes of the prompt
   */
  node_errors?: {
    [key: string]: unknown
  }
}

/**
 * Request body for submitting a ComfyUI workflow prompt for execution.
 */
export type PromptRequest = {
  /**
   * The workflow graph to execute
   */
  prompt: {
    [key: string]: unknown
  }
  /**
   * Priority number for the queue (lower numbers have higher priority)
   */
  number?: number
  /**
   * If true, adds the prompt to the front of the queue
   */
  front?: boolean
  /**
   * Extra data to be associated with the prompt
   */
  extra_data?: {
    [key: string]: unknown
  }
  /**
   * List of node names to execute
   */
  partial_execution_targets?: Array<string>
  /**
   * UUID identifying the cloud workflow entity to associate with this job
   */
  workflow_id?: string
  /**
   * UUID identifying the workflow version to associate with this job
   */
  workflow_version_id?: string
}

/**
 * Paginated list of assets belonging to the authenticated user.
 */
export type ListAssetsResponseWritable = {
  /**
   * List of assets matching the query
   */
  assets: Array<AssetWritable>
  /**
   * Total number of assets matching the filters
   */
  total: number
  /**
   * Whether more assets are available beyond this page
   */
  has_more: boolean
  /**
   * Opaque cursor to pass as the `after` query parameter to fetch the
   * next page. Omitted from the response when there are no more results.
   *
   */
  next_cursor?: string
}

/**
 * Represents a user-owned asset (image, video, or other generated output).
 */
export type AssetWritable = {
  /**
   * Unique identifier for the asset
   */
  id: string
  /**
   * Name of the asset file
   */
  name: string
  /**
   * Display name of the asset. Mirrors name for backwards compatibility.
   */
  display_name?: string | null
  /**
   * Blake3 hash of the asset content.
   */
  hash?: string
  /**
   * Size of the asset in bytes
   */
  size?: number
  /**
   * MIME type of the asset
   */
  mime_type?: string
  /**
   * Tags associated with the asset
   */
  tags?: Array<string>
  /**
   * Custom user metadata for the asset
   */
  user_metadata?: {
    [key: string]: unknown
  }
  /**
   * URL for asset preview/thumbnail
   */
  preview_url?: string
  /**
   * ID of the preview asset if available
   */
  preview_id?: string | null
  /**
   * ID of the job that created this asset, if available
   */
  job_id?: string | null
  /**
   * Timestamp when the asset was created
   */
  created_at: string
  /**
   * Timestamp when the asset was last updated
   */
  updated_at: string
  /**
   * Timestamp when the asset was last accessed
   */
  last_access_time?: string
  /**
   * Whether this asset is immutable (cannot be modified or deleted)
   */
  is_immutable?: boolean
}

/**
 * Response returned when a new asset is successfully created.
 */
export type AssetCreatedWritable = AssetWritable & {
  /**
   * Whether this was a new asset creation (true) or returned existing (false)
   */
  created_new: boolean
}

/**
 * Response after submitting feedback
 */
export type FeedbackResponseWritable = {
  [key: string]: unknown
}

export type GetPromptInfoData = {
  body?: never
  path?: never
  query?: never
  url: '/api/prompt'
}

export type GetPromptInfoErrors = {
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type GetPromptInfoError = GetPromptInfoErrors[keyof GetPromptInfoErrors]

export type GetPromptInfoResponses = {
  /**
   * Success
   */
  200: PromptInfo
}

export type GetPromptInfoResponse =
  GetPromptInfoResponses[keyof GetPromptInfoResponses]

export type ExecutePromptData = {
  body: PromptRequest
  path?: never
  query?: never
  url: '/api/prompt'
}

export type ExecutePromptErrors = {
  /**
   * Invalid prompt
   */
  400: PromptErrorResponse
  /**
   * Payment required - Insufficient credits
   */
  402: PromptErrorResponse
  /**
   * Payment required - User has not paid
   */
  429: PromptErrorResponse
  /**
   * Internal server error
   */
  500: PromptErrorResponse
  /**
   * Service unavailable
   */
  503: PromptErrorResponse
}

export type ExecutePromptError = ExecutePromptErrors[keyof ExecutePromptErrors]

export type ExecutePromptResponses = {
  /**
   * Success - Prompt accepted
   */
  200: PromptResponse
}

export type ExecutePromptResponse =
  ExecutePromptResponses[keyof ExecutePromptResponses]

export type GetNodeInfoData = {
  body?: never
  path?: never
  query?: never
  url: '/api/object_info'
}

export type GetNodeInfoResponses = {
  /**
   * Success
   */
  200: {
    [key: string]: NodeInfo
  }
}

export type GetNodeInfoResponse =
  GetNodeInfoResponses[keyof GetNodeInfoResponses]

export type GetFeaturesData = {
  body?: never
  path?: never
  query?: never
  url: '/api/features'
}

export type GetFeaturesResponses = {
  /**
   * Success
   */
  200: {
    /**
     * Whether the server supports preview metadata
     */
    supports_preview_metadata?: boolean
    /**
     * Maximum upload size in bytes
     */
    max_upload_size?: number
    [key: string]: unknown | boolean | number | undefined
  }
}

export type GetFeaturesResponse =
  GetFeaturesResponses[keyof GetFeaturesResponses]

export type GetNodeReplacementsData = {
  body?: never
  path?: never
  query?: never
  url: '/api/node_replacements'
}

export type GetNodeReplacementsErrors = {
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type GetNodeReplacementsError =
  GetNodeReplacementsErrors[keyof GetNodeReplacementsErrors]

export type GetNodeReplacementsResponses = {
  /**
   * Success - Node replacement mappings
   */
  200: {
    [key: string]: unknown
  }
}

export type GetNodeReplacementsResponse =
  GetNodeReplacementsResponses[keyof GetNodeReplacementsResponses]

export type GetWorkflowTemplatesData = {
  body?: never
  path?: never
  query?: never
  url: '/api/workflow_templates'
}

export type GetWorkflowTemplatesResponses = {
  /**
   * Empty object for workflow templates
   */
  200: {
    [key: string]: unknown
  }
}

export type GetWorkflowTemplatesResponse =
  GetWorkflowTemplatesResponses[keyof GetWorkflowTemplatesResponses]

export type GetGlobalSubgraphsData = {
  body?: never
  path?: never
  query?: never
  url: '/api/global_subgraphs'
}

export type GetGlobalSubgraphsErrors = {
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type GetGlobalSubgraphsError =
  GetGlobalSubgraphsErrors[keyof GetGlobalSubgraphsErrors]

export type GetGlobalSubgraphsResponses = {
  /**
   * Success - Map of subgraph IDs to their metadata
   */
  200: {
    [key: string]: GlobalSubgraphInfo
  }
}

export type GetGlobalSubgraphsResponse =
  GetGlobalSubgraphsResponses[keyof GetGlobalSubgraphsResponses]

export type GetGlobalSubgraphData = {
  body?: never
  path: {
    /**
     * The unique identifier of the subgraph blueprint
     */
    id: string
  }
  query?: never
  url: '/api/global_subgraphs/{id}'
}

export type GetGlobalSubgraphErrors = {
  /**
   * Subgraph not found
   */
  404: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type GetGlobalSubgraphError =
  GetGlobalSubgraphErrors[keyof GetGlobalSubgraphErrors]

export type GetGlobalSubgraphResponses = {
  /**
   * Success - Full subgraph data
   */
  200: GlobalSubgraphData
}

export type GetGlobalSubgraphResponse =
  GetGlobalSubgraphResponses[keyof GetGlobalSubgraphResponses]

export type GetModelFoldersData = {
  body?: never
  path?: never
  query?: never
  url: '/api/experiment/models'
}

export type GetModelFoldersErrors = {
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type GetModelFoldersError =
  GetModelFoldersErrors[keyof GetModelFoldersErrors]

export type GetModelFoldersResponses = {
  /**
   * Success - List of model folders
   */
  200: Array<ModelFolder>
}

export type GetModelFoldersResponse =
  GetModelFoldersResponses[keyof GetModelFoldersResponses]

export type GetModelsInFolderData = {
  body?: never
  path: {
    /**
     * The folder name to list models from
     */
    folder: string
  }
  query?: never
  url: '/api/experiment/models/{folder}'
}

export type GetModelsInFolderErrors = {
  /**
   * Folder not found or no models in folder
   */
  404: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type GetModelsInFolderError =
  GetModelsInFolderErrors[keyof GetModelsInFolderErrors]

export type GetModelsInFolderResponses = {
  /**
   * Success - List of models in the folder
   */
  200: Array<ModelFile>
}

export type GetModelsInFolderResponse =
  GetModelsInFolderResponses[keyof GetModelsInFolderResponses]

export type GetLegacyHistoryData = {
  body?: never
  path?: never
  query?: never
  url: '/api/history'
}

export type GetLegacyHistoryErrors = {
  /**
   * Not Found — use /api/history_v2 instead
   */
  404: unknown
}

export type ManageHistoryData = {
  body: HistoryManageRequest
  path?: never
  query?: never
  url: '/api/history'
}

export type ManageHistoryErrors = {
  /**
   * Invalid request parameters
   */
  400: ErrorResponse
  /**
   * Unauthorized - Authentication required
   */
  401: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type ManageHistoryError = ManageHistoryErrors[keyof ManageHistoryErrors]

export type ManageHistoryResponses = {
  /**
   * Success - History management operation completed
   */
  200: unknown
}

export type GetHistoryData = {
  body?: never
  path?: never
  query?: {
    /**
     * Maximum number of items to return
     */
    max_items?: number
    /**
     * Starting position (default 0)
     */
    offset?: number
  }
  url: '/api/history_v2'
}

export type GetHistoryErrors = {
  /**
   * Unauthorized - Authentication required
   */
  401: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type GetHistoryError = GetHistoryErrors[keyof GetHistoryErrors]

export type GetHistoryResponses = {
  /**
   * Success - Execution history retrieved
   */
  200: HistoryResponse
}

export type GetHistoryResponse = GetHistoryResponses[keyof GetHistoryResponses]

export type GetHistoryForPromptData = {
  body?: never
  path: {
    /**
     * The prompt ID to retrieve history for
     */
    prompt_id: string
  }
  query?: never
  url: '/api/history_v2/{prompt_id}'
}

export type GetHistoryForPromptErrors = {
  /**
   * Unauthorized - Authentication required
   */
  401: ErrorResponse
  /**
   * Prompt not found
   */
  404: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type GetHistoryForPromptError =
  GetHistoryForPromptErrors[keyof GetHistoryForPromptErrors]

export type GetHistoryForPromptResponses = {
  /**
   * Success - History for prompt retrieved
   */
  200: HistoryDetailResponse
}

export type GetHistoryForPromptResponse =
  GetHistoryForPromptResponses[keyof GetHistoryForPromptResponses]

export type ListJobsData = {
  body?: never
  path?: never
  query?: {
    /**
     * Filter by one or more statuses (comma-separated). If not provided, returns all jobs.
     */
    status?: string
    /**
     * Filter by workflow ID (exact match)
     */
    workflow_id?: string
    /**
     * Filter by output media type (only applies to completed jobs with outputs)
     */
    output_type?: 'image' | 'video' | 'audio' | '3d'
    /**
     * Field to sort by (create_time = when job was submitted, execution_time = how long workflow took to run)
     */
    sort_by?: 'create_time' | 'execution_time'
    /**
     * Sort direction (asc = ascending, desc = descending)
     */
    sort_order?: 'asc' | 'desc'
    /**
     * Pagination offset (0-based)
     */
    offset?: number
    /**
     * Maximum items per page (1-1000)
     */
    limit?: number
  }
  url: '/api/jobs'
}

export type ListJobsErrors = {
  /**
   * Unauthorized - Authentication required
   */
  401: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type ListJobsError = ListJobsErrors[keyof ListJobsErrors]

export type ListJobsResponses = {
  /**
   * Success - Jobs retrieved
   */
  200: JobsListResponse
}

export type ListJobsResponse = ListJobsResponses[keyof ListJobsResponses]

export type GetJobDetailData = {
  body?: never
  path: {
    /**
     * Job identifier (UUID)
     */
    job_id: string
  }
  query?: never
  url: '/api/jobs/{job_id}'
}

export type GetJobDetailErrors = {
  /**
   * Unauthorized - Authentication required
   */
  401: ErrorResponse
  /**
   * Forbidden - Job does not belong to user
   */
  403: ErrorResponse
  /**
   * Job not found
   */
  404: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type GetJobDetailError = GetJobDetailErrors[keyof GetJobDetailErrors]

export type GetJobDetailResponses = {
  /**
   * Success - Job details retrieved
   */
  200: JobDetailResponse
}

export type GetJobDetailResponse =
  GetJobDetailResponses[keyof GetJobDetailResponses]

export type CancelJobData = {
  body?: never
  path: {
    /**
     * Job identifier (UUID)
     */
    job_id: string
  }
  query?: never
  url: '/api/jobs/{job_id}/cancel'
}

export type CancelJobErrors = {
  /**
   * Bad Request - job_id is not a valid UUID (emitted by request validation before the handler runs)
   */
  400: ErrorResponse
  /**
   * Unauthorized - Authentication required
   */
  401: ErrorResponse
  /**
   * Job not found for this user
   */
  404: ErrorResponse
  /**
   * Internal server error - cancellation failed
   */
  500: ErrorResponse
}

export type CancelJobError = CancelJobErrors[keyof CancelJobErrors]

export type CancelJobResponses = {
  /**
   * Success - Cancel request accepted (or job was already terminal)
   */
  200: JobCancelResponse
}

export type CancelJobResponse = CancelJobResponses[keyof CancelJobResponses]

export type ViewFileData = {
  body?: never
  path?: never
  query: {
    /**
     * Name of the file to view
     */
    filename: string
    /**
     * Subfolder path where the file is located
     */
    subfolder?: string
    /**
     * Type of file (e.g., output, input, temp)
     */
    type?: string
    /**
     * Full path to the file (used for temp files)
     */
    fullpath?: string
    /**
     * Format of the file
     */
    format?: string
    /**
     * Frame rate for video files
     */
    frame_rate?: number
    /**
     * Workflow identifier
     */
    workflow?: string
    /**
     * Timestamp parameter
     */
    timestamp?: number
    /**
     * Image channel to extract from PNG images.
     * - 'rgb': Return only RGB channels (alpha set to fully opaque)
     * - 'a' or 'alpha': Return alpha channel as grayscale image
     * - If not specified, return original image unchanged via redirect
     *
     */
    channel?: string
    /**
     * Maximum dimension (width or height) to resize the image to, preserving aspect ratio.
     * The image is fit within a res x res box. Returns a JPEG thumbnail.
     * Only applies to raster image files (PNG, JPEG, WebP, GIF).
     *
     */
    res?: number
  }
  url: '/api/view'
}

export type ViewFileErrors = {
  /**
   * Invalid request parameters
   */
  400: ErrorResponse
  /**
   * File not found or unauthorized
   */
  404: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type ViewFileError = ViewFileErrors[keyof ViewFileErrors]

export type ViewFileResponses = {
  /**
   * Processed PNG image with extracted channel
   */
  200: Blob | File
}

export type ViewFileResponse = ViewFileResponses[keyof ViewFileResponses]

export type GetMaskLayersData = {
  body?: never
  path?: never
  query: {
    /**
     * Hash filename of any mask layer file
     */
    filename: string
  }
  url: '/api/files/mask-layers'
}

export type GetMaskLayersErrors = {
  /**
   * File not found or not a mask file
   */
  404: ErrorResponse
}

export type GetMaskLayersError = GetMaskLayersErrors[keyof GetMaskLayersErrors]

export type GetMaskLayersResponses = {
  /**
   * Success - Related mask layers returned
   */
  200: {
    /**
     * Filename of the mask layer
     */
    mask?: string | null
    /**
     * Filename of the paint strokes layer
     */
    paint?: string | null
    /**
     * Filename of the painted image layer
     */
    painted?: string | null
    /**
     * Filename of the final composite layer
     */
    painted_masked?: string | null
  }
}

export type GetMaskLayersResponse =
  GetMaskLayersResponses[keyof GetMaskLayersResponses]

export type GetFilesData = {
  body?: never
  path: {
    /**
     * Type of directory to list files from
     */
    directory_type: 'output' | 'input' | 'temp'
  }
  query?: never
  url: '/internal/files/{directory_type}'
}

export type GetFilesErrors = {
  /**
   * Invalid directory type
   */
  400: ErrorResponse
}

export type GetFilesError = GetFilesErrors[keyof GetFilesErrors]

export type GetFilesResponses = {
  /**
   * Array of file names sorted by modification time (newest first)
   */
  200: Array<string>
}

export type GetFilesResponse = GetFilesResponses[keyof GetFilesResponses]

export type ListAssetsData = {
  body?: never
  path?: never
  query?: {
    /**
     * Filter assets that have ALL of these tags
     */
    include_tags?: Array<string>
    /**
     * Exclude assets that have ANY of these tags
     */
    exclude_tags?: Array<string>
    /**
     * Filter assets where name contains this substring (case-insensitive)
     */
    name_contains?: string
    /**
     * JSON object for filtering by metadata fields
     */
    metadata_filter?: string
    /**
     * Maximum number of assets to return (1-500)
     */
    limit?: number
    /**
     * Number of assets to skip for pagination
     */
    offset?: number
    /**
     * Field to sort by
     */
    sort?: 'name' | 'created_at' | 'updated_at' | 'size' | 'last_access_time'
    /**
     * Sort order
     */
    order?: 'asc' | 'desc'
    /**
     * Whether to include public/shared assets in results
     */
    include_public?: boolean
    /**
     * Filter assets by exact content hash.
     */
    hash?: string
    /**
     * Opaque cursor for keyset pagination. Pass the `next_cursor` value
     * from the previous response to fetch the next page. When provided,
     * `offset` is ignored. Cursor pagination is only supported with
     * `sort` values `created_at`, `updated_at`, `name`, or `size`;
     * requests combining `after` with other sort fields return 400.
     * The cursor must have been minted under the same `sort` value used
     * in the follow-up request.
     *
     */
    after?: string
  }
  url: '/api/assets'
}

export type ListAssetsErrors = {
  /**
   * Invalid request parameters
   */
  400: ErrorResponse
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type ListAssetsError = ListAssetsErrors[keyof ListAssetsErrors]

export type ListAssetsResponses = {
  /**
   * Success - Assets returned
   */
  200: ListAssetsResponse
}

export type ListAssetsResponse2 = ListAssetsResponses[keyof ListAssetsResponses]

export type CreateAssetData = {
  body: {
    /**
     * The asset file to upload
     */
    file: Blob | File
    /**
     * Content hash of the file.
     */
    hash?: string
    /**
     * JSON-encoded array of freeform tag strings, e.g. '["models","checkpoint"]'. Common types include "models", "input", "output", and "temp", but any tag can be used in any order.
     */
    tags?: string
    /**
     * Optional asset ID for idempotent creation. If provided and asset exists, returns existing asset.
     */
    id?: string
    /**
     * Optional preview asset ID. If not provided, images will use their own ID as preview.
     */
    preview_id?: string
    /**
     * Display name for the asset
     */
    name?: string
    /**
     * MIME type of the asset (e.g., "image/png", "video/mp4")
     */
    mime_type?: string
    /**
     * Custom JSON metadata as a string
     */
    user_metadata?: string
  }
  path?: never
  query?: never
  url: '/api/assets'
}

export type CreateAssetErrors = {
  /**
   * Invalid request (bad file, invalid content type, etc.)
   */
  400: ErrorResponse
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * File too large
   */
  413: ErrorResponse
  /**
   * Unsupported media type
   */
  415: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type CreateAssetError = CreateAssetErrors[keyof CreateAssetErrors]

export type CreateAssetResponses = {
  /**
   * Asset created successfully
   */
  201: AssetCreated
}

export type CreateAssetResponse =
  CreateAssetResponses[keyof CreateAssetResponses]

export type CreateAssetFromHashData = {
  body: {
    /**
     * Hash of the existing asset. Supports Blake3 (blake3:) or SHA256 (sha256:) formats
     */
    hash: string
    /**
     * Display name for the asset reference (optional)
     */
    name?: string
    /**
     * Freeform tags for the asset. Common types include "models", "input", "output", and "temp", but any tag can be used in any order.
     */
    tags: Array<string>
    /**
     * MIME type of the asset (e.g., "image/png", "video/mp4")
     */
    mime_type?: string
    /**
     * Custom metadata for this asset reference
     */
    user_metadata?: {
      [key: string]: unknown
    }
  }
  path?: never
  query?: never
  url: '/api/assets/from-hash'
}

export type CreateAssetFromHashErrors = {
  /**
   * Invalid request (bad hash format, invalid tags, etc.)
   */
  400: ErrorResponse
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Source asset with given hash not found
   */
  404: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type CreateAssetFromHashError =
  CreateAssetFromHashErrors[keyof CreateAssetFromHashErrors]

export type CreateAssetFromHashResponses = {
  /**
   * Asset reference created successfully
   */
  201: AssetCreated
}

export type CreateAssetFromHashResponse =
  CreateAssetFromHashResponses[keyof CreateAssetFromHashResponses]

export type GetRemoteAssetMetadataData = {
  body?: never
  path?: never
  query: {
    /**
     * Download URL to retrieve metadata from
     */
    url: string
  }
  url: '/api/assets/remote-metadata'
}

export type GetRemoteAssetMetadataErrors = {
  /**
   * Invalid URL or missing required parameter
   */
  400: ErrorResponse
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Failed to retrieve metadata from source
   */
  422: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type GetRemoteAssetMetadataError =
  GetRemoteAssetMetadataErrors[keyof GetRemoteAssetMetadataErrors]

export type GetRemoteAssetMetadataResponses = {
  /**
   * Metadata retrieved successfully
   */
  200: AssetMetadataResponse
}

export type GetRemoteAssetMetadataResponse =
  GetRemoteAssetMetadataResponses[keyof GetRemoteAssetMetadataResponses]

export type CreateAssetDownloadData = {
  body: {
    /**
     * URL of the file to download (must be from huggingface.co, civitai.com, or civitai.red)
     */
    source_url: string
    /**
     * Optional tags for the asset (e.g., ["model", "checkpoint"])
     */
    tags?: Array<string>
    /**
     * Optional user-defined metadata to attach to the asset
     */
    user_metadata?: {
      [key: string]: unknown
    }
    /**
     * Optional preview asset ID to associate with the downloaded asset
     */
    preview_id?: string
  }
  path?: never
  query?: never
  url: '/api/assets/download'
}

export type CreateAssetDownloadErrors = {
  /**
   * Invalid URL or unsupported source
   */
  400: ErrorResponse
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Validation errors
   */
  422: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type CreateAssetDownloadError =
  CreateAssetDownloadErrors[keyof CreateAssetDownloadErrors]

export type CreateAssetDownloadResponses = {
  /**
   * File already exists in storage - asset created/returned immediately
   */
  200: AssetCreated
  /**
   * Accepted - Download task created and processing in background
   */
  202: AssetDownloadResponse
}

export type CreateAssetDownloadResponse =
  CreateAssetDownloadResponses[keyof CreateAssetDownloadResponses]

export type CreateAssetExportData = {
  body: {
    /**
     * Job IDs whose output assets are included in the ZIP bundle. Preview assets of these jobs are additionally included when `include_previews` is true.
     */
    job_ids?: Array<string>
    /**
     * Asset IDs to include in the ZIP bundle. Supports input, output, and available temp assets. Additive to output assets associated with provided job IDs.
     */
    asset_ids?: Array<string>
    /**
     * Strategy for naming files in the ZIP:
     * - group_by_job_id: Group assets by job ID as a parent directory (e.g., "833a1b5c-beab-436a-ae8e-f07e7cd7b2c4/ComfyUI_00001_.png")
     * - preserve: Use original asset names, skip duplicates (first one wins)
     * - asset_id: Use the asset ID as the filename (e.g., "833a1b5c-beab-436a-ae8e-f07e7cd7b2c4.png")
     * - group_by_job_time: Group by job creation timestamp (e.g., "2026-03-26T16-13-00/ComfyUI_00001_.png")
     *
     */
    naming_strategy?:
      | 'group_by_job_id'
      | 'preserve'
      | 'asset_id'
      | 'group_by_job_time'
    /**
     * Optional per-job asset name filters. When provided for a job ID,
     * only assets whose name matches one of the specified names are included.
     * Job IDs present in `job_ids` but absent from this map include their output assets (plus previews when `include_previews` is true).
     *
     */
    job_asset_name_filters?: {
      [key: string]: Array<string>
    }
    /**
     * When true, preview assets attached to the provided job_ids are included in the export. No effect on asset_ids. Preview assets are placed under a `previews/` subfolder in group-by-job layouts.
     */
    include_previews?: boolean
  }
  path?: never
  query?: never
  url: '/api/assets/export'
}

export type CreateAssetExportErrors = {
  /**
   * Invalid request
   */
  400: ErrorResponse
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type CreateAssetExportError =
  CreateAssetExportErrors[keyof CreateAssetExportErrors]

export type CreateAssetExportResponses = {
  /**
   * Accepted - Export task created and processing in background
   */
  202: AssetDownloadResponse
}

export type CreateAssetExportResponse =
  CreateAssetExportResponses[keyof CreateAssetExportResponses]

export type DownloadExportData = {
  body?: never
  path: {
    /**
     * Export filename with extension (e.g., "021e55cd-9785-4ac7-ac39-f4010138e3bc.zip")
     */
    exportName: string
  }
  query?: never
  url: '/api/assets/exports/{exportName}'
}

export type DownloadExportErrors = {
  /**
   * Invalid export name
   */
  400: ErrorResponse
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Export not found or not owned by user
   */
  404: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type DownloadExportError =
  DownloadExportErrors[keyof DownloadExportErrors]

export type DownloadExportResponses = {
  /**
   * Signed URL for downloading the export
   */
  200: ExportDownloadUrlResponse
}

export type DownloadExportResponse =
  DownloadExportResponses[keyof DownloadExportResponses]

export type DeleteAssetData = {
  body?: never
  path: {
    /**
     * Asset ID
     */
    id: string
  }
  query?: never
  url: '/api/assets/{id}'
}

export type DeleteAssetErrors = {
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Asset not found
   */
  404: ErrorResponse
  /**
   * Asset cannot be deleted because it is referenced by another resource (e.g., workflow version)
   */
  409: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type DeleteAssetError = DeleteAssetErrors[keyof DeleteAssetErrors]

export type DeleteAssetResponses = {
  /**
   * Asset record deleted successfully
   */
  204: void
}

export type DeleteAssetResponse =
  DeleteAssetResponses[keyof DeleteAssetResponses]

export type GetAssetByIdData = {
  body?: never
  path: {
    /**
     * Asset ID
     */
    id: string
  }
  query?: never
  url: '/api/assets/{id}'
}

export type GetAssetByIdErrors = {
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Asset not found
   */
  404: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type GetAssetByIdError = GetAssetByIdErrors[keyof GetAssetByIdErrors]

export type GetAssetByIdResponses = {
  /**
   * Asset details retrieved successfully
   */
  200: Asset
}

export type GetAssetByIdResponse =
  GetAssetByIdResponses[keyof GetAssetByIdResponses]

export type UpdateAssetData = {
  body: {
    /**
     * New display name for the asset
     */
    name?: string
    /**
     * Updated MIME type of the asset
     */
    mime_type?: string
    /**
     * Updated preview asset ID
     */
    preview_id?: string
    /**
     * Updated custom metadata
     */
    user_metadata?: {
      [key: string]: unknown
    }
  }
  path: {
    /**
     * Asset ID
     */
    id: string
  }
  query?: never
  url: '/api/assets/{id}'
}

export type UpdateAssetErrors = {
  /**
   * Invalid request (no fields provided)
   */
  400: ErrorResponse
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Asset not found
   */
  404: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type UpdateAssetError = UpdateAssetErrors[keyof UpdateAssetErrors]

export type UpdateAssetResponses = {
  /**
   * Asset updated successfully
   */
  200: AssetUpdated
}

export type UpdateAssetResponse =
  UpdateAssetResponses[keyof UpdateAssetResponses]

export type RemoveAssetTagsData = {
  body: {
    /**
     * Tags to remove from the asset
     */
    tags: Array<string>
  }
  path: {
    /**
     * Asset ID
     */
    id: string
  }
  query?: never
  url: '/api/assets/{id}/tags'
}

export type RemoveAssetTagsErrors = {
  /**
   * Invalid request
   */
  400: ErrorResponse
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Asset not found
   */
  404: ErrorResponse
  /**
   * Validation error (e.g., reserved tag)
   */
  422: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type RemoveAssetTagsError =
  RemoveAssetTagsErrors[keyof RemoveAssetTagsErrors]

export type RemoveAssetTagsResponses = {
  /**
   * Tags removed successfully
   */
  200: TagsModificationResponse
}

export type RemoveAssetTagsResponse =
  RemoveAssetTagsResponses[keyof RemoveAssetTagsResponses]

export type AddAssetTagsData = {
  body: {
    /**
     * Tags to add to the asset
     */
    tags: Array<string>
  }
  path: {
    /**
     * Asset ID
     */
    id: string
  }
  query?: never
  url: '/api/assets/{id}/tags'
}

export type AddAssetTagsErrors = {
  /**
   * Invalid request
   */
  400: ErrorResponse
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Asset not found
   */
  404: ErrorResponse
  /**
   * Validation error (e.g., reserved tag)
   */
  422: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type AddAssetTagsError = AddAssetTagsErrors[keyof AddAssetTagsErrors]

export type AddAssetTagsResponses = {
  /**
   * Tags added successfully
   */
  200: TagsModificationResponse
}

export type AddAssetTagsResponse =
  AddAssetTagsResponses[keyof AddAssetTagsResponses]

export type ListTagsData = {
  body?: never
  path?: never
  query?: {
    /**
     * Filter tags by prefix
     */
    prefix?: string
    /**
     * Maximum number of tags to return (1-1000)
     */
    limit?: number
    /**
     * Number of tags to skip for pagination
     */
    offset?: number
    /**
     * Sort order for tags
     */
    order?: 'count_desc' | 'name_asc'
    /**
     * Include tags with zero usage count
     */
    include_zero?: boolean
    /**
     * Whether to include public/shared assets when counting tags
     */
    include_public?: boolean
  }
  url: '/api/tags'
}

export type ListTagsErrors = {
  /**
   * Invalid request parameters
   */
  400: ErrorResponse
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type ListTagsError = ListTagsErrors[keyof ListTagsErrors]

export type ListTagsResponses = {
  /**
   * Tags retrieved successfully
   */
  200: ListTagsResponse
}

export type ListTagsResponse2 = ListTagsResponses[keyof ListTagsResponses]

export type GetAssetTagHistogramData = {
  body?: never
  path?: never
  query?: {
    /**
     * Filter assets that have ALL of these tags
     */
    include_tags?: Array<string>
    /**
     * Exclude assets that have ANY of these tags
     */
    exclude_tags?: Array<string>
    /**
     * Filter assets where name contains this substring (case-insensitive)
     */
    name_contains?: string
    /**
     * JSON object for filtering by metadata fields
     */
    metadata_filter?: string
    /**
     * Maximum number of tags to return (1-1000, default 100)
     */
    limit?: number
    /**
     * Whether to include public/shared assets in results
     */
    include_public?: boolean
  }
  url: '/api/assets/tags/refine'
}

export type GetAssetTagHistogramErrors = {
  /**
   * Invalid request parameters
   */
  400: ErrorResponse
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type GetAssetTagHistogramError =
  GetAssetTagHistogramErrors[keyof GetAssetTagHistogramErrors]

export type GetAssetTagHistogramResponses = {
  /**
   * Success - Tag histogram returned
   */
  200: AssetTagHistogramResponse
}

export type GetAssetTagHistogramResponse =
  GetAssetTagHistogramResponses[keyof GetAssetTagHistogramResponses]

export type CheckAssetByHashData = {
  body?: never
  path: {
    /**
     * Blake3 hash of the asset in format 'blake3:hex_digest'
     */
    hash: string
  }
  query?: never
  url: '/api/assets/hash/{hash}'
}

export type CheckAssetByHashErrors = {
  /**
   * Invalid hash format
   */
  400: ErrorResponse
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Asset not found
   */
  404: unknown
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type CheckAssetByHashError =
  CheckAssetByHashErrors[keyof CheckAssetByHashErrors]

export type CheckAssetByHashResponses = {
  /**
   * Asset exists
   */
  200: unknown
}

export type PostAssetsFromWorkflowData = {
  body: WorkflowApiAssetsRequest
  path?: never
  query?: never
  url: '/api/assets/from-workflow'
}

export type PostAssetsFromWorkflowErrors = {
  /**
   * Bad request
   */
  400: ErrorResponse
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Not found
   */
  404: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type PostAssetsFromWorkflowError =
  PostAssetsFromWorkflowErrors[keyof PostAssetsFromWorkflowErrors]

export type PostAssetsFromWorkflowResponses = {
  /**
   * Success
   */
  200: WorkflowApiAssetsResponse
}

export type PostAssetsFromWorkflowResponse =
  PostAssetsFromWorkflowResponses[keyof PostAssetsFromWorkflowResponses]

export type ImportPublishedAssetsData = {
  body: ImportPublishedAssetsRequest
  path?: never
  query?: never
  url: '/api/assets/import'
}

export type ImportPublishedAssetsErrors = {
  /**
   * Bad request
   */
  400: ErrorResponse
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type ImportPublishedAssetsError =
  ImportPublishedAssetsErrors[keyof ImportPublishedAssetsErrors]

export type ImportPublishedAssetsResponses = {
  /**
   * Successfully imported assets
   */
  200: ImportPublishedAssetsResponse
}

export type ImportPublishedAssetsResponse2 =
  ImportPublishedAssetsResponses[keyof ImportPublishedAssetsResponses]

export type GetQueueInfoData = {
  body?: never
  path?: never
  query?: never
  url: '/api/queue'
}

export type GetQueueInfoErrors = {
  /**
   * Invalid request parameters
   */
  400: ErrorResponse
  /**
   * Invalid request parameters
   */
  500: ErrorResponse
}

export type GetQueueInfoError = GetQueueInfoErrors[keyof GetQueueInfoErrors]

export type GetQueueInfoResponses = {
  /**
   * Success
   */
  200: QueueInfo
}

export type GetQueueInfoResponse =
  GetQueueInfoResponses[keyof GetQueueInfoResponses]

export type ManageQueueData = {
  body: QueueManageRequest
  path?: never
  query?: never
  url: '/api/queue'
}

export type ManageQueueErrors = {
  /**
   * Invalid request parameters
   */
  400: ErrorResponse
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type ManageQueueError = ManageQueueErrors[keyof ManageQueueErrors]

export type ManageQueueResponses = {
  /**
   * Success
   */
  200: QueueManageResponse
}

export type ManageQueueResponse =
  ManageQueueResponses[keyof ManageQueueResponses]

export type InterruptJobData = {
  body?: never
  path?: never
  query?: never
  url: '/api/interrupt'
}

export type InterruptJobErrors = {
  /**
   * Unauthorized - Authentication required
   */
  401: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type InterruptJobError = InterruptJobErrors[keyof InterruptJobErrors]

export type InterruptJobResponses = {
  /**
   * Success - Job interrupted or no running job found
   */
  200: unknown
}

export type ListSecretsData = {
  body?: never
  path?: never
  query?: never
  url: '/api/secrets'
}

export type ListSecretsErrors = {
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
  /**
   * Service unavailable - feature is disabled
   */
  503: ErrorResponse
}

export type ListSecretsError = ListSecretsErrors[keyof ListSecretsErrors]

export type ListSecretsResponses = {
  /**
   * Success
   */
  200: SecretListResponse
}

export type ListSecretsResponse =
  ListSecretsResponses[keyof ListSecretsResponses]

export type CreateSecretData = {
  body: CreateSecretRequest
  path?: never
  query?: never
  url: '/api/secrets'
}

export type CreateSecretErrors = {
  /**
   * Invalid request
   */
  400: ErrorResponse
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Conflict - secret with this name or provider already exists
   */
  409: ErrorResponse
  /**
   * Validation error
   */
  422: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
  /**
   * Service unavailable - secrets feature disabled
   */
  503: ErrorResponse
}

export type CreateSecretError = CreateSecretErrors[keyof CreateSecretErrors]

export type CreateSecretResponses = {
  /**
   * Secret created successfully
   */
  201: SecretResponse
}

export type CreateSecretResponse =
  CreateSecretResponses[keyof CreateSecretResponses]

export type DeleteSecretData = {
  body?: never
  path: {
    /**
     * The UUID of the secret
     */
    id: string
  }
  query?: never
  url: '/api/secrets/{id}'
}

export type DeleteSecretErrors = {
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Forbidden - user does not own this secret
   */
  403: ErrorResponse
  /**
   * Secret not found
   */
  404: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
  /**
   * Service unavailable - secrets feature disabled
   */
  503: ErrorResponse
}

export type DeleteSecretError = DeleteSecretErrors[keyof DeleteSecretErrors]

export type DeleteSecretResponses = {
  /**
   * Secret deleted successfully
   */
  204: void
}

export type DeleteSecretResponse =
  DeleteSecretResponses[keyof DeleteSecretResponses]

export type GetSecretData = {
  body?: never
  path: {
    /**
     * The UUID of the secret
     */
    id: string
  }
  query?: never
  url: '/api/secrets/{id}'
}

export type GetSecretErrors = {
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Forbidden - user does not own this secret
   */
  403: ErrorResponse
  /**
   * Secret not found
   */
  404: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
  /**
   * Service unavailable - secrets feature disabled
   */
  503: ErrorResponse
}

export type GetSecretError = GetSecretErrors[keyof GetSecretErrors]

export type GetSecretResponses = {
  /**
   * Success
   */
  200: SecretResponse
}

export type GetSecretResponse = GetSecretResponses[keyof GetSecretResponses]

export type UpdateSecretData = {
  body: UpdateSecretRequest
  path: {
    /**
     * The UUID of the secret
     */
    id: string
  }
  query?: never
  url: '/api/secrets/{id}'
}

export type UpdateSecretErrors = {
  /**
   * Invalid request
   */
  400: ErrorResponse
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Forbidden - user does not own this secret
   */
  403: ErrorResponse
  /**
   * Secret not found
   */
  404: ErrorResponse
  /**
   * Conflict - a secret with this name already exists
   */
  409: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
  /**
   * Service unavailable - secrets feature disabled
   */
  503: ErrorResponse
}

export type UpdateSecretError = UpdateSecretErrors[keyof UpdateSecretErrors]

export type UpdateSecretResponses = {
  /**
   * Secret updated successfully
   */
  200: SecretResponse
}

export type UpdateSecretResponse =
  UpdateSecretResponses[keyof UpdateSecretResponses]

export type GetAllSettingsData = {
  body?: never
  path?: never
  query?: never
  url: '/api/settings'
}

export type GetAllSettingsErrors = {
  /**
   * Unauthorized
   */
  401: ErrorResponse
}

export type GetAllSettingsError =
  GetAllSettingsErrors[keyof GetAllSettingsErrors]

export type GetAllSettingsResponses = {
  /**
   * User settings as key-value pairs
   */
  200: {
    [key: string]: unknown
  }
}

export type GetAllSettingsResponse =
  GetAllSettingsResponses[keyof GetAllSettingsResponses]

export type UpdateMultipleSettingsData = {
  /**
   * Settings to update as key-value pairs
   */
  body: {
    [key: string]: unknown
  }
  path?: never
  query?: never
  url: '/api/settings'
}

export type UpdateMultipleSettingsErrors = {
  /**
   * Invalid request
   */
  400: ErrorResponse
  /**
   * Unauthorized
   */
  401: ErrorResponse
}

export type UpdateMultipleSettingsError =
  UpdateMultipleSettingsErrors[keyof UpdateMultipleSettingsErrors]

export type UpdateMultipleSettingsResponses = {
  /**
   * Updated user settings
   */
  200: {
    [key: string]: unknown
  }
}

export type UpdateMultipleSettingsResponse =
  UpdateMultipleSettingsResponses[keyof UpdateMultipleSettingsResponses]

export type GetSettingByIdData = {
  body?: never
  path: {
    /**
     * Setting id to retrieve
     */
    id: string
  }
  query?: never
  url: '/api/settings/{id}'
}

export type GetSettingByIdErrors = {
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Setting not found
   */
  404: ErrorResponse
}

export type GetSettingByIdError =
  GetSettingByIdErrors[keyof GetSettingByIdErrors]

export type GetSettingByIdResponses = {
  /**
   * Setting value response
   */
  200: {
    /**
     * The setting value
     */
    value?: unknown
  }
}

export type GetSettingByIdResponse =
  GetSettingByIdResponses[keyof GetSettingByIdResponses]

export type UpdateSettingByIdData = {
  /**
   * New value for the setting
   */
  body: unknown
  path: {
    /**
     * Setting id to update
     */
    id: string
  }
  query?: never
  url: '/api/settings/{id}'
}

export type UpdateSettingByIdErrors = {
  /**
   * Invalid request
   */
  400: ErrorResponse
  /**
   * Unauthorized
   */
  401: ErrorResponse
}

export type UpdateSettingByIdError =
  UpdateSettingByIdErrors[keyof UpdateSettingByIdErrors]

export type UpdateSettingByIdResponses = {
  /**
   * Updated setting value response
   */
  200: {
    /**
     * The updated setting value
     */
    value?: unknown
  }
}

export type UpdateSettingByIdResponse =
  UpdateSettingByIdResponses[keyof UpdateSettingByIdResponses]

export type SubmitFeedbackData = {
  body: FeedbackRequest
  path?: never
  query?: never
  url: '/api/feedback'
}

export type SubmitFeedbackErrors = {
  /**
   * Invalid request
   */
  400: ErrorResponse
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type SubmitFeedbackError =
  SubmitFeedbackErrors[keyof SubmitFeedbackErrors]

export type SubmitFeedbackResponses = {
  /**
   * Feedback submitted successfully
   */
  201: FeedbackResponse
}

export type SubmitFeedbackResponse =
  SubmitFeedbackResponses[keyof SubmitFeedbackResponses]

export type GetUserdataData = {
  body?: never
  path?: never
  query?: {
    /**
     * The directory to list files from.
     */
    dir?: string
    /**
     * Whether to list files recursively.
     */
    recurse?: boolean
    /**
     * Whether to split file information by type.
     */
    split?: boolean
    /**
     * Whether to return full file metadata.
     */
    full_info?: boolean
  }
  url: '/api/userdata'
}

export type GetUserdataErrors = {
  /**
   * Bad request (e.g., invalid filename).
   */
  400: string
  /**
   * Unauthorized.
   */
  401: string
  /**
   * File not found or invalid path.
   */
  404: string
  /**
   * General error
   */
  500: string
}

export type GetUserdataError = GetUserdataErrors[keyof GetUserdataErrors]

export type GetUserdataResponses = {
  /**
   * A list of user data files.
   */
  200: GetUserDataResponseFull
}

export type GetUserdataResponse =
  GetUserdataResponses[keyof GetUserdataResponses]

export type GetUserdataFilePublishData = {
  body?: never
  path: {
    /**
     * The workflow file path within the user's data directory (URL encoded if necessary).
     */
    file: string
  }
  query?: never
  url: '/api/userdata/{file}/publish'
}

export type GetUserdataFilePublishErrors = {
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Workflow not found
   */
  404: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type GetUserdataFilePublishError =
  GetUserdataFilePublishErrors[keyof GetUserdataFilePublishErrors]

export type GetUserdataFilePublishResponses = {
  /**
   * Publish info (publish_time is null if never published)
   */
  200: WorkflowPublishInfo
}

export type GetUserdataFilePublishResponse =
  GetUserdataFilePublishResponses[keyof GetUserdataFilePublishResponses]

export type PostUserdataFilePublishData = {
  body: PublishWorkflowAssetsRequest
  path: {
    /**
     * The workflow file path within the user's data directory (URL encoded if necessary).
     */
    file: string
  }
  query?: never
  url: '/api/userdata/{file}/publish'
}

export type PostUserdataFilePublishErrors = {
  /**
   * Bad request
   */
  400: ErrorResponse
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Workflow not found
   */
  404: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type PostUserdataFilePublishError =
  PostUserdataFilePublishErrors[keyof PostUserdataFilePublishErrors]

export type PostUserdataFilePublishResponses = {
  /**
   * Workflow published
   */
  200: WorkflowPublishInfo
}

export type PostUserdataFilePublishResponse =
  PostUserdataFilePublishResponses[keyof PostUserdataFilePublishResponses]

export type DeleteUserdataFileData = {
  body?: never
  path: {
    /**
     * The file path to delete (URL encoded if necessary).
     */
    file: string
  }
  query?: never
  url: '/api/userdata/{file}'
}

export type DeleteUserdataFileErrors = {
  /**
   * Unauthorized.
   */
  401: string
  /**
   * File not found.
   */
  404: string
  /**
   * Internal server error.
   */
  500: string
}

export type DeleteUserdataFileError =
  DeleteUserdataFileErrors[keyof DeleteUserdataFileErrors]

export type DeleteUserdataFileResponses = {
  /**
   * File deleted successfully (No Content).
   */
  204: void
}

export type DeleteUserdataFileResponse =
  DeleteUserdataFileResponses[keyof DeleteUserdataFileResponses]

export type GetUserdataFileData = {
  body?: never
  path: {
    /**
     * The filename of the user data to retrieve.
     */
    file: string
  }
  query?: never
  url: '/api/userdata/{file}'
}

export type GetUserdataFileErrors = {
  /**
   * Bad request (e.g., invalid filename).
   */
  400: string
  /**
   * Unauthorized.
   */
  401: string
  /**
   * File not found or invalid path.
   */
  404: string
  /**
   * General error
   */
  500: string
}

export type GetUserdataFileError =
  GetUserdataFileErrors[keyof GetUserdataFileErrors]

export type GetUserdataFileResponses = {
  /**
   * Successfully retrieved the file.
   */
  200: Blob | File
}

export type GetUserdataFileResponse =
  GetUserdataFileResponses[keyof GetUserdataFileResponses]

export type PostUserdataFileData = {
  body: Blob | File
  path: {
    /**
     * The target file path (URL encoded if necessary).
     */
    file: string
  }
  query?: {
    /**
     * If "false", prevents overwriting existing files. Defaults to "true".
     */
    overwrite?: 'true' | 'false'
    /**
     * If "true", returns detailed file info; if "false", returns only the relative path.
     */
    full_info?: 'true' | 'false'
  }
  url: '/api/userdata/{file}'
}

export type PostUserdataFileErrors = {
  /**
   * Missing or invalid 'file' parameter.
   */
  400: string
  /**
   * Unauthorized.
   */
  401: string
  /**
   * The requested path is not allowed.
   */
  403: string
  /**
   * File already exists and overwrite is set to false.
   */
  409: string
  /**
   * General error
   */
  500: string
}

export type PostUserdataFileError =
  PostUserdataFileErrors[keyof PostUserdataFileErrors]

export type PostUserdataFileResponses = {
  /**
   * File uploaded successfully.
   */
  200: UserDataResponseFull
}

export type PostUserdataFileResponse =
  PostUserdataFileResponses[keyof PostUserdataFileResponses]

export type MoveUserdataFileData = {
  body?: never
  path: {
    /**
     * The source file path (URL encoded if necessary).
     */
    file: string
    /**
     * The destination file path (URL encoded if necessary).
     */
    dest: string
  }
  query?: {
    /**
     * If "false", prevents overwriting existing files. Defaults to "true".
     */
    overwrite?: 'true' | 'false'
  }
  url: '/api/userdata/{file}/move/{dest}'
}

export type MoveUserdataFileErrors = {
  /**
   * Missing or invalid parameters.
   */
  400: string
  /**
   * Unauthorized.
   */
  401: string
  /**
   * Source file not found.
   */
  404: string
  /**
   * Destination file already exists and overwrite is set to false.
   */
  409: string
  /**
   * General error
   */
  500: string
}

export type MoveUserdataFileError =
  MoveUserdataFileErrors[keyof MoveUserdataFileErrors]

export type MoveUserdataFileResponses = {
  /**
   * File moved successfully.
   */
  200: UserDataResponseFull
}

export type MoveUserdataFileResponse =
  MoveUserdataFileResponses[keyof MoveUserdataFileResponses]

export type UploadImageData = {
  body: {
    /**
     * The image file to upload
     */
    image: Blob | File
    /**
     * Whether to overwrite existing file (true/false)
     */
    overwrite?: string
    /**
     * Optional subfolder path
     */
    subfolder?: string
    /**
     * Upload type (defaults to "output")
     */
    type?: string
  }
  path?: never
  query?: never
  url: '/api/upload/image'
}

export type UploadImageErrors = {
  /**
   * Bad request
   */
  400: ErrorResponse
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type UploadImageError = UploadImageErrors[keyof UploadImageErrors]

export type UploadImageResponses = {
  /**
   * Image uploaded successfully
   */
  200: {
    /**
     * Filename of the uploaded image
     */
    name?: string
    /**
     * Subfolder path where image was saved
     */
    subfolder?: string
    /**
     * Type of upload (e.g., "output")
     */
    type?: string
  }
}

export type UploadImageResponse =
  UploadImageResponses[keyof UploadImageResponses]

export type UploadMaskData = {
  body: {
    /**
     * The mask image file to upload
     */
    image: Blob | File
    /**
     * JSON string containing reference to the original image
     */
    original_ref: string
  }
  path?: never
  query?: never
  url: '/api/upload/mask'
}

export type UploadMaskErrors = {
  /**
   * Bad request
   */
  400: ErrorResponse
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type UploadMaskError = UploadMaskErrors[keyof UploadMaskErrors]

export type UploadMaskResponses = {
  /**
   * Mask uploaded successfully
   */
  200: {
    /**
     * Filename of the uploaded mask
     */
    name?: string
    /**
     * Subfolder path where mask was saved
     */
    subfolder?: string
    /**
     * Type of upload (e.g., "output")
     */
    type?: string
  }
}

export type UploadMaskResponse = UploadMaskResponses[keyof UploadMaskResponses]

export type GetLogsData = {
  body?: never
  path?: never
  query?: never
  url: '/api/logs'
}

export type GetLogsErrors = {
  /**
   * Unauthorized
   */
  401: ErrorResponse
}

export type GetLogsError = GetLogsErrors[keyof GetLogsErrors]

export type GetLogsResponses = {
  /**
   * Success
   */
  200: LogsResponse
}

export type GetLogsResponse = GetLogsResponses[keyof GetLogsResponses]

export type GetSystemStatsData = {
  body?: never
  path?: never
  query?: never
  url: '/api/system_stats'
}

export type GetSystemStatsErrors = {
  /**
   * Unauthorized
   */
  401: ErrorResponse
}

export type GetSystemStatsError =
  GetSystemStatsErrors[keyof GetSystemStatsErrors]

export type GetSystemStatsResponses = {
  /**
   * Success
   */
  200: SystemStatsResponse
}

export type GetSystemStatsResponse =
  GetSystemStatsResponses[keyof GetSystemStatsResponses]

export type DeleteSessionData = {
  body?: never
  path?: never
  query?: never
  url: '/api/auth/session'
}

export type DeleteSessionErrors = {
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type DeleteSessionError = DeleteSessionErrors[keyof DeleteSessionErrors]

export type DeleteSessionResponses = {
  /**
   * Session deleted successfully
   */
  200: DeleteSessionResponse
}

export type DeleteSessionResponse2 =
  DeleteSessionResponses[keyof DeleteSessionResponses]

export type CreateSessionData = {
  body?: never
  path?: never
  query?: never
  url: '/api/auth/session'
}

export type CreateSessionErrors = {
  /**
   * Bad request - Invalid or old ID token
   */
  400: ErrorResponse
  /**
   * Unauthorized - Authentication required
   */
  401: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type CreateSessionError = CreateSessionErrors[keyof CreateSessionErrors]

export type CreateSessionResponses = {
  /**
   * Session created successfully
   */
  200: CreateSessionResponse
}

export type CreateSessionResponse2 =
  CreateSessionResponses[keyof CreateSessionResponses]

export type ExchangeTokenData = {
  body?: ExchangeTokenRequest
  path?: never
  query?: never
  url: '/api/auth/token'
}

export type ExchangeTokenErrors = {
  /**
   * Invalid or expired Firebase JWT
   */
  401: ErrorResponse
  /**
   * Workspace not found or user not a member
   */
  404: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type ExchangeTokenError = ExchangeTokenErrors[keyof ExchangeTokenErrors]

export type ExchangeTokenResponses = {
  /**
   * Token exchanged successfully
   */
  200: ExchangeTokenResponse
}

export type ExchangeTokenResponse2 =
  ExchangeTokenResponses[keyof ExchangeTokenResponses]

export type GetJwksData = {
  body?: never
  path?: never
  query?: never
  url: '/.well-known/jwks.json'
}

export type GetJwksResponses = {
  /**
   * JWKS response
   */
  200: JwksResponse
}

export type GetJwksResponse = GetJwksResponses[keyof GetJwksResponses]

export type GetOAuthAuthorizationServerData = {
  body?: never
  path?: never
  query?: never
  url: '/.well-known/oauth-authorization-server'
}

export type GetOAuthAuthorizationServerErrors = {
  /**
   * OAuth disabled
   */
  404: ErrorResponse
}

export type GetOAuthAuthorizationServerError =
  GetOAuthAuthorizationServerErrors[keyof GetOAuthAuthorizationServerErrors]

export type GetOAuthAuthorizationServerResponses = {
  /**
   * Authorization-server metadata
   */
  200: OAuthAuthorizationServerMetadata
}

export type GetOAuthAuthorizationServerResponse =
  GetOAuthAuthorizationServerResponses[keyof GetOAuthAuthorizationServerResponses]

export type GetOAuthProtectedResourceData = {
  body?: never
  path?: never
  query?: never
  url: '/.well-known/oauth-protected-resource'
}

export type GetOAuthProtectedResourceErrors = {
  /**
   * OAuth disabled or no active resource configured
   */
  404: ErrorResponse
}

export type GetOAuthProtectedResourceError =
  GetOAuthProtectedResourceErrors[keyof GetOAuthProtectedResourceErrors]

export type GetOAuthProtectedResourceResponses = {
  /**
   * Protected-resource metadata
   */
  200: OAuthProtectedResourceMetadata
}

export type GetOAuthProtectedResourceResponse =
  GetOAuthProtectedResourceResponses[keyof GetOAuthProtectedResourceResponses]

export type GetOAuthProtectedResourceByPathData = {
  body?: never
  path: {
    /**
     * Single-segment resource path without its leading slash (e.g. "mcp").
     */
    resourcePath: string
  }
  query?: never
  url: '/.well-known/oauth-protected-resource/{resourcePath}'
}

export type GetOAuthProtectedResourceByPathErrors = {
  /**
   * OAuth disabled, or no active resource at this path
   */
  404: ErrorResponse
}

export type GetOAuthProtectedResourceByPathError =
  GetOAuthProtectedResourceByPathErrors[keyof GetOAuthProtectedResourceByPathErrors]

export type GetOAuthProtectedResourceByPathResponses = {
  /**
   * Protected-resource metadata
   */
  200: OAuthProtectedResourceMetadata
}

export type GetOAuthProtectedResourceByPathResponse =
  GetOAuthProtectedResourceByPathResponses[keyof GetOAuthProtectedResourceByPathResponses]

export type GetOAuthAuthorizeData = {
  body?: never
  path?: never
  query?: {
    response_type?: string
    client_id?: string
    redirect_uri?: string
    scope?: string
    /**
     * RFC 6749 §10.12 marks `state` as RECOMMENDED. Our hardening makes
     * it REQUIRED on the initial-entry path (omitted only on the resume
     * path where `oauth_request_id` is supplied instead). This parameter
     * is `required: false` at the spec level only because the operation
     * is dual-mode (initial entry vs. resume); the runtime parser
     * (services/ingest/server/implementation/oauth/protocol/request.go)
     * rejects empty `state` on the initial-entry path with a stable
     * `invalid_request` 400.
     *
     */
    state?: string
    code_challenge?: string
    code_challenge_method?: string
    resource?: string
    oauth_request_id?: string
  }
  url: '/oauth/authorize'
}

export type GetOAuthAuthorizeErrors = {
  /**
   * Invalid authorize request (pre-redirect failure — unknown client, redirect mismatch, malformed params)
   */
  400: ErrorResponse
  /**
   * OAuth disabled
   */
  404: ErrorResponse
}

export type GetOAuthAuthorizeError =
  GetOAuthAuthorizeErrors[keyof GetOAuthAuthorizeErrors]

export type GetOAuthAuthorizeResponses = {
  /**
   * Consent challenge payload (cookie present, email verified). Frontend renders the consent UI from this payload and POSTs back to /oauth/authorize.
   *
   */
  200: OAuthConsentChallenge
}

export type GetOAuthAuthorizeResponse =
  GetOAuthAuthorizeResponses[keyof GetOAuthAuthorizeResponses]

export type PostOAuthAuthorizeData = {
  body: {
    oauth_request_id: string
    csrf_token: string
    decision: 'allow' | 'deny'
    workspace_id: string
  }
  path?: never
  query?: never
  url: '/oauth/authorize'
}

export type PostOAuthAuthorizeErrors = {
  /**
   * Bad request (CSRF mismatch, expired/consumed request, inaccessible workspace)
   */
  400: ErrorResponse
  /**
   * Scope broadening on consent re-grant — fresh consent flow required
   */
  403: ErrorResponse
  /**
   * OAuth disabled
   */
  404: ErrorResponse
}

export type PostOAuthAuthorizeError =
  PostOAuthAuthorizeErrors[keyof PostOAuthAuthorizeErrors]

export type PostOAuthAuthorizeResponses = {
  /**
   * Redirect URL for the frontend to navigate to (allow → with code+state; deny → with error+state)
   */
  200: OAuthAuthorizeRedirectResponse
}

export type PostOAuthAuthorizeResponse =
  PostOAuthAuthorizeResponses[keyof PostOAuthAuthorizeResponses]

export type PostOAuthTokenData = {
  body: {
    grant_type: 'authorization_code' | 'refresh_token'
    client_id: string
    code?: string
    redirect_uri?: string
    code_verifier?: string
    refresh_token?: string
    scope?: string
    client_secret?: string
  }
  path?: never
  query?: never
  url: '/oauth/token'
}

export type PostOAuthTokenErrors = {
  /**
   * RFC 6749 §5.2 error
   */
  400: OAuthTokenError
  /**
   * OAuth disabled
   */
  404: ErrorResponse
}

export type PostOAuthTokenError =
  PostOAuthTokenErrors[keyof PostOAuthTokenErrors]

export type PostOAuthTokenResponses = {
  /**
   * New token pair
   */
  200: OAuthTokenResponse
}

export type PostOAuthTokenResponse =
  PostOAuthTokenResponses[keyof PostOAuthTokenResponses]

export type PostOAuthRegisterData = {
  body: OAuthRegisterRequest
  path?: never
  query?: never
  url: '/oauth/register'
}

export type PostOAuthRegisterErrors = {
  /**
   * Bad request. Two shapes possible: `OAuthRegisterError` (RFC 7591 §3.2.2, emitted by the handler for invalid client metadata, reserved client_name, etc.) OR `ErrorResponse` (emitted by the strict-server binding layer when the request body fails OpenAPI-schema validation — malformed JSON, missing required fields, `additionalProperties: false` violations — normalized to the standard {code, message} shape by the custom Echo HTTPErrorHandler, BE-1178).
   *
   */
  400: OAuthRegisterBadRequestResponse
  /**
   * OAuth disabled
   */
  404: ErrorResponse
  /**
   * No active MCP resource is configured — DCR cannot mint a usable client until ops seeds an active oauth_resources row.
   */
  503: ErrorResponse
}

export type PostOAuthRegisterError =
  PostOAuthRegisterErrors[keyof PostOAuthRegisterErrors]

export type PostOAuthRegisterResponses = {
  /**
   * Registered. Body echoes the metadata RFC 7591 §3.2.1 requires.
   */
  201: OAuthRegisterResponse
}

export type PostOAuthRegisterResponse =
  PostOAuthRegisterResponses[keyof PostOAuthRegisterResponses]

export type ListWorkspacesData = {
  body?: never
  path?: never
  query?: never
  url: '/api/workspaces'
}

export type ListWorkspacesErrors = {
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Feature not enabled for user
   */
  404: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type ListWorkspacesError =
  ListWorkspacesErrors[keyof ListWorkspacesErrors]

export type ListWorkspacesResponses = {
  /**
   * List of workspaces
   */
  200: ListWorkspacesResponse
}

export type ListWorkspacesResponse2 =
  ListWorkspacesResponses[keyof ListWorkspacesResponses]

export type CreateWorkspaceData = {
  body: CreateWorkspaceRequest
  path?: never
  query?: never
  url: '/api/workspaces'
}

export type CreateWorkspaceErrors = {
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Feature not enabled for user
   */
  404: ErrorResponse
  /**
   * Validation error
   */
  422: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type CreateWorkspaceError =
  CreateWorkspaceErrors[keyof CreateWorkspaceErrors]

export type CreateWorkspaceResponses = {
  /**
   * Workspace created
   */
  201: Workspace
}

export type CreateWorkspaceResponse =
  CreateWorkspaceResponses[keyof CreateWorkspaceResponses]

export type DeleteWorkspaceData = {
  body?: never
  path: {
    /**
     * Workspace ID (w-{uuid} format)
     */
    id: string
  }
  query?: never
  url: '/api/workspaces/{id}'
}

export type DeleteWorkspaceErrors = {
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Owner role required or cannot delete personal workspace
   */
  403: ErrorResponse
  /**
   * Workspace not found
   */
  404: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type DeleteWorkspaceError =
  DeleteWorkspaceErrors[keyof DeleteWorkspaceErrors]

export type DeleteWorkspaceResponses = {
  /**
   * Workspace deleted
   */
  204: void
}

export type DeleteWorkspaceResponse =
  DeleteWorkspaceResponses[keyof DeleteWorkspaceResponses]

export type GetWorkspaceData = {
  body?: never
  path: {
    /**
     * Workspace ID (w-{uuid} format)
     */
    id: string
  }
  query?: never
  url: '/api/workspaces/{id}'
}

export type GetWorkspaceErrors = {
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Workspace not found or user not a member
   */
  404: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type GetWorkspaceError = GetWorkspaceErrors[keyof GetWorkspaceErrors]

export type GetWorkspaceResponses = {
  /**
   * Workspace details
   */
  200: Workspace
}

export type GetWorkspaceResponse =
  GetWorkspaceResponses[keyof GetWorkspaceResponses]

export type UpdateWorkspaceData = {
  body: UpdateWorkspaceRequest
  path: {
    /**
     * Workspace ID (w-{uuid} format)
     */
    id: string
  }
  query?: never
  url: '/api/workspaces/{id}'
}

export type UpdateWorkspaceErrors = {
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Owner role required
   */
  403: ErrorResponse
  /**
   * Workspace not found
   */
  404: ErrorResponse
  /**
   * Validation error
   */
  422: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type UpdateWorkspaceError =
  UpdateWorkspaceErrors[keyof UpdateWorkspaceErrors]

export type UpdateWorkspaceResponses = {
  /**
   * Workspace updated
   */
  200: Workspace
}

export type UpdateWorkspaceResponse =
  UpdateWorkspaceResponses[keyof UpdateWorkspaceResponses]

export type ListWorkspaceMembersData = {
  body?: never
  path?: never
  query?: {
    /**
     * Pagination offset (0-based)
     */
    offset?: number
    /**
     * Maximum number of members to return
     */
    limit?: number
  }
  url: '/api/workspace/members'
}

export type ListWorkspaceMembersErrors = {
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Not a member of this workspace
   */
  403: ErrorResponse
  /**
   * Workspace not found
   */
  404: ErrorResponse
  /**
   * Validation error
   */
  422: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type ListWorkspaceMembersError =
  ListWorkspaceMembersErrors[keyof ListWorkspaceMembersErrors]

export type ListWorkspaceMembersResponses = {
  /**
   * List of members
   */
  200: ListMembersResponse
}

export type ListWorkspaceMembersResponse =
  ListWorkspaceMembersResponses[keyof ListWorkspaceMembersResponses]

export type ListWorkspaceInvitesData = {
  body?: never
  path?: never
  query?: never
  url: '/api/workspace/invites'
}

export type ListWorkspaceInvitesErrors = {
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Owner role required
   */
  403: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type ListWorkspaceInvitesError =
  ListWorkspaceInvitesErrors[keyof ListWorkspaceInvitesErrors]

export type ListWorkspaceInvitesResponses = {
  /**
   * List of pending invites
   */
  200: ListInvitesResponse
}

export type ListWorkspaceInvitesResponse =
  ListWorkspaceInvitesResponses[keyof ListWorkspaceInvitesResponses]

export type CreateWorkspaceInviteData = {
  body: CreateInviteRequest
  path?: never
  query?: never
  url: '/api/workspace/invites'
}

export type CreateWorkspaceInviteErrors = {
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Owner role required or personal workspace (invites not allowed)
   */
  403: ErrorResponse
  /**
   * Workspace not found
   */
  404: ErrorResponse
  /**
   * Invite already exists
   */
  409: ErrorResponse
  /**
   * Validation error
   */
  422: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type CreateWorkspaceInviteError =
  CreateWorkspaceInviteErrors[keyof CreateWorkspaceInviteErrors]

export type CreateWorkspaceInviteResponses = {
  /**
   * Invite created
   */
  201: PendingInvite
}

export type CreateWorkspaceInviteResponse =
  CreateWorkspaceInviteResponses[keyof CreateWorkspaceInviteResponses]

export type AcceptWorkspaceInviteData = {
  body?: never
  path: {
    /**
     * Invite token
     */
    token: string
  }
  query?: never
  url: '/api/invites/{token}/accept'
}

export type AcceptWorkspaceInviteErrors = {
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Email does not match invite
   */
  403: ErrorResponse
  /**
   * Invite not found or expired
   */
  404: ErrorResponse
  /**
   * Already a member of this workspace
   */
  409: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type AcceptWorkspaceInviteError =
  AcceptWorkspaceInviteErrors[keyof AcceptWorkspaceInviteErrors]

export type AcceptWorkspaceInviteResponses = {
  /**
   * Invite accepted, user is now a member
   */
  200: AcceptInviteResponse
}

export type AcceptWorkspaceInviteResponse =
  AcceptWorkspaceInviteResponses[keyof AcceptWorkspaceInviteResponses]

export type LeaveWorkspaceData = {
  body?: never
  path?: never
  query?: never
  url: '/api/workspace/leave'
}

export type LeaveWorkspaceErrors = {
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Cannot leave as the only owner or cannot leave personal workspace
   */
  403: ErrorResponse
  /**
   * Workspace not found or not a member
   */
  404: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type LeaveWorkspaceError =
  LeaveWorkspaceErrors[keyof LeaveWorkspaceErrors]

export type LeaveWorkspaceResponses = {
  /**
   * Successfully left workspace
   */
  204: void
}

export type LeaveWorkspaceResponse =
  LeaveWorkspaceResponses[keyof LeaveWorkspaceResponses]

export type RevokeWorkspaceInviteData = {
  body?: never
  path: {
    /**
     * Invite ID to revoke
     */
    inviteId: string
  }
  query?: never
  url: '/api/workspace/invites/{inviteId}'
}

export type RevokeWorkspaceInviteErrors = {
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Owner role required
   */
  403: ErrorResponse
  /**
   * Workspace or invite not found
   */
  404: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type RevokeWorkspaceInviteError =
  RevokeWorkspaceInviteErrors[keyof RevokeWorkspaceInviteErrors]

export type RevokeWorkspaceInviteResponses = {
  /**
   * Invite revoked
   */
  204: void
}

export type RevokeWorkspaceInviteResponse =
  RevokeWorkspaceInviteResponses[keyof RevokeWorkspaceInviteResponses]

export type RemoveWorkspaceMemberData = {
  body?: never
  path: {
    /**
     * User ID to remove
     */
    userId: string
  }
  query?: never
  url: '/api/workspace/members/{userId}'
}

export type RemoveWorkspaceMemberErrors = {
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Owner role required or cannot remove yourself
   */
  403: ErrorResponse
  /**
   * Workspace or member not found
   */
  404: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type RemoveWorkspaceMemberError =
  RemoveWorkspaceMemberErrors[keyof RemoveWorkspaceMemberErrors]

export type RemoveWorkspaceMemberResponses = {
  /**
   * Member removed
   */
  204: void
}

export type RemoveWorkspaceMemberResponse =
  RemoveWorkspaceMemberResponses[keyof RemoveWorkspaceMemberResponses]

export type ListWorkspaceApiKeysData = {
  body?: never
  path?: never
  query?: never
  url: '/api/workspace/api-keys'
}

export type ListWorkspaceApiKeysErrors = {
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Forbidden
   */
  403: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type ListWorkspaceApiKeysError =
  ListWorkspaceApiKeysErrors[keyof ListWorkspaceApiKeysErrors]

export type ListWorkspaceApiKeysResponses = {
  /**
   * List of API keys
   */
  200: ListWorkspaceApiKeysResponse
}

export type ListWorkspaceApiKeysResponse2 =
  ListWorkspaceApiKeysResponses[keyof ListWorkspaceApiKeysResponses]

export type CreateWorkspaceApiKeyData = {
  body: CreateWorkspaceApiKeyRequest
  path?: never
  query?: never
  url: '/api/workspace/api-keys'
}

export type CreateWorkspaceApiKeyErrors = {
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Not a workspace member
   */
  403: ErrorResponse
  /**
   * Workspace not found
   */
  404: ErrorResponse
  /**
   * Validation error
   */
  422: ErrorResponse
  /**
   * Key limit reached
   */
  429: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type CreateWorkspaceApiKeyError =
  CreateWorkspaceApiKeyErrors[keyof CreateWorkspaceApiKeyErrors]

export type CreateWorkspaceApiKeyResponses = {
  /**
   * API key created (plaintext returned once)
   */
  201: CreateWorkspaceApiKeyResponse
}

export type CreateWorkspaceApiKeyResponse2 =
  CreateWorkspaceApiKeyResponses[keyof CreateWorkspaceApiKeyResponses]

export type RevokeWorkspaceApiKeyData = {
  body?: never
  path: {
    /**
     * API key ID to revoke
     */
    id: string
  }
  query?: never
  url: '/api/workspace/api-keys/{id}'
}

export type RevokeWorkspaceApiKeyErrors = {
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Not authorized to revoke this key
   */
  403: ErrorResponse
  /**
   * API key not found
   */
  404: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type RevokeWorkspaceApiKeyError =
  RevokeWorkspaceApiKeyErrors[keyof RevokeWorkspaceApiKeyErrors]

export type RevokeWorkspaceApiKeyResponses = {
  /**
   * API key revoked
   */
  204: void
}

export type RevokeWorkspaceApiKeyResponse =
  RevokeWorkspaceApiKeyResponses[keyof RevokeWorkspaceApiKeyResponses]

export type BulkRevokeWorkspaceMemberApiKeysData = {
  body?: never
  path: {
    /**
     * Firebase UID of the member whose keys to revoke (must be non-empty)
     */
    user_id: string
  }
  query?: never
  url: '/api/workspace/members/{user_id}/api-keys'
}

export type BulkRevokeWorkspaceMemberApiKeysErrors = {
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Not authorized (must be workspace owner)
   */
  403: ErrorResponse
  /**
   * Validation error (e.g. empty user_id)
   */
  422: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type BulkRevokeWorkspaceMemberApiKeysError =
  BulkRevokeWorkspaceMemberApiKeysErrors[keyof BulkRevokeWorkspaceMemberApiKeysErrors]

export type BulkRevokeWorkspaceMemberApiKeysResponses = {
  /**
   * Keys revoked successfully
   */
  200: BulkRevokeApiKeysResponse
}

export type BulkRevokeWorkspaceMemberApiKeysResponse =
  BulkRevokeWorkspaceMemberApiKeysResponses[keyof BulkRevokeWorkspaceMemberApiKeysResponses]

export type VerifyWorkspaceApiKeyData = {
  body: VerifyApiKeyRequest
  path?: never
  query?: {
    /**
     * When true, fetches real billing status from the billing service and populates has_funds and is_active accordingly. When false or omitted, the billing lookup is skipped and has_funds/is_active are returned as true (optimistic defaults). Use true when the caller needs to gate access based on billing (e.g. partner node auth); omit for identity-only lookups (e.g. key caching).
     */
    include_billing?: boolean
  }
  url: '/admin/api/keys/verify'
}

export type VerifyWorkspaceApiKeyErrors = {
  /**
   * Invalid key or unauthorized
   */
  401: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type VerifyWorkspaceApiKeyError =
  VerifyWorkspaceApiKeyErrors[keyof VerifyWorkspaceApiKeyErrors]

export type VerifyWorkspaceApiKeyResponses = {
  /**
   * Key is valid
   */
  200: VerifyApiKeyResponse
}

export type VerifyWorkspaceApiKeyResponse =
  VerifyWorkspaceApiKeyResponses[keyof VerifyWorkspaceApiKeyResponses]

export type GetUserData = {
  body?: never
  path?: never
  query?: never
  url: '/api/user'
}

export type GetUserErrors = {
  /**
   * Unauthorized
   */
  401: ErrorResponse
}

export type GetUserError = GetUserErrors[keyof GetUserErrors]

export type GetUserResponses = {
  /**
   * Success
   */
  200: UserResponse
}

export type GetUserResponse = GetUserResponses[keyof GetUserResponses]

export type SetReviewStatusData = {
  body: SetReviewStatusRequest
  path?: never
  query?: never
  url: '/admin/api/hub/workflows/status'
}

export type SetReviewStatusErrors = {
  /**
   * Bad request - invalid status value or empty share_ids
   */
  400: ErrorResponse
  /**
   * Unauthorized - authentication required
   */
  401: ErrorResponse
  /**
   * Forbidden - insufficient permissions
   */
  403: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type SetReviewStatusError =
  SetReviewStatusErrors[keyof SetReviewStatusErrors]

export type SetReviewStatusResponses = {
  /**
   * Status updated successfully
   */
  200: SetReviewStatusResponse
}

export type SetReviewStatusResponse2 =
  SetReviewStatusResponses[keyof SetReviewStatusResponses]

export type UpdateHubWorkflowData = {
  body: UpdateHubWorkflowRequest
  path: {
    /**
     * The share ID of the hub workflow to update.
     */
    share_id: string
  }
  query?: never
  url: '/admin/api/hub/workflows/{share_id}'
}

export type UpdateHubWorkflowErrors = {
  /**
   * Bad request - invalid field, unknown label slug, or invalid media token
   */
  400: ErrorResponse
  /**
   * Unauthorized - authentication required
   */
  401: ErrorResponse
  /**
   * Forbidden - insufficient permissions
   */
  403: ErrorResponse
  /**
   * Not found - no published workflow for the given share_id
   */
  404: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type UpdateHubWorkflowError =
  UpdateHubWorkflowErrors[keyof UpdateHubWorkflowErrors]

export type UpdateHubWorkflowResponses = {
  /**
   * Updated hub workflow detail
   */
  200: HubWorkflowDetail
}

export type UpdateHubWorkflowResponse =
  UpdateHubWorkflowResponses[keyof UpdateHubWorkflowResponses]

export type GetDeletionRequestData = {
  body?: never
  path?: never
  query: {
    /**
     * The Firebase ID of the user
     */
    firebase_id: string
  }
  url: '/admin/api/deletion_requests'
}

export type GetDeletionRequestErrors = {
  /**
   * Bad request - invalid request body
   */
  400: ErrorResponse
  /**
   * Unauthorized - authentication required
   */
  401: ErrorResponse
  /**
   * Forbidden - insufficient permissions
   */
  403: ErrorResponse
  /**
   * Deletion request not found
   */
  404: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type GetDeletionRequestError =
  GetDeletionRequestErrors[keyof GetDeletionRequestErrors]

export type GetDeletionRequestResponses = {
  /**
   * Success - deletion request found
   */
  200: Array<DeletionRequest>
}

export type GetDeletionRequestResponse =
  GetDeletionRequestResponses[keyof GetDeletionRequestResponses]

export type CreateDeletionRequestData = {
  body: {
    /**
     * The Firebase ID of the user to delete
     */
    firebase_id: string
  }
  path?: never
  query?: never
  url: '/admin/api/deletion_requests'
}

export type CreateDeletionRequestErrors = {
  /**
   * Bad request - invalid request body
   */
  400: ErrorResponse
  /**
   * Unauthorized - authentication required
   */
  401: ErrorResponse
  /**
   * Forbidden - insufficient permissions
   */
  403: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type CreateDeletionRequestError =
  CreateDeletionRequestErrors[keyof CreateDeletionRequestErrors]

export type CreateDeletionRequestResponses = {
  /**
   * Created - deletion request created or already exists
   */
  201: {
    /**
     * Whether the user had a record in the cloud database
     */
    user_found_in_cloud: boolean
  }
}

export type CreateDeletionRequestResponse =
  CreateDeletionRequestResponses[keyof CreateDeletionRequestResponses]

export type ReportPartnerUsageData = {
  body: PartnerUsageRequest
  path?: never
  query?: never
  url: '/admin/api/partner-usage'
}

export type ReportPartnerUsageErrors = {
  /**
   * Workspace not found
   */
  404: ErrorResponse
  /**
   * Validation error - missing or empty required fields
   */
  422: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type ReportPartnerUsageError =
  ReportPartnerUsageErrors[keyof ReportPartnerUsageErrors]

export type ReportPartnerUsageResponses = {
  /**
   * Usage reported successfully
   */
  200: PartnerUsageResponse
}

export type ReportPartnerUsageResponse =
  ReportPartnerUsageResponses[keyof ReportPartnerUsageResponses]

export type UpdateSubscriptionCacheData = {
  body: {
    /**
     * Firebase UID of the user whose cache should be updated.
     */
    user_id: string
    /**
     * Whether the user currently has an active personal subscription.
     * When false, any cached entry is cleared.
     *
     */
    is_active: boolean
    /**
     * Subscription tier (e.g. `PRO`, `CREATOR`). Required when
     * `is_active=true`; ignored otherwise. Unknown values are treated as a
     * no-op rather than cached, so a schema drift between services cannot
     * poison the cache.
     *
     */
    tier?: string
  }
  path?: never
  query?: never
  url: '/admin/api/update-subscription-cache'
}

export type UpdateSubscriptionCacheErrors = {
  /**
   * Missing or invalid request body
   */
  400: ErrorResponse
  /**
   * Cache write failed (Redis unavailable, DEL/SET error, marshal error).
   * Caller should retry — state on the ingest side is unchanged.
   *
   */
  500: ErrorResponse
}

export type UpdateSubscriptionCacheError =
  UpdateSubscriptionCacheErrors[keyof UpdateSubscriptionCacheErrors]

export type UpdateSubscriptionCacheResponses = {
  /**
   * Cache updated successfully
   */
  200: {
    /**
     * One of `updated` (cache entry written), `cleared` (cache entry
     * removed), or `skipped` (defensive no-op for missing / unknown tier).
     *
     */
    status?: string
  }
}

export type UpdateSubscriptionCacheResponse =
  UpdateSubscriptionCacheResponses[keyof UpdateSubscriptionCacheResponses]

export type InsertDynamicConfigData = {
  /**
   * A valid dynamicconfig.Config JSON object.
   */
  body: {
    [key: string]: unknown
  }
  path?: never
  query?: never
  url: '/admin/api/dynamic-config'
}

export type InsertDynamicConfigErrors = {
  /**
   * Invalid or missing request body
   */
  400: ErrorResponse
  /**
   * Database insert failed
   */
  500: ErrorResponse
}

export type InsertDynamicConfigError =
  InsertDynamicConfigErrors[keyof InsertDynamicConfigErrors]

export type InsertDynamicConfigResponses = {
  /**
   * Config inserted successfully
   */
  201: {
    /**
     * The database ID of the newly inserted config row.
     */
    id?: number
    /**
     * Human-readable success message.
     */
    message?: string
  }
}

export type InsertDynamicConfigResponse =
  InsertDynamicConfigResponses[keyof InsertDynamicConfigResponses]

export type SyncApiKeyData = {
  body: SyncApiKeyRequest
  path?: never
  query?: never
  url: '/admin/api/keys/sync'
}

export type SyncApiKeyErrors = {
  /**
   * Malformed request or unsupported event
   */
  400: ErrorResponse
  /**
   * Missing or invalid admin secret
   */
  401: ErrorResponse
  /**
   * Internal error
   */
  500: ErrorResponse
}

export type SyncApiKeyError = SyncApiKeyErrors[keyof SyncApiKeyErrors]

export type SyncApiKeyResponses = {
  /**
   * Sync processed — see `result` field
   */
  200: SyncApiKeyResponse
}

export type SyncApiKeyResponse2 = SyncApiKeyResponses[keyof SyncApiKeyResponses]

export type GetJobStatusData = {
  body?: never
  path: {
    /**
     * The unique ID of the job
     */
    job_id: string
  }
  query?: never
  url: '/api/job/{job_id}/status'
}

export type GetJobStatusErrors = {
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Forbidden - job belongs to another user
   */
  403: ErrorResponse
  /**
   * Job not found
   */
  404: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type GetJobStatusError = GetJobStatusErrors[keyof GetJobStatusErrors]

export type GetJobStatusResponses = {
  /**
   * Success - Job status returned
   */
  200: JobStatusResponse
}

export type GetJobStatusResponse =
  GetJobStatusResponses[keyof GetJobStatusResponses]

export type ListTasksData = {
  body?: never
  path?: never
  query?: {
    /**
     * Filter by task type name (exact match)
     */
    task_name?: string
    /**
     * Filter by idempotency key (exact match). For best performance, specify task_name as well.
     */
    idempotency_key?: string
    /**
     * Filter by one or more statuses (comma-separated)
     */
    status?: string
    /**
     * Filter tasks created after this timestamp (RFC3339 format)
     */
    created_after?: string
    /**
     * Filter tasks created before this timestamp (RFC3339 format)
     */
    created_before?: string
    /**
     * Sort direction (asc = ascending, desc = descending by create_time)
     */
    sort_order?: 'asc' | 'desc'
    /**
     * Pagination offset (0-based)
     */
    offset?: number
    /**
     * Maximum items per page (1-100)
     */
    limit?: number
  }
  url: '/api/tasks'
}

export type ListTasksErrors = {
  /**
   * Unauthorized - Authentication required
   */
  401: ErrorResponse
  /**
   * Validation error - Invalid filter values
   */
  422: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type ListTasksError = ListTasksErrors[keyof ListTasksErrors]

export type ListTasksResponses = {
  /**
   * Success - Tasks retrieved
   */
  200: TasksListResponse
}

export type ListTasksResponse = ListTasksResponses[keyof ListTasksResponses]

export type GetTaskData = {
  body?: never
  path: {
    /**
     * Task identifier (UUID)
     */
    task_id: string
  }
  query?: never
  url: '/api/tasks/{task_id}'
}

export type GetTaskErrors = {
  /**
   * Unauthorized - Authentication required
   */
  401: ErrorResponse
  /**
   * Task not found (also returned for ownership failures to avoid leaking task existence)
   */
  404: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type GetTaskError = GetTaskErrors[keyof GetTaskErrors]

export type GetTaskResponses = {
  /**
   * Success - Task details retrieved
   */
  200: TaskResponse
}

export type GetTaskResponse = GetTaskResponses[keyof GetTaskResponses]

export type GetBillingStatusData = {
  body?: never
  path?: never
  query?: never
  url: '/api/billing/status'
}

export type GetBillingStatusErrors = {
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Workspace not found
   */
  404: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type GetBillingStatusError =
  GetBillingStatusErrors[keyof GetBillingStatusErrors]

export type GetBillingStatusResponses = {
  /**
   * Billing status
   */
  200: BillingStatusResponse
}

export type GetBillingStatusResponse =
  GetBillingStatusResponses[keyof GetBillingStatusResponses]

export type GetBillingBalanceData = {
  body?: never
  path?: never
  query?: never
  url: '/api/billing/balance'
}

export type GetBillingBalanceErrors = {
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type GetBillingBalanceError =
  GetBillingBalanceErrors[keyof GetBillingBalanceErrors]

export type GetBillingBalanceResponses = {
  /**
   * Credit balance
   */
  200: BillingBalanceResponse
}

export type GetBillingBalanceResponse =
  GetBillingBalanceResponses[keyof GetBillingBalanceResponses]

export type GetBillingEventsData = {
  body?: never
  path?: never
  query?: {
    /**
     * Page number (1-indexed)
     */
    page?: number
    /**
     * Number of events per page
     */
    limit?: number
  }
  url: '/api/billing/events'
}

export type GetBillingEventsErrors = {
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type GetBillingEventsError =
  GetBillingEventsErrors[keyof GetBillingEventsErrors]

export type GetBillingEventsResponses = {
  /**
   * Paginated billing events
   */
  200: BillingEventsResponse
}

export type GetBillingEventsResponse =
  GetBillingEventsResponses[keyof GetBillingEventsResponses]

export type GetBillingPlansData = {
  body?: never
  path?: never
  query?: never
  url: '/api/billing/plans'
}

export type GetBillingPlansErrors = {
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type GetBillingPlansError =
  GetBillingPlansErrors[keyof GetBillingPlansErrors]

export type GetBillingPlansResponses = {
  /**
   * Available plans with pricing
   */
  200: BillingPlansResponse
}

export type GetBillingPlansResponse =
  GetBillingPlansResponses[keyof GetBillingPlansResponses]

export type PreviewSubscribeData = {
  body: PreviewSubscribeRequest
  path?: never
  query?: never
  url: '/api/billing/preview-subscribe'
}

export type PreviewSubscribeErrors = {
  /**
   * Invalid request (e.g., invalid plan slug, seats below minimum)
   */
  400: ErrorResponse
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type PreviewSubscribeError =
  PreviewSubscribeErrors[keyof PreviewSubscribeErrors]

export type PreviewSubscribeResponses = {
  /**
   * Subscription preview
   */
  200: PreviewSubscribeResponse
}

export type PreviewSubscribeResponse2 =
  PreviewSubscribeResponses[keyof PreviewSubscribeResponses]

export type SubscribeData = {
  body: SubscribeRequest
  path?: never
  query?: never
  url: '/api/billing/subscribe'
}

export type SubscribeErrors = {
  /**
   * Invalid request (e.g., invalid plan slug, incompatible plan)
   */
  400: ErrorResponse
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type SubscribeError = SubscribeErrors[keyof SubscribeErrors]

export type SubscribeResponses = {
  /**
   * Subscription created or payment method needed
   */
  200: SubscribeResponse
}

export type SubscribeResponse2 = SubscribeResponses[keyof SubscribeResponses]

export type CancelSubscriptionData = {
  body: CancelSubscriptionRequest
  path?: never
  query?: never
  url: '/api/billing/subscription/cancel'
}

export type CancelSubscriptionErrors = {
  /**
   * Invalid request (e.g., no active subscription)
   */
  400: ErrorResponse
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type CancelSubscriptionError =
  CancelSubscriptionErrors[keyof CancelSubscriptionErrors]

export type CancelSubscriptionResponses = {
  /**
   * Subscription cancellation scheduled
   */
  200: CancelSubscriptionResponse
}

export type CancelSubscriptionResponse2 =
  CancelSubscriptionResponses[keyof CancelSubscriptionResponses]

export type ResubscribeData = {
  body: ResubscribeRequest
  path?: never
  query?: never
  url: '/api/billing/subscription/resubscribe'
}

export type ResubscribeErrors = {
  /**
   * Invalid request (e.g., no active subscription, not in cancellation grace period)
   */
  400: ErrorResponse
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type ResubscribeError = ResubscribeErrors[keyof ResubscribeErrors]

export type ResubscribeResponses = {
  /**
   * Subscription resumed successfully
   */
  200: ResubscribeResponse
}

export type ResubscribeResponse2 =
  ResubscribeResponses[keyof ResubscribeResponses]

export type GetPaymentPortalData = {
  body?: PaymentPortalRequest
  path?: never
  query?: never
  url: '/api/billing/payment-portal'
}

export type GetPaymentPortalErrors = {
  /**
   * Bad request (e.g., missing return_url)
   */
  400: ErrorResponse
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type GetPaymentPortalError =
  GetPaymentPortalErrors[keyof GetPaymentPortalErrors]

export type GetPaymentPortalResponses = {
  /**
   * Success
   */
  200: PaymentPortalResponse
}

export type GetPaymentPortalResponse =
  GetPaymentPortalResponses[keyof GetPaymentPortalResponses]

export type CreateTopupData = {
  body: CreateTopupRequest
  path?: never
  query?: never
  url: '/api/billing/topup'
}

export type CreateTopupErrors = {
  /**
   * Bad request (invalid amount, no payment method)
   */
  400: ErrorResponse
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type CreateTopupError = CreateTopupErrors[keyof CreateTopupErrors]

export type CreateTopupResponses = {
  /**
   * Top-up initiated successfully
   */
  200: CreateTopupResponse
}

export type CreateTopupResponse2 =
  CreateTopupResponses[keyof CreateTopupResponses]

export type GetBillingOpStatusData = {
  body?: never
  path: {
    /**
     * The billing operation ID
     */
    id: string
  }
  query?: never
  url: '/api/billing/ops/{id}'
}

export type GetBillingOpStatusErrors = {
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Billing operation not found
   */
  404: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type GetBillingOpStatusError =
  GetBillingOpStatusErrors[keyof GetBillingOpStatusErrors]

export type GetBillingOpStatusResponses = {
  /**
   * Billing operation status
   */
  200: BillingOpStatusResponse
}

export type GetBillingOpStatusResponse =
  GetBillingOpStatusResponses[keyof GetBillingOpStatusResponses]

export type ListWorkflowsData = {
  body?: never
  path?: never
  query?: {
    limit?: number
    offset?: number
    /**
     * Search workflows by name (case-insensitive substring match)
     */
    name?: string
    /**
     * Filter by default view type
     */
    default_view?: 'workflow' | 'app'
    /**
     * Sort field
     */
    sort?: 'create_time' | 'update_time' | 'name'
    /**
     * Sort order
     */
    order?: 'asc' | 'desc'
  }
  url: '/api/workflows'
}

export type ListWorkflowsErrors = {
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type ListWorkflowsError = ListWorkflowsErrors[keyof ListWorkflowsErrors]

export type ListWorkflowsResponses = {
  /**
   * Success
   */
  200: WorkflowListResponse
}

export type ListWorkflowsResponse =
  ListWorkflowsResponses[keyof ListWorkflowsResponses]

export type CreateWorkflowData = {
  body: CreateWorkflowRequest
  path?: never
  query?: never
  url: '/api/workflows'
}

export type CreateWorkflowErrors = {
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Validation error
   */
  422: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type CreateWorkflowError =
  CreateWorkflowErrors[keyof CreateWorkflowErrors]

export type CreateWorkflowResponses = {
  /**
   * Workflow created successfully
   */
  201: WorkflowResponse
}

export type CreateWorkflowResponse =
  CreateWorkflowResponses[keyof CreateWorkflowResponses]

export type DeleteWorkflowData = {
  body?: never
  path: {
    /**
     * The UUID of the workflow to delete.
     */
    workflow_id: string
  }
  query?: never
  url: '/api/workflows/{workflow_id}'
}

export type DeleteWorkflowErrors = {
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Workflow not found
   */
  404: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type DeleteWorkflowError =
  DeleteWorkflowErrors[keyof DeleteWorkflowErrors]

export type DeleteWorkflowResponses = {
  /**
   * Workflow deleted successfully
   */
  204: void
}

export type DeleteWorkflowResponse =
  DeleteWorkflowResponses[keyof DeleteWorkflowResponses]

export type GetWorkflowData = {
  body?: never
  path: {
    /**
     * The UUID of the workflow.
     */
    workflow_id: string
  }
  query?: never
  url: '/api/workflows/{workflow_id}'
}

export type GetWorkflowErrors = {
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Forbidden
   */
  403: ErrorResponse
  /**
   * Workflow not found
   */
  404: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type GetWorkflowError = GetWorkflowErrors[keyof GetWorkflowErrors]

export type GetWorkflowResponses = {
  /**
   * Success
   */
  200: WorkflowResponse
}

export type GetWorkflowResponse =
  GetWorkflowResponses[keyof GetWorkflowResponses]

export type UpdateWorkflowData = {
  body: UpdateWorkflowRequest
  path: {
    /**
     * The UUID of the workflow to update.
     */
    workflow_id: string
  }
  query?: never
  url: '/api/workflows/{workflow_id}'
}

export type UpdateWorkflowErrors = {
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Workflow not found
   */
  404: ErrorResponse
  /**
   * Validation error
   */
  422: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type UpdateWorkflowError =
  UpdateWorkflowErrors[keyof UpdateWorkflowErrors]

export type UpdateWorkflowResponses = {
  /**
   * Success
   */
  200: WorkflowResponse
}

export type UpdateWorkflowResponse =
  UpdateWorkflowResponses[keyof UpdateWorkflowResponses]

export type CreateWorkflowVersionData = {
  body: CreateWorkflowVersionRequest
  path: {
    /**
     * The UUID of the workflow to create a new version for.
     */
    workflow_id: string
  }
  query?: never
  url: '/api/workflows/{workflow_id}/versions'
}

export type CreateWorkflowVersionErrors = {
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Forbidden - not the workflow owner
   */
  403: ErrorResponse
  /**
   * Workflow not found
   */
  404: ErrorResponse
  /**
   * Version conflict - base_version does not match latest
   */
  409: ErrorResponse
  /**
   * Validation error
   */
  422: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type CreateWorkflowVersionError =
  CreateWorkflowVersionErrors[keyof CreateWorkflowVersionErrors]

export type CreateWorkflowVersionResponses = {
  /**
   * Version created successfully
   */
  201: WorkflowVersionResponse
}

export type CreateWorkflowVersionResponse =
  CreateWorkflowVersionResponses[keyof CreateWorkflowVersionResponses]

export type GetWorkflowContentData = {
  body?: never
  path: {
    /**
     * The UUID of the workflow whose content should be retrieved.
     */
    workflow_id: string
  }
  query?: never
  url: '/api/workflows/{workflow_id}/content'
}

export type GetWorkflowContentErrors = {
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Forbidden
   */
  403: ErrorResponse
  /**
   * Workflow not found
   */
  404: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type GetWorkflowContentError =
  GetWorkflowContentErrors[keyof GetWorkflowContentErrors]

export type GetWorkflowContentResponses = {
  /**
   * Success
   */
  200: WorkflowVersionContentResponse
}

export type GetWorkflowContentResponse =
  GetWorkflowContentResponses[keyof GetWorkflowContentResponses]

export type ForkWorkflowData = {
  body: ForkWorkflowRequest
  path: {
    /**
     * The UUID of the source workflow to fork from.
     */
    workflow_id: string
  }
  query?: never
  url: '/api/workflows/{workflow_id}/fork'
}

export type ForkWorkflowErrors = {
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Forbidden
   */
  403: ErrorResponse
  /**
   * Source workflow or version not found
   */
  404: ErrorResponse
  /**
   * Validation error
   */
  422: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type ForkWorkflowError = ForkWorkflowErrors[keyof ForkWorkflowErrors]

export type ForkWorkflowResponses = {
  /**
   * Workflow forked successfully
   */
  201: WorkflowResponse
}

export type ForkWorkflowResponse =
  ForkWorkflowResponses[keyof ForkWorkflowResponses]

export type CreateHubProfileData = {
  body: CreateHubProfileRequest
  path?: never
  query?: never
  url: '/api/hub/profiles'
}

export type CreateHubProfileErrors = {
  /**
   * Bad request (e.g. invalid username)
   */
  400: ErrorResponse
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Not found
   */
  404: ErrorResponse
  /**
   * Username already taken or profile already exists
   */
  409: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type CreateHubProfileError =
  CreateHubProfileErrors[keyof CreateHubProfileErrors]

export type CreateHubProfileResponses = {
  /**
   * Hub profile created
   */
  201: HubProfile
}

export type CreateHubProfileResponse =
  CreateHubProfileResponses[keyof CreateHubProfileResponses]

export type GetMyHubProfileData = {
  body?: never
  path?: never
  query?: never
  url: '/api/hub/profiles/me'
}

export type GetMyHubProfileErrors = {
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * No hub profile exists
   */
  404: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type GetMyHubProfileError =
  GetMyHubProfileErrors[keyof GetMyHubProfileErrors]

export type GetMyHubProfileResponses = {
  /**
   * Hub profile
   */
  200: HubProfile
}

export type GetMyHubProfileResponse =
  GetMyHubProfileResponses[keyof GetMyHubProfileResponses]

export type CheckHubUsernameData = {
  body?: never
  path?: never
  query: {
    username: string
  }
  url: '/api/hub/profiles/check'
}

export type CheckHubUsernameErrors = {
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Not found
   */
  404: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type CheckHubUsernameError =
  CheckHubUsernameErrors[keyof CheckHubUsernameErrors]

export type CheckHubUsernameResponses = {
  /**
   * Username availability result
   */
  200: HubUsernameCheckResponse
}

export type CheckHubUsernameResponse =
  CheckHubUsernameResponses[keyof CheckHubUsernameResponses]

export type GetHubProfileByUsernameData = {
  body?: never
  path: {
    /**
     * The hub profile username.
     */
    username: string
  }
  query?: never
  url: '/api/hub/profiles/{username}'
}

export type GetHubProfileByUsernameErrors = {
  /**
   * Profile not found
   */
  404: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type GetHubProfileByUsernameError =
  GetHubProfileByUsernameErrors[keyof GetHubProfileByUsernameErrors]

export type GetHubProfileByUsernameResponses = {
  /**
   * Hub profile
   */
  200: HubProfile
}

export type GetHubProfileByUsernameResponse =
  GetHubProfileByUsernameResponses[keyof GetHubProfileByUsernameResponses]

export type UpdateHubProfileData = {
  body: UpdateHubProfileRequest
  path: {
    /**
     * The hub profile username to update.
     */
    username: string
  }
  query?: never
  url: '/api/hub/profiles/{username}'
}

export type UpdateHubProfileErrors = {
  /**
   * Bad request (e.g. missing body, invalid avatar token)
   */
  400: ErrorResponse
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * No hub profile exists with this username
   */
  404: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type UpdateHubProfileError =
  UpdateHubProfileErrors[keyof UpdateHubProfileErrors]

export type UpdateHubProfileResponses = {
  /**
   * Hub profile updated
   */
  200: HubProfile
}

export type UpdateHubProfileResponse =
  UpdateHubProfileResponses[keyof UpdateHubProfileResponses]

export type CreateHubAssetUploadUrlData = {
  body: HubAssetUploadUrlRequest
  path?: never
  query?: never
  url: '/api/hub/assets/upload-url'
}

export type CreateHubAssetUploadUrlErrors = {
  /**
   * Bad request (e.g. unsupported content type)
   */
  400: ErrorResponse
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Not found
   */
  404: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type CreateHubAssetUploadUrlError =
  CreateHubAssetUploadUrlErrors[keyof CreateHubAssetUploadUrlErrors]

export type CreateHubAssetUploadUrlResponses = {
  /**
   * Presigned upload URL and token
   */
  200: HubAssetUploadUrlResponse
}

export type CreateHubAssetUploadUrlResponse =
  CreateHubAssetUploadUrlResponses[keyof CreateHubAssetUploadUrlResponses]

export type ListHubLabelsData = {
  body?: never
  path?: never
  query?: {
    /**
     * Filter by label type. Omit to return all labels.
     */
    type?: 'tag' | 'model' | 'custom_node'
  }
  url: '/api/hub/labels'
}

export type ListHubLabelsErrors = {
  /**
   * Bad request (e.g. invalid type parameter)
   */
  400: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type ListHubLabelsError = ListHubLabelsErrors[keyof ListHubLabelsErrors]

export type ListHubLabelsResponses = {
  /**
   * List of labels
   */
  200: HubLabelListResponse
}

export type ListHubLabelsResponse =
  ListHubLabelsResponses[keyof ListHubLabelsResponses]

export type ListHubWorkflowsData = {
  body?: never
  path?: never
  query?: {
    cursor?: string
    limit?: number
    /**
     * Search by workflow name
     */
    search?: string
    /**
     * Filter by tag
     */
    tag?: string
    /**
     * Filter by profile username
     */
    username?: string
    /**
     * When true, returns full HubWorkflowDetail objects in the workflows array instead of summaries. Requires limit <= 20.
     */
    detail?: boolean
    /**
     * Filter by status (e.g. ?status=pending,approved). Defaults to approved if omitted.
     */
    status?: Array<HubWorkflowStatus>
  }
  url: '/api/hub/workflows'
}

export type ListHubWorkflowsErrors = {
  /**
   * Bad request (e.g. malformed pagination cursor)
   */
  400: ErrorResponse
  /**
   * Profile not found (when filtering by username)
   */
  404: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type ListHubWorkflowsError =
  ListHubWorkflowsErrors[keyof ListHubWorkflowsErrors]

export type ListHubWorkflowsResponses = {
  /**
   * Paginated list of hub workflows
   */
  200: HubWorkflowListResponse
}

export type ListHubWorkflowsResponse =
  ListHubWorkflowsResponses[keyof ListHubWorkflowsResponses]

export type PublishHubWorkflowData = {
  body: PublishHubWorkflowRequest
  path?: never
  query?: never
  url: '/api/hub/workflows'
}

export type PublishHubWorkflowErrors = {
  /**
   * Bad request
   */
  400: ErrorResponse
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Workflow or profile not found
   */
  404: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type PublishHubWorkflowError =
  PublishHubWorkflowErrors[keyof PublishHubWorkflowErrors]

export type PublishHubWorkflowResponses = {
  /**
   * Workflow published to hub
   */
  200: HubWorkflowDetail
}

export type PublishHubWorkflowResponse =
  PublishHubWorkflowResponses[keyof PublishHubWorkflowResponses]

export type ListHubWorkflowIndexData = {
  body?: never
  path?: never
  query?: {
    /**
     * Filter by status (e.g. ?status=pending,approved). Defaults to approved if omitted.
     */
    status?: Array<HubWorkflowStatus>
  }
  url: '/api/hub/workflows/index'
}

export type ListHubWorkflowIndexErrors = {
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type ListHubWorkflowIndexError =
  ListHubWorkflowIndexErrors[keyof ListHubWorkflowIndexErrors]

export type ListHubWorkflowIndexResponses = {
  /**
   * List of hub workflow template entries
   */
  200: Array<HubWorkflowTemplateEntry>
}

export type ListHubWorkflowIndexResponse =
  ListHubWorkflowIndexResponses[keyof ListHubWorkflowIndexResponses]

export type DeleteHubWorkflowData = {
  body?: never
  path: {
    /**
     * The share ID of the hub workflow to unpublish.
     */
    share_id: string
  }
  query?: never
  url: '/api/hub/workflows/{share_id}'
}

export type DeleteHubWorkflowErrors = {
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Workflow not found
   */
  404: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type DeleteHubWorkflowError =
  DeleteHubWorkflowErrors[keyof DeleteHubWorkflowErrors]

export type DeleteHubWorkflowResponses = {
  /**
   * Successfully unpublished
   */
  204: void
}

export type DeleteHubWorkflowResponse =
  DeleteHubWorkflowResponses[keyof DeleteHubWorkflowResponses]

export type GetHubWorkflowData = {
  body?: never
  path: {
    /**
     * The share ID of the hub workflow.
     */
    share_id: string
  }
  query?: never
  url: '/api/hub/workflows/{share_id}'
}

export type GetHubWorkflowErrors = {
  /**
   * Workflow not found
   */
  404: ErrorResponse
  /**
   * Workflow JSON too large
   */
  413: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type GetHubWorkflowError =
  GetHubWorkflowErrors[keyof GetHubWorkflowErrors]

export type GetHubWorkflowResponses = {
  /**
   * Hub workflow detail
   */
  200: HubWorkflowDetail
}

export type GetHubWorkflowResponse =
  GetHubWorkflowResponses[keyof GetHubWorkflowResponses]

export type GetPublishedWorkflowData = {
  body?: never
  path: {
    /**
     * The share ID of the published workflow.
     */
    share_id: string
  }
  query?: never
  url: '/api/workflows/published/{share_id}'
}

export type GetPublishedWorkflowErrors = {
  /**
   * Unauthorized
   */
  401: ErrorResponse
  /**
   * Share not found
   */
  404: ErrorResponse
  /**
   * Workflow JSON too large
   */
  413: ErrorResponse
  /**
   * Internal server error
   */
  500: ErrorResponse
}

export type GetPublishedWorkflowError =
  GetPublishedWorkflowErrors[keyof GetPublishedWorkflowErrors]

export type GetPublishedWorkflowResponses = {
  /**
   * Published workflow details with asset statuses
   */
  200: PublishedWorkflowDetail
}

export type GetPublishedWorkflowResponse =
  GetPublishedWorkflowResponses[keyof GetPublishedWorkflowResponses]

export type GetExtensionsData = {
  body?: never
  path?: never
  query?: never
  url: '/api/extensions'
}

export type GetExtensionsResponses = {
  /**
   * URL paths (relative to web root) of available extension JS files
   */
  200: Array<string>
}

export type GetExtensionsResponse =
  GetExtensionsResponses[keyof GetExtensionsResponses]

export type GetNodeInfoSchemaData = {
  body?: never
  path?: never
  query?: never
  url: '/api/experiment/nodes'
}

export type GetNodeInfoSchemaResponses = {
  /**
   * Full node schema JSON
   */
  200: unknown
}

export type GetNodeByIdData = {
  body?: never
  path: {
    /**
     * Node class_type identifier
     */
    id: string
  }
  query?: never
  url: '/api/experiment/nodes/{id}'
}

export type GetNodeByIdErrors = {
  /**
   * Node not found
   */
  404: unknown
}

export type GetNodeByIdResponses = {
  /**
   * Node definition JSON
   */
  200: unknown
}

export type GetVhsViewVideoData = {
  body?: never
  path?: never
  query: {
    /**
     * Name of the video file to view
     */
    filename: string
    /**
     * Type of file (e.g., output, input, temp)
     */
    type?: string
    /**
     * Subfolder path where the file is located
     */
    subfolder?: string
  }
  url: '/api/vhs/viewvideo'
}

export type GetVhsViewVideoErrors = {
  /**
   * Unauthorized
   */
  401: unknown
}

export type GetVhsViewVideoResponses = {
  /**
   * Video stream
   */
  200: unknown
}

export type GetVhsViewAudioData = {
  body?: never
  path?: never
  query: {
    /**
     * Name of the audio file to view
     */
    filename: string
    /**
     * Type of file (e.g., output, input, temp)
     */
    type?: string
    /**
     * Subfolder path where the file is located
     */
    subfolder?: string
  }
  url: '/api/vhs/viewaudio'
}

export type GetVhsViewAudioErrors = {
  /**
   * Unauthorized
   */
  401: unknown
}

export type GetVhsViewAudioResponses = {
  /**
   * Audio stream
   */
  200: unknown
}

export type GetVhsQueryVideoData = {
  body?: never
  path?: never
  query: {
    /**
     * Name of the video file to query
     */
    filename: string
  }
  url: '/api/vhs/queryvideo'
}

export type GetVhsQueryVideoErrors = {
  /**
   * Missing required query parameter. Produced by the oapi-codegen
   * wrapper via echo.NewHTTPError; the custom Echo HTTPErrorHandler
   * normalizes it to the standard ErrorResponse {code, message} shape
   * (BE-1178).
   *
   */
  400: ErrorResponse
  /**
   * Unauthorized
   */
  401: ErrorResponse
}

export type GetVhsQueryVideoError =
  GetVhsQueryVideoErrors[keyof GetVhsQueryVideoErrors]

export type GetVhsQueryVideoResponses = {
  /**
   * Video metadata
   */
  200: {
    /**
     * Source video metadata
     */
    source: {
      /**
       * [width, height] in pixels
       */
      size: [number, number]
      /**
       * Frames per second
       */
      fps: number
      /**
       * Total frame count
       */
      frames: number
      /**
       * Duration in seconds
       */
      duration: number
    }
  }
}

export type GetVhsQueryVideoResponse =
  GetVhsQueryVideoResponses[keyof GetVhsQueryVideoResponses]

export type GetUsersInfoData = {
  body?: never
  path?: never
  query?: never
  url: '/api/users'
}

export type GetUsersInfoErrors = {
  /**
   * Unauthorized
   */
  401: ErrorResponse
}

export type GetUsersInfoError = GetUsersInfoErrors[keyof GetUsersInfoErrors]

export type GetUsersInfoResponses = {
  /**
   * Userdata storage information
   */
  200: {
    /**
     * Where user data is stored (always "server" in cloud)
     */
    storage: string
    /**
     * Whether user data has been migrated (always true in cloud)
     */
    migrated: boolean
  }
}

export type GetUsersInfoResponse =
  GetUsersInfoResponses[keyof GetUsersInfoResponses]

export type GetApiViewVideoAliasData = {
  body?: never
  path?: never
  query: {
    /**
     * Name of the file to view (see `/api/view` for the full handler contract)
     */
    filename: string
  }
  url: '/api/viewvideo'
}

export type GetApiViewVideoAliasErrors = {
  /**
   * Unauthorized
   */
  401: unknown
}

export type GetApiViewVideoAliasResponses = {
  /**
   * File stream
   */
  200: unknown
}

export type GetViewCompatAliasData = {
  body?: never
  path?: never
  query: {
    /**
     * Name of the file to view (see `/api/view` for the full handler contract)
     */
    filename: string
  }
  url: '/view'
}

export type GetViewCompatAliasErrors = {
  /**
   * Unauthorized
   */
  401: unknown
}

export type GetViewCompatAliasResponses = {
  /**
   * File stream
   */
  200: unknown
}

export type GetWebsocketData = {
  body?: never
  path?: never
  query?: {
    /**
     * Stable client identifier used to associate the WebSocket
     * connection with the frontend session. If omitted, the server
     * generates one.
     *
     */
    clientId?: string
  }
  url: '/ws'
}

export type GetWebsocketErrors = {
  /**
   * Unauthorized
   */
  401: unknown
}

export type GetTemplateProxyData = {
  body?: never
  path: {
    /**
     * Template subpath within the versioned GCS bucket.
     */
    path: string
  }
  query?: never
  url: '/templates/{path}'
}

export type GetTemplateProxyErrors = {
  /**
   * Template not found.
   */
  404: unknown
  /**
   * Workflow templates version not available.
   */
  503: unknown
}

export type GetTemplateProxyResponses = {
  /**
   * Template file content streamed from GCS.
   */
  200: unknown
}

export type GetHealthData = {
  body?: never
  path?: never
  query?: never
  url: '/health'
}

export type GetHealthErrors = {
  /**
   * Service is unhealthy
   */
  503: string
}

export type GetHealthError = GetHealthErrors[keyof GetHealthErrors]

export type GetHealthResponses = {
  /**
   * Service is healthy
   */
  200: string
}

export type GetHealthResponse = GetHealthResponses[keyof GetHealthResponses]

export type GetMonitoringTasksData = {
  body?: never
  path?: never
  query?: never
  url: '/monitoring/tasks'
}

export type GetMonitoringTasksErrors = {
  /**
   * Unauthorized
   */
  401: unknown
  /**
   * Forbidden
   */
  403: unknown
}

export type GetMonitoringTasksResponses = {
  /**
   * HTML dashboard
   */
  200: unknown
}

export type DeleteMonitoringTasksSubpathData = {
  body?: never
  path: {
    /**
     * Asynqmon deletion subpath (e.g. delete task).
     */
    path: string
  }
  query?: never
  url: '/monitoring/tasks/{path}'
}

export type DeleteMonitoringTasksSubpathErrors = {
  /**
   * Unauthorized
   */
  401: unknown
  /**
   * Forbidden
   */
  403: unknown
}

export type DeleteMonitoringTasksSubpathResponses = {
  /**
   * Deletion result
   */
  200: unknown
}

export type GetMonitoringTasksSubpathData = {
  body?: never
  path: {
    /**
     * Asynqmon UI subpath (HTML page, SPA XHR, or static asset).
     */
    path: string
  }
  query?: never
  url: '/monitoring/tasks/{path}'
}

export type GetMonitoringTasksSubpathErrors = {
  /**
   * Unauthorized
   */
  401: unknown
  /**
   * Forbidden
   */
  403: unknown
}

export type GetMonitoringTasksSubpathResponses = {
  /**
   * Subpath response (asynqmon-determined content type)
   */
  200: unknown
}

export type PostMonitoringTasksSubpathData = {
  body?: never
  path: {
    /**
     * Asynqmon action subpath (e.g. retry, archive).
     */
    path: string
  }
  query?: never
  url: '/monitoring/tasks/{path}'
}

export type PostMonitoringTasksSubpathErrors = {
  /**
   * Unauthorized
   */
  401: unknown
  /**
   * Forbidden
   */
  403: unknown
}

export type PostMonitoringTasksSubpathResponses = {
  /**
   * Action result
   */
  200: unknown
}

export type GetPprofData = {
  body?: never
  path: {
    /**
     * pprof endpoint name (e.g. heap, goroutine, allocs, block, mutex, threadcreate).
     */
    path: string
  }
  query?: never
  url: '/debug/pprof/{path}'
}

export type GetPprofResponses = {
  /**
   * Profile data
   */
  200: unknown
}

export type GetPprofProfileData = {
  body?: never
  path?: never
  query?: never
  url: '/debug/pprof/profile'
}

export type GetPprofProfileResponses = {
  /**
   * CPU profile data
   */
  200: unknown
}

export type GetPprofTraceData = {
  body?: never
  path?: never
  query?: never
  url: '/debug/pprof/trace'
}

export type GetPprofTraceResponses = {
  /**
   * Execution trace data
   */
  200: unknown
}

export type PostPprofSymbolData = {
  body?: never
  path?: never
  query?: never
  url: '/debug/pprof/symbol'
}

export type PostPprofSymbolResponses = {
  /**
   * Resolved symbols
   */
  200: unknown
}

export type GetStaticExtensionsData = {
  body?: never
  path: {
    /**
     * Extension file path relative to /static/extensions on disk.
     */
    path: string
  }
  query?: never
  url: '/extensions/{path}'
}

export type GetStaticExtensionsErrors = {
  /**
   * File not found
   */
  404: unknown
}

export type GetStaticExtensionsResponses = {
  /**
   * Static file
   */
  200: unknown
}

export type GetCustomNodeProxyData = {
  body?: never
  path: {
    /**
     * Custom node HTTP endpoint path being proxied to the CPU-backed worker.
     */
    path: string
  }
  query?: never
  url: '/__custom_node_proxy/{path}'
}

export type GetCustomNodeProxyErrors = {
  /**
   * Unauthorized
   */
  401: unknown
  /**
   * Path not in allowlist
   */
  403: unknown
}

export type GetCustomNodeProxyResponses = {
  /**
   * Proxied response
   */
  200: unknown
}

export type PostCustomNodeProxyData = {
  body?: never
  path: {
    /**
     * Custom node HTTP endpoint path being proxied to the CPU-backed worker.
     */
    path: string
  }
  query?: never
  url: '/__custom_node_proxy/{path}'
}

export type PostCustomNodeProxyErrors = {
  /**
   * Unauthorized
   */
  401: unknown
  /**
   * Path not in allowlist
   */
  403: unknown
}

export type PostCustomNodeProxyResponses = {
  /**
   * Proxied response
   */
  200: unknown
}

export type GetModelPreviewData = {
  body?: never
  path: {
    /**
     * The folder name containing the model.
     */
    folder: string
    /**
     * The path index (usually 0 for cloud service).
     */
    path_index: number
    /**
     * The model filename (with or without .webp extension).
     */
    filename: string
  }
  query?: never
  url: '/api/experiment/models/preview/{folder}/{path_index}/{filename}'
}

export type GetModelPreviewErrors = {
  /**
   * Preview not available on Cloud
   */
  404: unknown
}

export type GetLegacyPromptByIdData = {
  body?: never
  path: {
    prompt_id: string
  }
  query?: never
  url: '/api/prompt/{prompt_id}'
}

export type GetLegacyPromptByIdErrors = {
  /**
   * Not Found — use /api/jobs/{prompt_id} instead
   */
  404: unknown
}

export type GetLegacyHistoryByIdData = {
  body?: never
  path: {
    prompt_id: string
  }
  query?: never
  url: '/api/history/{prompt_id}'
}

export type GetLegacyHistoryByIdErrors = {
  /**
   * Not Found — use /api/jobs/{prompt_id} instead
   */
  404: unknown
}

export type GetLegacyJobByIdData = {
  body?: never
  path: {
    job_id: string
  }
  query?: never
  url: '/api/job/{job_id}'
}

export type GetLegacyJobByIdErrors = {
  /**
   * Not Found — use /api/jobs/{job_id} instead
   */
  404: unknown
}

export type GetLegacyJobOutputsData = {
  body?: never
  path: {
    job_id: string
  }
  query?: never
  url: '/api/job/{job_id}/outputs'
}

export type GetLegacyJobOutputsErrors = {
  /**
   * Not Found — use /api/jobs/{job_id} instead
   */
  404: unknown
}

export type GetLegacyModelsData = {
  body?: never
  path?: never
  query?: never
  url: '/api/models'
}

export type GetLegacyModelsErrors = {
  /**
   * Not Found — use /api/experiment/models instead
   */
  404: unknown
}

export type GetLegacyModelsByFolderData = {
  body?: never
  path: {
    folder: string
  }
  query?: never
  url: '/api/models/{folder}'
}

export type GetLegacyModelsByFolderErrors = {
  /**
   * Not Found — use /api/experiment/models/{folder} instead
   */
  404: unknown
}

export type GetLegacyObjectInfoByNodeClassData = {
  body?: never
  path: {
    node_class: string
  }
  query?: never
  url: '/api/object_info/{node_class}'
}

export type GetLegacyObjectInfoByNodeClassErrors = {
  /**
   * Not Found — use /api/object_info instead
   */
  404: unknown
}

export type GetLegacyUserdataV2Data = {
  body?: never
  path?: never
  query?: never
  url: '/api/v2/userdata'
}

export type GetLegacyUserdataV2Errors = {
  /**
   * Not Found — use /api/userdata instead
   */
  404: unknown
}

export type GetLegacyAssetContentData = {
  body?: never
  path: {
    id: string
  }
  query?: never
  url: '/api/assets/{id}/content'
}

export type GetLegacyAssetContentErrors = {
  /**
   * Not Found — use /api/assets/download instead
   */
  404: unknown
}

export type GetLegacyViewMetadataData = {
  body?: never
  path: {
    folder_name: string
  }
  query?: never
  url: '/api/view_metadata/{folder_name}'
}

export type GetLegacyViewMetadataErrors = {
  /**
   * Not Found — use /api/experiment/models instead
   */
  404: unknown
}

export type GetEmbeddingsData = {
  body?: never
  path?: never
  query?: never
  url: '/api/embeddings'
}

export type GetEmbeddingsResponses = {
  /**
   * Embedding names
   */
  200: Array<string>
}

export type GetEmbeddingsResponse =
  GetEmbeddingsResponses[keyof GetEmbeddingsResponses]

export type FreeMemoryData = {
  body?: {
    /**
     * Unload all models from VRAM/RAM
     */
    unload_models?: boolean
    /**
     * Run garbage collection and free cached memory
     */
    free_memory?: boolean
  }
  path?: never
  query?: never
  url: '/api/free'
}

export type FreeMemoryResponses = {
  /**
   * Memory freed
   */
  200: unknown
}

export type GetI18nData = {
  body?: never
  path?: never
  query?: never
  url: '/api/i18n'
}

export type GetI18nResponses = {
  /**
   * Nested map of locale to translation key-value pairs
   */
  200: {
    [key: string]: unknown
  }
}

export type GetI18nResponse = GetI18nResponses[keyof GetI18nResponses]

export type GetInternalFolderPathsData = {
  body?: never
  path?: never
  query?: never
  url: '/internal/folder_paths'
}

export type GetInternalFolderPathsResponses = {
  /**
   * Map of folder type name to list of path entries
   */
  200: {
    [key: string]: Array<Array<string>>
  }
}

export type GetInternalFolderPathsResponse =
  GetInternalFolderPathsResponses[keyof GetInternalFolderPathsResponses]

export type GetInternalLogsData = {
  body?: never
  path?: never
  query?: never
  url: '/internal/logs'
}

export type GetInternalLogsResponses = {
  /**
   * Log text
   */
  200: string
}

export type GetInternalLogsResponse =
  GetInternalLogsResponses[keyof GetInternalLogsResponses]

export type GetInternalLogsRawData = {
  body?: never
  path?: never
  query?: never
  url: '/internal/logs/raw'
}

export type GetInternalLogsRawResponses = {
  /**
   * Structured log data
   */
  200: {
    entries?: Array<{
      /**
       * Timestamp
       */
      t?: number
      /**
       * Message
       */
      m?: string
    }>
    size?: {
      cols?: number
      rows?: number
    }
  }
}

export type GetInternalLogsRawResponse =
  GetInternalLogsRawResponses[keyof GetInternalLogsRawResponses]

export type SubscribeToLogsData = {
  body: {
    /**
     * WebSocket client ID
     */
    clientId: string
    /**
     * Enable or disable log streaming for this client
     */
    enabled: boolean
  }
  path?: never
  query?: never
  url: '/internal/logs/subscribe'
}

export type SubscribeToLogsResponses = {
  /**
   * Subscription updated
   */
  200: unknown
}

export type PruneAssetsData = {
  body?: never
  path?: never
  query?: never
  url: '/api/assets/prune'
}

export type PruneAssetsResponses = {
  /**
   * Prune result
   */
  200: {
    status?: string
    /**
     * Number of assets marked as missing
     */
    marked?: number
  }
}

export type PruneAssetsResponse =
  PruneAssetsResponses[keyof PruneAssetsResponses]

export type SeedAssetsData = {
  body?: {
    /**
     * Root folder paths to scan (if omitted, scans all)
     */
    roots?: Array<string>
  }
  path?: never
  query?: never
  url: '/api/assets/seed'
}

export type SeedAssetsResponses = {
  /**
   * Seed started
   */
  200: {
    status?: string
  }
}

export type SeedAssetsResponse = SeedAssetsResponses[keyof SeedAssetsResponses]

export type GetAssetSeedStatusData = {
  body?: never
  path?: never
  query?: never
  url: '/api/assets/seed/status'
}

export type GetAssetSeedStatusResponses = {
  /**
   * Scan progress details (files scanned, total, status, etc.)
   */
  200: {
    [key: string]: unknown
  }
}

export type GetAssetSeedStatusResponse =
  GetAssetSeedStatusResponses[keyof GetAssetSeedStatusResponses]

export type CancelAssetSeedData = {
  body?: never
  path?: never
  query?: never
  url: '/api/assets/seed/cancel'
}

export type CancelAssetSeedResponses = {
  /**
   * Scan cancelled
   */
  200: {
    status?: string
  }
}

export type CancelAssetSeedResponse =
  CancelAssetSeedResponses[keyof CancelAssetSeedResponses]
