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

import { oc } from '@orpc/contract'
import * as z from 'zod'
import {
  zDeleteAccountSessionsBySessionIdPath,
  zDeleteAccountSessionsBySessionIdResponse,
  zDeleteAccountSessionsSelfResponse,
  zDeleteWorkspacesByWorkspaceIdMembersByMemberIdPath,
  zDeleteWorkspacesByWorkspaceIdMembersByMemberIdResponse,
  zGetAccountResponse,
  zGetAccountSessionsQuery,
  zGetAccountSessionsResponse,
  zGetAppsByAppIdDependenciesCheckPath,
  zGetAppsByAppIdDependenciesCheckResponse,
  zGetAppsByAppIdDslPath,
  zGetAppsByAppIdDslQuery,
  zGetAppsByAppIdDslResponse,
  zGetAppsByAppIdHumanInputFormsByFormTokenPath,
  zGetAppsByAppIdHumanInputFormsByFormTokenResponse,
  zGetAppsByAppIdPath,
  zGetAppsByAppIdQuery,
  zGetAppsByAppIdResponse,
  zGetAppsByAppIdTasksByTaskIdEventsPath,
  zGetAppsByAppIdTasksByTaskIdEventsQuery,
  zGetAppsByAppIdTasksByTaskIdEventsResponse,
  zGetAppsQuery,
  zGetAppsResponse,
  zGetHealthResponse,
  zGetOauthDeviceLookupQuery,
  zGetOauthDeviceLookupResponse,
  zGetPermittedExternalAppsByAppIdPath,
  zGetPermittedExternalAppsByAppIdQuery,
  zGetPermittedExternalAppsByAppIdResponse,
  zGetPermittedExternalAppsQuery,
  zGetPermittedExternalAppsResponse,
  zGetVersionResponse,
  zGetWorkspacesByWorkspaceIdMembersPath,
  zGetWorkspacesByWorkspaceIdMembersQuery,
  zGetWorkspacesByWorkspaceIdMembersResponse,
  zGetWorkspacesByWorkspaceIdPath,
  zGetWorkspacesByWorkspaceIdResponse,
  zGetWorkspacesResponse,
  zPatchWorkspacesByWorkspaceIdMembersByMemberIdBody,
  zPatchWorkspacesByWorkspaceIdMembersByMemberIdPath,
  zPatchWorkspacesByWorkspaceIdMembersByMemberIdResponse,
  zPostAppsByAppIdFilesPath,
  zPostAppsByAppIdFilesResponse,
  zPostAppsByAppIdHumanInputFormsByFormTokenSubmitBody,
  zPostAppsByAppIdHumanInputFormsByFormTokenSubmitPath,
  zPostAppsByAppIdHumanInputFormsByFormTokenSubmitResponse,
  zPostAppsByAppIdRunBody,
  zPostAppsByAppIdRunPath,
  zPostAppsByAppIdRunResponse,
  zPostAppsByAppIdTasksByTaskIdStopPath,
  zPostAppsByAppIdTasksByTaskIdStopResponse,
  zPostOauthDeviceApproveBody,
  zPostOauthDeviceApproveResponse,
  zPostOauthDeviceCodeBody,
  zPostOauthDeviceCodeResponse,
  zPostOauthDeviceDenyBody,
  zPostOauthDeviceDenyResponse,
  zPostOauthDeviceTokenBody,
  zPostOauthDeviceTokenResponse,
  zPostWorkspacesByWorkspaceIdAppsImportsBody,
  zPostWorkspacesByWorkspaceIdAppsImportsByImportIdConfirmPath,
  zPostWorkspacesByWorkspaceIdAppsImportsByImportIdConfirmResponse,
  zPostWorkspacesByWorkspaceIdAppsImportsPath,
  zPostWorkspacesByWorkspaceIdAppsImportsResponse,
  zPostWorkspacesByWorkspaceIdMembersBody,
  zPostWorkspacesByWorkspaceIdMembersPath,
  zPostWorkspacesByWorkspaceIdMembersResponse,
  zPostWorkspacesByWorkspaceIdSwitchPath,
  zPostWorkspacesByWorkspaceIdSwitchResponse,
} from './zod.gen'

export const get = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'getHealth',
    path: '/_health',
    tags: ['openapi'],
  })
  .output(zGetHealthResponse)

export const health = {
  get,
}

export const get2 = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'getVersion',
    path: '/_version',
    tags: ['openapi'],
  })
  .output(zGetVersionResponse)

export const version = {
  get: get2,
}

export const delete_ = oc
  .route({
    inputStructure: 'detailed',
    method: 'DELETE',
    operationId: 'deleteAccountSessionsSelf',
    path: '/account/sessions/self',
    tags: ['openapi'],
  })
  .output(zDeleteAccountSessionsSelfResponse)

export const self = {
  delete: delete_,
}

export const delete2 = oc
  .route({
    inputStructure: 'detailed',
    method: 'DELETE',
    operationId: 'deleteAccountSessionsBySessionId',
    path: '/account/sessions/{session_id}',
    tags: ['openapi'],
  })
  .input(z.object({ params: zDeleteAccountSessionsBySessionIdPath }))
  .output(zDeleteAccountSessionsBySessionIdResponse)

export const bySessionId = {
  delete: delete2,
}

export const get3 = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'getAccountSessions',
    path: '/account/sessions',
    tags: ['openapi'],
  })
  .input(z.object({ query: zGetAccountSessionsQuery.optional() }))
  .output(zGetAccountSessionsResponse)

export const sessions = {
  get: get3,
  self,
  bySessionId,
}

export const get4 = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'getAccount',
    path: '/account',
    tags: ['openapi'],
  })
  .output(zGetAccountResponse)

export const account = {
  get: get4,
  sessions,
}

export const get5 = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'getAppsByAppIdDependenciesCheck',
    path: '/apps/{app_id}/dependencies:check',
    tags: ['openapi'],
  })
  .input(z.object({ params: zGetAppsByAppIdDependenciesCheckPath }))
  .output(zGetAppsByAppIdDependenciesCheckResponse)

export const check = {
  get: get5,
}

export const dependencies = {
  check,
}

export const get6 = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'getAppsByAppIdDsl',
    path: '/apps/{app_id}/dsl',
    tags: ['openapi'],
  })
  .input(z.object({ params: zGetAppsByAppIdDslPath, query: zGetAppsByAppIdDslQuery.optional() }))
  .output(zGetAppsByAppIdDslResponse)

export const dsl = {
  get: get6,
}

/**
 * Upload a file to use as an input variable when running the app
 */
export const post = oc
  .route({
    description: 'Upload a file to use as an input variable when running the app',
    inputStructure: 'detailed',
    method: 'POST',
    operationId: 'postAppsByAppIdFiles',
    path: '/apps/{app_id}/files',
    successStatus: 201,
    tags: ['openapi'],
  })
  .input(z.object({ params: zPostAppsByAppIdFilesPath }))
  .output(zPostAppsByAppIdFilesResponse)

export const files = {
  post,
}

export const post2 = oc
  .route({
    inputStructure: 'detailed',
    method: 'POST',
    operationId: 'postAppsByAppIdHumanInputFormsByFormTokenSubmit',
    path: '/apps/{app_id}/human-input-forms/{form_token}:submit',
    tags: ['openapi'],
  })
  .input(
    z.object({
      body: zPostAppsByAppIdHumanInputFormsByFormTokenSubmitBody,
      params: zPostAppsByAppIdHumanInputFormsByFormTokenSubmitPath,
    }),
  )
  .output(zPostAppsByAppIdHumanInputFormsByFormTokenSubmitResponse)

export const submit = {
  post: post2,
}

export const get7 = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'getAppsByAppIdHumanInputFormsByFormToken',
    path: '/apps/{app_id}/human-input-forms/{form_token}',
    tags: ['openapi'],
  })
  .input(z.object({ params: zGetAppsByAppIdHumanInputFormsByFormTokenPath }))
  .output(zGetAppsByAppIdHumanInputFormsByFormTokenResponse)

export const byFormToken = {
  get: get7,
  submit,
}

export const humanInputForms = {
  byFormToken,
}

export const get8 = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'getAppsByAppIdTasksByTaskIdEvents',
    path: '/apps/{app_id}/tasks/{task_id}/events',
    tags: ['openapi'],
  })
  .input(
    z.object({
      params: zGetAppsByAppIdTasksByTaskIdEventsPath,
      query: zGetAppsByAppIdTasksByTaskIdEventsQuery.optional(),
    }),
  )
  .output(zGetAppsByAppIdTasksByTaskIdEventsResponse)

export const events = {
  get: get8,
}

export const post3 = oc
  .route({
    inputStructure: 'detailed',
    method: 'POST',
    operationId: 'postAppsByAppIdTasksByTaskIdStop',
    path: '/apps/{app_id}/tasks/{task_id}:stop',
    tags: ['openapi'],
  })
  .input(z.object({ params: zPostAppsByAppIdTasksByTaskIdStopPath }))
  .output(zPostAppsByAppIdTasksByTaskIdStopResponse)

export const stop = {
  post: post3,
}

export const byTaskId = {
  events,
  stop,
}

export const tasks = {
  byTaskId,
}

export const post4 = oc
  .route({
    inputStructure: 'detailed',
    method: 'POST',
    operationId: 'postAppsByAppIdRun',
    path: '/apps/{app_id}:run',
    tags: ['openapi'],
  })
  .input(z.object({ body: zPostAppsByAppIdRunBody, params: zPostAppsByAppIdRunPath }))
  .output(zPostAppsByAppIdRunResponse)

export const run = {
  post: post4,
}

export const get9 = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'getAppsByAppId',
    path: '/apps/{app_id}',
    tags: ['openapi'],
  })
  .input(z.object({ params: zGetAppsByAppIdPath, query: zGetAppsByAppIdQuery.optional() }))
  .output(zGetAppsByAppIdResponse)

export const byAppId = {
  get: get9,
  dependencies,
  dsl,
  files,
  humanInputForms,
  tasks,
  run,
}

export const get10 = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'getApps',
    path: '/apps',
    tags: ['openapi'],
  })
  .input(z.object({ query: zGetAppsQuery }))
  .output(zGetAppsResponse)

export const apps = {
  get: get10,
  byAppId,
}

export const post5 = oc
  .route({
    inputStructure: 'detailed',
    method: 'POST',
    operationId: 'postOauthDeviceApprove',
    path: '/oauth/device/approve',
    tags: ['openapi'],
  })
  .input(z.object({ body: zPostOauthDeviceApproveBody }))
  .output(zPostOauthDeviceApproveResponse)

export const approve = {
  post: post5,
}

export const post6 = oc
  .route({
    inputStructure: 'detailed',
    method: 'POST',
    operationId: 'postOauthDeviceCode',
    path: '/oauth/device/code',
    tags: ['openapi'],
  })
  .input(z.object({ body: zPostOauthDeviceCodeBody }))
  .output(zPostOauthDeviceCodeResponse)

export const code = {
  post: post6,
}

export const post7 = oc
  .route({
    inputStructure: 'detailed',
    method: 'POST',
    operationId: 'postOauthDeviceDeny',
    path: '/oauth/device/deny',
    tags: ['openapi'],
  })
  .input(z.object({ body: zPostOauthDeviceDenyBody }))
  .output(zPostOauthDeviceDenyResponse)

export const deny = {
  post: post7,
}

export const get11 = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'getOauthDeviceLookup',
    path: '/oauth/device/lookup',
    tags: ['openapi'],
  })
  .input(z.object({ query: zGetOauthDeviceLookupQuery }))
  .output(zGetOauthDeviceLookupResponse)

export const lookup = {
  get: get11,
}

export const post8 = oc
  .route({
    inputStructure: 'detailed',
    method: 'POST',
    operationId: 'postOauthDeviceToken',
    path: '/oauth/device/token',
    tags: ['openapi'],
  })
  .input(z.object({ body: zPostOauthDeviceTokenBody }))
  .output(zPostOauthDeviceTokenResponse)

export const token = {
  post: post8,
}

export const device = {
  approve,
  code,
  deny,
  lookup,
  token,
}

export const oauth = {
  device,
}

export const get12 = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'getPermittedExternalAppsByAppId',
    path: '/permitted-external-apps/{app_id}',
    tags: ['openapi'],
  })
  .input(
    z.object({
      params: zGetPermittedExternalAppsByAppIdPath,
      query: zGetPermittedExternalAppsByAppIdQuery.optional(),
    }),
  )
  .output(zGetPermittedExternalAppsByAppIdResponse)

export const byAppId2 = {
  get: get12,
}

export const get13 = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'getPermittedExternalApps',
    path: '/permitted-external-apps',
    tags: ['openapi'],
  })
  .input(z.object({ query: zGetPermittedExternalAppsQuery.optional() }))
  .output(zGetPermittedExternalAppsResponse)

export const permittedExternalApps = {
  get: get13,
  byAppId: byAppId2,
}

export const post9 = oc
  .route({
    inputStructure: 'detailed',
    method: 'POST',
    operationId: 'postWorkspacesByWorkspaceIdAppsImportsByImportIdConfirm',
    path: '/workspaces/{workspace_id}/apps/imports/{import_id}:confirm',
    tags: ['openapi'],
  })
  .input(z.object({ params: zPostWorkspacesByWorkspaceIdAppsImportsByImportIdConfirmPath }))
  .output(zPostWorkspacesByWorkspaceIdAppsImportsByImportIdConfirmResponse)

export const confirm = {
  post: post9,
}

export const byImportId = {
  confirm,
}

export const post10 = oc
  .route({
    inputStructure: 'detailed',
    method: 'POST',
    operationId: 'postWorkspacesByWorkspaceIdAppsImports',
    path: '/workspaces/{workspace_id}/apps/imports',
    tags: ['openapi'],
  })
  .input(
    z.object({
      body: zPostWorkspacesByWorkspaceIdAppsImportsBody,
      params: zPostWorkspacesByWorkspaceIdAppsImportsPath,
    }),
  )
  .output(zPostWorkspacesByWorkspaceIdAppsImportsResponse)

export const imports = {
  post: post10,
  byImportId,
}

export const apps2 = {
  imports,
}

export const delete3 = oc
  .route({
    inputStructure: 'detailed',
    method: 'DELETE',
    operationId: 'deleteWorkspacesByWorkspaceIdMembersByMemberId',
    path: '/workspaces/{workspace_id}/members/{member_id}',
    tags: ['openapi'],
  })
  .input(z.object({ params: zDeleteWorkspacesByWorkspaceIdMembersByMemberIdPath }))
  .output(zDeleteWorkspacesByWorkspaceIdMembersByMemberIdResponse)

export const patch = oc
  .route({
    inputStructure: 'detailed',
    method: 'PATCH',
    operationId: 'patchWorkspacesByWorkspaceIdMembersByMemberId',
    path: '/workspaces/{workspace_id}/members/{member_id}',
    tags: ['openapi'],
  })
  .input(
    z.object({
      body: zPatchWorkspacesByWorkspaceIdMembersByMemberIdBody,
      params: zPatchWorkspacesByWorkspaceIdMembersByMemberIdPath,
    }),
  )
  .output(zPatchWorkspacesByWorkspaceIdMembersByMemberIdResponse)

export const byMemberId = {
  delete: delete3,
  patch,
}

export const get14 = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'getWorkspacesByWorkspaceIdMembers',
    path: '/workspaces/{workspace_id}/members',
    tags: ['openapi'],
  })
  .input(
    z.object({
      params: zGetWorkspacesByWorkspaceIdMembersPath,
      query: zGetWorkspacesByWorkspaceIdMembersQuery.optional(),
    }),
  )
  .output(zGetWorkspacesByWorkspaceIdMembersResponse)

export const post11 = oc
  .route({
    inputStructure: 'detailed',
    method: 'POST',
    operationId: 'postWorkspacesByWorkspaceIdMembers',
    path: '/workspaces/{workspace_id}/members',
    successStatus: 201,
    tags: ['openapi'],
  })
  .input(
    z.object({
      body: zPostWorkspacesByWorkspaceIdMembersBody,
      params: zPostWorkspacesByWorkspaceIdMembersPath,
    }),
  )
  .output(zPostWorkspacesByWorkspaceIdMembersResponse)

export const members = {
  get: get14,
  post: post11,
  byMemberId,
}

export const post12 = oc
  .route({
    inputStructure: 'detailed',
    method: 'POST',
    operationId: 'postWorkspacesByWorkspaceIdSwitch',
    path: '/workspaces/{workspace_id}:switch',
    tags: ['openapi'],
  })
  .input(z.object({ params: zPostWorkspacesByWorkspaceIdSwitchPath }))
  .output(zPostWorkspacesByWorkspaceIdSwitchResponse)

export const switch_ = {
  post: post12,
}

export const get15 = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'getWorkspacesByWorkspaceId',
    path: '/workspaces/{workspace_id}',
    tags: ['openapi'],
  })
  .input(z.object({ params: zGetWorkspacesByWorkspaceIdPath }))
  .output(zGetWorkspacesByWorkspaceIdResponse)

export const byWorkspaceId = {
  get: get15,
  apps: apps2,
  members,
  switch: switch_,
}

export const get16 = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'getWorkspaces',
    path: '/workspaces',
    tags: ['openapi'],
  })
  .output(zGetWorkspacesResponse)

export const workspaces = {
  get: get16,
  byWorkspaceId,
}

export const contract = {
  health,
  version,
  account,
  apps,
  oauth,
  permittedExternalApps,
  workspaces,
}
