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

import { oc } from '@orpc/contract'
import * as z from 'zod'

import {
  zDeleteSnippetsBySnippetIdWorkflowsDraftNodesByNodeIdVariablesPath,
  zDeleteSnippetsBySnippetIdWorkflowsDraftNodesByNodeIdVariablesResponse,
  zDeleteSnippetsBySnippetIdWorkflowsDraftVariablesByVariableIdPath,
  zDeleteSnippetsBySnippetIdWorkflowsDraftVariablesByVariableIdResponse,
  zDeleteSnippetsBySnippetIdWorkflowsDraftVariablesPath,
  zDeleteSnippetsBySnippetIdWorkflowsDraftVariablesResponse,
  zGetSnippetsBySnippetIdWorkflowRunsByRunIdNodeExecutionsPath,
  zGetSnippetsBySnippetIdWorkflowRunsByRunIdNodeExecutionsResponse,
  zGetSnippetsBySnippetIdWorkflowRunsByRunIdPath,
  zGetSnippetsBySnippetIdWorkflowRunsByRunIdResponse,
  zGetSnippetsBySnippetIdWorkflowRunsPath,
  zGetSnippetsBySnippetIdWorkflowRunsQuery,
  zGetSnippetsBySnippetIdWorkflowRunsResponse,
  zGetSnippetsBySnippetIdWorkflowsDefaultWorkflowBlockConfigsPath,
  zGetSnippetsBySnippetIdWorkflowsDefaultWorkflowBlockConfigsResponse,
  zGetSnippetsBySnippetIdWorkflowsDraftConfigPath,
  zGetSnippetsBySnippetIdWorkflowsDraftConfigResponse,
  zGetSnippetsBySnippetIdWorkflowsDraftConversationVariablesPath,
  zGetSnippetsBySnippetIdWorkflowsDraftConversationVariablesResponse,
  zGetSnippetsBySnippetIdWorkflowsDraftEnvironmentVariablesPath,
  zGetSnippetsBySnippetIdWorkflowsDraftEnvironmentVariablesResponse,
  zGetSnippetsBySnippetIdWorkflowsDraftNodesByNodeIdLastRunPath,
  zGetSnippetsBySnippetIdWorkflowsDraftNodesByNodeIdLastRunResponse,
  zGetSnippetsBySnippetIdWorkflowsDraftNodesByNodeIdVariablesPath,
  zGetSnippetsBySnippetIdWorkflowsDraftNodesByNodeIdVariablesResponse,
  zGetSnippetsBySnippetIdWorkflowsDraftPath,
  zGetSnippetsBySnippetIdWorkflowsDraftResponse,
  zGetSnippetsBySnippetIdWorkflowsDraftSystemVariablesPath,
  zGetSnippetsBySnippetIdWorkflowsDraftSystemVariablesResponse,
  zGetSnippetsBySnippetIdWorkflowsDraftVariablesByVariableIdPath,
  zGetSnippetsBySnippetIdWorkflowsDraftVariablesByVariableIdResponse,
  zGetSnippetsBySnippetIdWorkflowsDraftVariablesPath,
  zGetSnippetsBySnippetIdWorkflowsDraftVariablesQuery,
  zGetSnippetsBySnippetIdWorkflowsDraftVariablesResponse,
  zGetSnippetsBySnippetIdWorkflowsPath,
  zGetSnippetsBySnippetIdWorkflowsPublishPath,
  zGetSnippetsBySnippetIdWorkflowsPublishResponse,
  zGetSnippetsBySnippetIdWorkflowsQuery,
  zGetSnippetsBySnippetIdWorkflowsResponse,
  zPatchSnippetsBySnippetIdWorkflowsDraftVariablesByVariableIdBody,
  zPatchSnippetsBySnippetIdWorkflowsDraftVariablesByVariableIdPath,
  zPatchSnippetsBySnippetIdWorkflowsDraftVariablesByVariableIdResponse,
  zPostSnippetsBySnippetIdWorkflowRunsTasksByTaskIdStopPath,
  zPostSnippetsBySnippetIdWorkflowRunsTasksByTaskIdStopResponse,
  zPostSnippetsBySnippetIdWorkflowsByWorkflowIdRestorePath,
  zPostSnippetsBySnippetIdWorkflowsByWorkflowIdRestoreResponse,
  zPostSnippetsBySnippetIdWorkflowsDraftBody,
  zPostSnippetsBySnippetIdWorkflowsDraftIterationNodesByNodeIdRunBody,
  zPostSnippetsBySnippetIdWorkflowsDraftIterationNodesByNodeIdRunPath,
  zPostSnippetsBySnippetIdWorkflowsDraftIterationNodesByNodeIdRunResponse,
  zPostSnippetsBySnippetIdWorkflowsDraftLoopNodesByNodeIdRunBody,
  zPostSnippetsBySnippetIdWorkflowsDraftLoopNodesByNodeIdRunPath,
  zPostSnippetsBySnippetIdWorkflowsDraftLoopNodesByNodeIdRunResponse,
  zPostSnippetsBySnippetIdWorkflowsDraftNodesByNodeIdRunBody,
  zPostSnippetsBySnippetIdWorkflowsDraftNodesByNodeIdRunPath,
  zPostSnippetsBySnippetIdWorkflowsDraftNodesByNodeIdRunResponse,
  zPostSnippetsBySnippetIdWorkflowsDraftPath,
  zPostSnippetsBySnippetIdWorkflowsDraftResponse,
  zPostSnippetsBySnippetIdWorkflowsDraftRunBody,
  zPostSnippetsBySnippetIdWorkflowsDraftRunPath,
  zPostSnippetsBySnippetIdWorkflowsDraftRunResponse,
  zPostSnippetsBySnippetIdWorkflowsPublishBody,
  zPostSnippetsBySnippetIdWorkflowsPublishPath,
  zPostSnippetsBySnippetIdWorkflowsPublishResponse,
  zPutSnippetsBySnippetIdWorkflowsDraftVariablesByVariableIdResetPath,
  zPutSnippetsBySnippetIdWorkflowsDraftVariablesByVariableIdResetResponse,
} from './zod.gen'

/**
 * Stop a running snippet workflow task
 *
 * Uses both the legacy stop flag mechanism and the graph engine
 * command channel for backward compatibility.
 */
export const post = oc
  .route({
    description:
      'Uses both the legacy stop flag mechanism and the graph engine\ncommand channel for backward compatibility.',
    inputStructure: 'detailed',
    method: 'POST',
    operationId: 'postSnippetsBySnippetIdWorkflowRunsTasksByTaskIdStop',
    path: '/snippets/{snippet_id}/workflow-runs/tasks/{task_id}/stop',
    summary: 'Stop a running snippet workflow task',
    tags: ['console'],
  })
  .input(z.object({ params: zPostSnippetsBySnippetIdWorkflowRunsTasksByTaskIdStopPath }))
  .output(zPostSnippetsBySnippetIdWorkflowRunsTasksByTaskIdStopResponse)

export const stop = {
  post,
}

export const byTaskId = {
  stop,
}

export const tasks = {
  byTaskId,
}

/**
 * List node executions for a workflow run
 */
export const get = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'getSnippetsBySnippetIdWorkflowRunsByRunIdNodeExecutions',
    path: '/snippets/{snippet_id}/workflow-runs/{run_id}/node-executions',
    summary: 'List node executions for a workflow run',
    tags: ['console'],
  })
  .input(z.object({ params: zGetSnippetsBySnippetIdWorkflowRunsByRunIdNodeExecutionsPath }))
  .output(zGetSnippetsBySnippetIdWorkflowRunsByRunIdNodeExecutionsResponse)

export const nodeExecutions = {
  get,
}

/**
 * Get workflow run detail for snippet
 */
export const get2 = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'getSnippetsBySnippetIdWorkflowRunsByRunId',
    path: '/snippets/{snippet_id}/workflow-runs/{run_id}',
    summary: 'Get workflow run detail for snippet',
    tags: ['console'],
  })
  .input(z.object({ params: zGetSnippetsBySnippetIdWorkflowRunsByRunIdPath }))
  .output(zGetSnippetsBySnippetIdWorkflowRunsByRunIdResponse)

export const byRunId = {
  get: get2,
  nodeExecutions,
}

/**
 * List workflow runs for snippet
 */
export const get3 = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'getSnippetsBySnippetIdWorkflowRuns',
    path: '/snippets/{snippet_id}/workflow-runs',
    summary: 'List workflow runs for snippet',
    tags: ['console'],
  })
  .input(
    z.object({
      params: zGetSnippetsBySnippetIdWorkflowRunsPath,
      query: zGetSnippetsBySnippetIdWorkflowRunsQuery.optional(),
    }),
  )
  .output(zGetSnippetsBySnippetIdWorkflowRunsResponse)

export const workflowRuns = {
  get: get3,
  tasks,
  byRunId,
}

/**
 * Get default block configurations for snippet workflow
 */
export const get4 = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'getSnippetsBySnippetIdWorkflowsDefaultWorkflowBlockConfigs',
    path: '/snippets/{snippet_id}/workflows/default-workflow-block-configs',
    summary: 'Get default block configurations for snippet workflow',
    tags: ['console'],
  })
  .input(z.object({ params: zGetSnippetsBySnippetIdWorkflowsDefaultWorkflowBlockConfigsPath }))
  .output(zGetSnippetsBySnippetIdWorkflowsDefaultWorkflowBlockConfigsResponse)

export const defaultWorkflowBlockConfigs = {
  get: get4,
}

/**
 * Get snippet draft workflow configuration limits
 */
export const get5 = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'getSnippetsBySnippetIdWorkflowsDraftConfig',
    path: '/snippets/{snippet_id}/workflows/draft/config',
    summary: 'Get snippet draft workflow configuration limits',
    tags: ['console'],
  })
  .input(z.object({ params: zGetSnippetsBySnippetIdWorkflowsDraftConfigPath }))
  .output(zGetSnippetsBySnippetIdWorkflowsDraftConfigResponse)

export const config = {
  get: get5,
}

/**
 * Conversation variables are not used in snippet workflows; returns an empty list for API parity
 */
export const get6 = oc
  .route({
    description:
      'Conversation variables are not used in snippet workflows; returns an empty list for API parity',
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'getSnippetsBySnippetIdWorkflowsDraftConversationVariables',
    path: '/snippets/{snippet_id}/workflows/draft/conversation-variables',
    tags: ['console'],
  })
  .input(z.object({ params: zGetSnippetsBySnippetIdWorkflowsDraftConversationVariablesPath }))
  .output(zGetSnippetsBySnippetIdWorkflowsDraftConversationVariablesResponse)

export const conversationVariables = {
  get: get6,
}

/**
 * Get environment variables from snippet draft workflow graph
 */
export const get7 = oc
  .route({
    description: 'Get environment variables from snippet draft workflow graph',
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'getSnippetsBySnippetIdWorkflowsDraftEnvironmentVariables',
    path: '/snippets/{snippet_id}/workflows/draft/environment-variables',
    tags: ['console'],
  })
  .input(z.object({ params: zGetSnippetsBySnippetIdWorkflowsDraftEnvironmentVariablesPath }))
  .output(zGetSnippetsBySnippetIdWorkflowsDraftEnvironmentVariablesResponse)

export const environmentVariables = {
  get: get7,
}

/**
 * Run a draft workflow iteration node for snippet
 *
 * Run draft workflow iteration node for snippet
 * Iteration nodes execute their internal sub-graph multiple times over an input list.
 * Returns an SSE event stream with iteration progress and results.
 */
export const post2 = oc
  .route({
    description:
      'Run draft workflow iteration node for snippet\nIteration nodes execute their internal sub-graph multiple times over an input list.\nReturns an SSE event stream with iteration progress and results.',
    inputStructure: 'detailed',
    method: 'POST',
    operationId: 'postSnippetsBySnippetIdWorkflowsDraftIterationNodesByNodeIdRun',
    path: '/snippets/{snippet_id}/workflows/draft/iteration/nodes/{node_id}/run',
    summary: 'Run a draft workflow iteration node for snippet',
    tags: ['console'],
  })
  .input(
    z.object({
      body: zPostSnippetsBySnippetIdWorkflowsDraftIterationNodesByNodeIdRunBody,
      params: zPostSnippetsBySnippetIdWorkflowsDraftIterationNodesByNodeIdRunPath,
    }),
  )
  .output(zPostSnippetsBySnippetIdWorkflowsDraftIterationNodesByNodeIdRunResponse)

export const run = {
  post: post2,
}

export const byNodeId = {
  run,
}

export const nodes = {
  byNodeId,
}

export const iteration = {
  nodes,
}

/**
 * Run a draft workflow loop node for snippet
 *
 * Run draft workflow loop node for snippet
 * Loop nodes execute their internal sub-graph repeatedly until a condition is met.
 * Returns an SSE event stream with loop progress and results.
 */
export const post3 = oc
  .route({
    description:
      'Run draft workflow loop node for snippet\nLoop nodes execute their internal sub-graph repeatedly until a condition is met.\nReturns an SSE event stream with loop progress and results.',
    inputStructure: 'detailed',
    method: 'POST',
    operationId: 'postSnippetsBySnippetIdWorkflowsDraftLoopNodesByNodeIdRun',
    path: '/snippets/{snippet_id}/workflows/draft/loop/nodes/{node_id}/run',
    summary: 'Run a draft workflow loop node for snippet',
    tags: ['console'],
  })
  .input(
    z.object({
      body: zPostSnippetsBySnippetIdWorkflowsDraftLoopNodesByNodeIdRunBody,
      params: zPostSnippetsBySnippetIdWorkflowsDraftLoopNodesByNodeIdRunPath,
    }),
  )
  .output(zPostSnippetsBySnippetIdWorkflowsDraftLoopNodesByNodeIdRunResponse)

export const run2 = {
  post: post3,
}

export const byNodeId2 = {
  run: run2,
}

export const nodes2 = {
  byNodeId: byNodeId2,
}

export const loop = {
  nodes: nodes2,
}

/**
 * Get the last run result for a specific node in snippet draft workflow
 *
 * Get last run result for a node in snippet draft workflow
 * Returns the most recent execution record for the given node,
 * including status, inputs, outputs, and timing information.
 */
export const get8 = oc
  .route({
    description:
      'Get last run result for a node in snippet draft workflow\nReturns the most recent execution record for the given node,\nincluding status, inputs, outputs, and timing information.',
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'getSnippetsBySnippetIdWorkflowsDraftNodesByNodeIdLastRun',
    path: '/snippets/{snippet_id}/workflows/draft/nodes/{node_id}/last-run',
    summary: 'Get the last run result for a specific node in snippet draft workflow',
    tags: ['console'],
  })
  .input(z.object({ params: zGetSnippetsBySnippetIdWorkflowsDraftNodesByNodeIdLastRunPath }))
  .output(zGetSnippetsBySnippetIdWorkflowsDraftNodesByNodeIdLastRunResponse)

export const lastRun = {
  get: get8,
}

/**
 * Run a single node in snippet draft workflow
 *
 * Run a single node in snippet draft workflow (single-step debugging)
 * Executes a specific node with provided inputs for single-step debugging.
 * Returns the node execution result including status, outputs, and timing.
 */
export const post4 = oc
  .route({
    description:
      'Run a single node in snippet draft workflow (single-step debugging)\nExecutes a specific node with provided inputs for single-step debugging.\nReturns the node execution result including status, outputs, and timing.',
    inputStructure: 'detailed',
    method: 'POST',
    operationId: 'postSnippetsBySnippetIdWorkflowsDraftNodesByNodeIdRun',
    path: '/snippets/{snippet_id}/workflows/draft/nodes/{node_id}/run',
    summary: 'Run a single node in snippet draft workflow',
    tags: ['console'],
  })
  .input(
    z.object({
      body: zPostSnippetsBySnippetIdWorkflowsDraftNodesByNodeIdRunBody,
      params: zPostSnippetsBySnippetIdWorkflowsDraftNodesByNodeIdRunPath,
    }),
  )
  .output(zPostSnippetsBySnippetIdWorkflowsDraftNodesByNodeIdRunResponse)

export const run3 = {
  post: post4,
}

/**
 * Delete all variables for a specific node (snippet draft workflow)
 */
export const delete_ = oc
  .route({
    description: 'Delete all variables for a specific node (snippet draft workflow)',
    inputStructure: 'detailed',
    method: 'DELETE',
    operationId: 'deleteSnippetsBySnippetIdWorkflowsDraftNodesByNodeIdVariables',
    path: '/snippets/{snippet_id}/workflows/draft/nodes/{node_id}/variables',
    successStatus: 204,
    tags: ['console'],
  })
  .input(z.object({ params: zDeleteSnippetsBySnippetIdWorkflowsDraftNodesByNodeIdVariablesPath }))
  .output(zDeleteSnippetsBySnippetIdWorkflowsDraftNodesByNodeIdVariablesResponse)

/**
 * Get variables for a specific node (snippet draft workflow)
 */
export const get9 = oc
  .route({
    description: 'Get variables for a specific node (snippet draft workflow)',
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'getSnippetsBySnippetIdWorkflowsDraftNodesByNodeIdVariables',
    path: '/snippets/{snippet_id}/workflows/draft/nodes/{node_id}/variables',
    tags: ['console'],
  })
  .input(z.object({ params: zGetSnippetsBySnippetIdWorkflowsDraftNodesByNodeIdVariablesPath }))
  .output(zGetSnippetsBySnippetIdWorkflowsDraftNodesByNodeIdVariablesResponse)

export const variables = {
  delete: delete_,
  get: get9,
}

export const byNodeId3 = {
  lastRun,
  run: run3,
  variables,
}

export const nodes3 = {
  byNodeId: byNodeId3,
}

/**
 * Run draft workflow for snippet
 *
 * Executes the snippet's draft workflow with the provided inputs
 * and returns an SSE event stream with execution progress and results.
 */
export const post5 = oc
  .route({
    description:
      'Executes the snippet\'s draft workflow with the provided inputs\nand returns an SSE event stream with execution progress and results.',
    inputStructure: 'detailed',
    method: 'POST',
    operationId: 'postSnippetsBySnippetIdWorkflowsDraftRun',
    path: '/snippets/{snippet_id}/workflows/draft/run',
    summary: 'Run draft workflow for snippet',
    tags: ['console'],
  })
  .input(
    z.object({
      body: zPostSnippetsBySnippetIdWorkflowsDraftRunBody,
      params: zPostSnippetsBySnippetIdWorkflowsDraftRunPath,
    }),
  )
  .output(zPostSnippetsBySnippetIdWorkflowsDraftRunResponse)

export const run4 = {
  post: post5,
}

/**
 * System variables are not used in snippet workflows; returns an empty list for API parity
 */
export const get10 = oc
  .route({
    description:
      'System variables are not used in snippet workflows; returns an empty list for API parity',
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'getSnippetsBySnippetIdWorkflowsDraftSystemVariables',
    path: '/snippets/{snippet_id}/workflows/draft/system-variables',
    tags: ['console'],
  })
  .input(z.object({ params: zGetSnippetsBySnippetIdWorkflowsDraftSystemVariablesPath }))
  .output(zGetSnippetsBySnippetIdWorkflowsDraftSystemVariablesResponse)

export const systemVariables = {
  get: get10,
}

/**
 * Reset a draft workflow variable to its default value (snippet scope)
 */
export const put = oc
  .route({
    description: 'Reset a draft workflow variable to its default value (snippet scope)',
    inputStructure: 'detailed',
    method: 'PUT',
    operationId: 'putSnippetsBySnippetIdWorkflowsDraftVariablesByVariableIdReset',
    path: '/snippets/{snippet_id}/workflows/draft/variables/{variable_id}/reset',
    tags: ['console'],
  })
  .input(z.object({ params: zPutSnippetsBySnippetIdWorkflowsDraftVariablesByVariableIdResetPath }))
  .output(zPutSnippetsBySnippetIdWorkflowsDraftVariablesByVariableIdResetResponse)

export const reset = {
  put,
}

/**
 * Delete a draft workflow variable (snippet scope)
 */
export const delete2 = oc
  .route({
    description: 'Delete a draft workflow variable (snippet scope)',
    inputStructure: 'detailed',
    method: 'DELETE',
    operationId: 'deleteSnippetsBySnippetIdWorkflowsDraftVariablesByVariableId',
    path: '/snippets/{snippet_id}/workflows/draft/variables/{variable_id}',
    successStatus: 204,
    tags: ['console'],
  })
  .input(z.object({ params: zDeleteSnippetsBySnippetIdWorkflowsDraftVariablesByVariableIdPath }))
  .output(zDeleteSnippetsBySnippetIdWorkflowsDraftVariablesByVariableIdResponse)

/**
 * Get a specific draft workflow variable (snippet scope)
 */
export const get11 = oc
  .route({
    description: 'Get a specific draft workflow variable (snippet scope)',
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'getSnippetsBySnippetIdWorkflowsDraftVariablesByVariableId',
    path: '/snippets/{snippet_id}/workflows/draft/variables/{variable_id}',
    tags: ['console'],
  })
  .input(z.object({ params: zGetSnippetsBySnippetIdWorkflowsDraftVariablesByVariableIdPath }))
  .output(zGetSnippetsBySnippetIdWorkflowsDraftVariablesByVariableIdResponse)

/**
 * Update a draft workflow variable (snippet scope)
 */
export const patch = oc
  .route({
    description: 'Update a draft workflow variable (snippet scope)',
    inputStructure: 'detailed',
    method: 'PATCH',
    operationId: 'patchSnippetsBySnippetIdWorkflowsDraftVariablesByVariableId',
    path: '/snippets/{snippet_id}/workflows/draft/variables/{variable_id}',
    tags: ['console'],
  })
  .input(
    z.object({
      body: zPatchSnippetsBySnippetIdWorkflowsDraftVariablesByVariableIdBody,
      params: zPatchSnippetsBySnippetIdWorkflowsDraftVariablesByVariableIdPath,
    }),
  )
  .output(zPatchSnippetsBySnippetIdWorkflowsDraftVariablesByVariableIdResponse)

export const byVariableId = {
  delete: delete2,
  get: get11,
  patch,
  reset,
}

/**
 * Delete all draft workflow variables for the current user (snippet scope)
 */
export const delete3 = oc
  .route({
    description: 'Delete all draft workflow variables for the current user (snippet scope)',
    inputStructure: 'detailed',
    method: 'DELETE',
    operationId: 'deleteSnippetsBySnippetIdWorkflowsDraftVariables',
    path: '/snippets/{snippet_id}/workflows/draft/variables',
    successStatus: 204,
    tags: ['console'],
  })
  .input(z.object({ params: zDeleteSnippetsBySnippetIdWorkflowsDraftVariablesPath }))
  .output(zDeleteSnippetsBySnippetIdWorkflowsDraftVariablesResponse)

/**
 * List draft workflow variables without values (paginated, snippet scope)
 */
export const get12 = oc
  .route({
    description: 'List draft workflow variables without values (paginated, snippet scope)',
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'getSnippetsBySnippetIdWorkflowsDraftVariables',
    path: '/snippets/{snippet_id}/workflows/draft/variables',
    tags: ['console'],
  })
  .input(
    z.object({
      params: zGetSnippetsBySnippetIdWorkflowsDraftVariablesPath,
      query: zGetSnippetsBySnippetIdWorkflowsDraftVariablesQuery.optional(),
    }),
  )
  .output(zGetSnippetsBySnippetIdWorkflowsDraftVariablesResponse)

export const variables2 = {
  delete: delete3,
  get: get12,
  byVariableId,
}

/**
 * Get draft workflow for snippet
 */
export const get13 = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'getSnippetsBySnippetIdWorkflowsDraft',
    path: '/snippets/{snippet_id}/workflows/draft',
    summary: 'Get draft workflow for snippet',
    tags: ['console'],
  })
  .input(z.object({ params: zGetSnippetsBySnippetIdWorkflowsDraftPath }))
  .output(zGetSnippetsBySnippetIdWorkflowsDraftResponse)

/**
 * Sync draft workflow for snippet
 */
export const post6 = oc
  .route({
    inputStructure: 'detailed',
    method: 'POST',
    operationId: 'postSnippetsBySnippetIdWorkflowsDraft',
    path: '/snippets/{snippet_id}/workflows/draft',
    summary: 'Sync draft workflow for snippet',
    tags: ['console'],
  })
  .input(
    z.object({
      body: zPostSnippetsBySnippetIdWorkflowsDraftBody,
      params: zPostSnippetsBySnippetIdWorkflowsDraftPath,
    }),
  )
  .output(zPostSnippetsBySnippetIdWorkflowsDraftResponse)

export const draft = {
  get: get13,
  post: post6,
  config,
  conversationVariables,
  environmentVariables,
  iteration,
  loop,
  nodes: nodes3,
  run: run4,
  systemVariables,
  variables: variables2,
}

/**
 * Get published workflow for snippet
 */
export const get14 = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'getSnippetsBySnippetIdWorkflowsPublish',
    path: '/snippets/{snippet_id}/workflows/publish',
    summary: 'Get published workflow for snippet',
    tags: ['console'],
  })
  .input(z.object({ params: zGetSnippetsBySnippetIdWorkflowsPublishPath }))
  .output(zGetSnippetsBySnippetIdWorkflowsPublishResponse)

/**
 * Publish snippet workflow
 */
export const post7 = oc
  .route({
    inputStructure: 'detailed',
    method: 'POST',
    operationId: 'postSnippetsBySnippetIdWorkflowsPublish',
    path: '/snippets/{snippet_id}/workflows/publish',
    summary: 'Publish snippet workflow',
    tags: ['console'],
  })
  .input(
    z.object({
      body: zPostSnippetsBySnippetIdWorkflowsPublishBody,
      params: zPostSnippetsBySnippetIdWorkflowsPublishPath,
    }),
  )
  .output(zPostSnippetsBySnippetIdWorkflowsPublishResponse)

export const publish = {
  get: get14,
  post: post7,
}

/**
 * Restore a published snippet workflow version into the draft workflow
 *
 * Restore a published snippet workflow version into the draft workflow
 */
export const post8 = oc
  .route({
    description: 'Restore a published snippet workflow version into the draft workflow',
    inputStructure: 'detailed',
    method: 'POST',
    operationId: 'postSnippetsBySnippetIdWorkflowsByWorkflowIdRestore',
    path: '/snippets/{snippet_id}/workflows/{workflow_id}/restore',
    summary: 'Restore a published snippet workflow version into the draft workflow',
    tags: ['console'],
  })
  .input(z.object({ params: zPostSnippetsBySnippetIdWorkflowsByWorkflowIdRestorePath }))
  .output(zPostSnippetsBySnippetIdWorkflowsByWorkflowIdRestoreResponse)

export const restore = {
  post: post8,
}

export const byWorkflowId = {
  restore,
}

/**
 * Get all published workflow versions for snippet
 *
 * Get all published workflows for a snippet
 */
export const get15 = oc
  .route({
    description: 'Get all published workflows for a snippet',
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'getSnippetsBySnippetIdWorkflows',
    path: '/snippets/{snippet_id}/workflows',
    summary: 'Get all published workflow versions for snippet',
    tags: ['console'],
  })
  .input(
    z.object({
      params: zGetSnippetsBySnippetIdWorkflowsPath,
      query: zGetSnippetsBySnippetIdWorkflowsQuery.optional(),
    }),
  )
  .output(zGetSnippetsBySnippetIdWorkflowsResponse)

export const workflows = {
  get: get15,
  defaultWorkflowBlockConfigs,
  draft,
  publish,
  byWorkflowId,
}

export const bySnippetId = {
  workflowRuns,
  workflows,
}

export const snippets = {
  bySnippetId,
}

export const contract = {
  snippets,
}
