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

import { oc } from '@orpc/contract'
import * as z from 'zod'
import {
  zAccessServiceCreateApiKeyBody,
  zAccessServiceCreateApiKeyPath,
  zAccessServiceCreateApiKeyResponse,
  zAccessServiceDeleteApiKeyPath,
  zAccessServiceDeleteApiKeyResponse,
  zAccessServiceGetAccessChannelsPath,
  zAccessServiceGetAccessChannelsResponse,
  zAccessServiceGetAccessPolicyPath,
  zAccessServiceGetAccessPolicyResponse,
  zAccessServiceGetAccessSettingsPath,
  zAccessServiceGetAccessSettingsResponse,
  zAccessServiceGetDeveloperApiSettingsPath,
  zAccessServiceGetDeveloperApiSettingsResponse,
  zAccessServiceListApiKeysPath,
  zAccessServiceListApiKeysResponse,
  zAccessServiceUpdateAccessChannelsBody,
  zAccessServiceUpdateAccessChannelsPath,
  zAccessServiceUpdateAccessChannelsResponse,
  zAccessServiceUpdateAccessPolicyBody,
  zAccessServiceUpdateAccessPolicyPath,
  zAccessServiceUpdateAccessPolicyResponse,
  zAppInstanceServiceCreateAppInstanceBody,
  zAppInstanceServiceCreateAppInstanceResponse,
  zAppInstanceServiceDeleteAppInstancePath,
  zAppInstanceServiceDeleteAppInstanceResponse,
  zAppInstanceServiceGetAppInstanceOverviewPath,
  zAppInstanceServiceGetAppInstanceOverviewResponse,
  zAppInstanceServiceGetAppInstancePath,
  zAppInstanceServiceGetAppInstanceResponse,
  zAppInstanceServiceListAppInstancesQuery,
  zAppInstanceServiceListAppInstancesResponse,
  zAppInstanceServiceListAppInstanceSummariesQuery,
  zAppInstanceServiceListAppInstanceSummariesResponse,
  zAppInstanceServiceUpdateAppInstanceBody,
  zAppInstanceServiceUpdateAppInstancePath,
  zAppInstanceServiceUpdateAppInstanceResponse,
  zConsoleSsoOAuth2LoginResponse,
  zConsoleSsoOidcLoginResponse,
  zConsoleSsoSamlLoginResponse,
  zDeploymentServiceCancelDeploymentBody,
  zDeploymentServiceCancelDeploymentPath,
  zDeploymentServiceCancelDeploymentResponse,
  zDeploymentServiceDeployBody,
  zDeploymentServiceDeployResponse,
  zDeploymentServiceListDeploymentsPath,
  zDeploymentServiceListDeploymentsQuery,
  zDeploymentServiceListDeploymentsResponse,
  zDeploymentServiceListEnvironmentDeploymentsPath,
  zDeploymentServiceListEnvironmentDeploymentsResponse,
  zDeploymentServiceListRollbackTargetsPath,
  zDeploymentServiceListRollbackTargetsQuery,
  zDeploymentServiceListRollbackTargetsResponse,
  zDeploymentServicePromoteBody,
  zDeploymentServicePromotePath,
  zDeploymentServicePromoteResponse,
  zDeploymentServiceRollbackBody,
  zDeploymentServiceRollbackPath,
  zDeploymentServiceRollbackResponse,
  zDeploymentServiceUndeployBody,
  zDeploymentServiceUndeployPath,
  zDeploymentServiceUndeployResponse,
  zEnvironmentServiceListEnvironmentsQuery,
  zEnvironmentServiceListEnvironmentsResponse,
  zReleaseServiceComputeDeploymentOptionsBody,
  zReleaseServiceComputeDeploymentOptionsResponse,
  zReleaseServiceComputeReleaseDeploymentViewPath,
  zReleaseServiceComputeReleaseDeploymentViewQuery,
  zReleaseServiceComputeReleaseDeploymentViewResponse,
  zReleaseServiceCreateReleaseBody,
  zReleaseServiceCreateReleaseResponse,
  zReleaseServiceDeleteReleasePath,
  zReleaseServiceDeleteReleaseResponse,
  zReleaseServiceExportReleaseDslPath,
  zReleaseServiceExportReleaseDslResponse,
  zReleaseServiceGetReleasePath,
  zReleaseServiceGetReleaseResponse,
  zReleaseServiceListReleaseCredentialCandidatesPath,
  zReleaseServiceListReleaseCredentialCandidatesResponse,
  zReleaseServiceListReleasesPath,
  zReleaseServiceListReleasesQuery,
  zReleaseServiceListReleasesResponse,
  zReleaseServiceListReleaseSummariesPath,
  zReleaseServiceListReleaseSummariesQuery,
  zReleaseServiceListReleaseSummariesResponse,
  zReleaseServicePrecheckReleaseBody,
  zReleaseServicePrecheckReleaseResponse,
  zReleaseServiceUpdateReleaseBody,
  zReleaseServiceUpdateReleasePath,
  zReleaseServiceUpdateReleaseResponse,
  zWebAppAuthGetGroupSubjectsQuery,
  zWebAppAuthGetGroupSubjectsResponse,
  zWebAppAuthGetWebAppAccessModeQuery,
  zWebAppAuthGetWebAppAccessModeResponse,
  zWebAppAuthGetWebAppWhitelistSubjectsQuery,
  zWebAppAuthGetWebAppWhitelistSubjectsResponse,
  zWebAppAuthIsUserAllowedToAccessWebAppQuery,
  zWebAppAuthIsUserAllowedToAccessWebAppResponse,
  zWebAppAuthSearchForWhilteListCandidatesQuery,
  zWebAppAuthSearchForWhilteListCandidatesResponse,
  zWebAppAuthUpdateWebAppWhitelistSubjectsBody,
  zWebAppAuthUpdateWebAppWhitelistSubjectsResponse,
} from './zod.gen'

export const listAppInstanceSummaries = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'AppInstanceService_ListAppInstanceSummaries',
    path: '/enterprise/app-deploy/appInstanceSummaries',
    tags: ['AppInstanceService'],
  })
  .input(z.object({ query: zAppInstanceServiceListAppInstanceSummariesQuery.optional() }))
  .output(zAppInstanceServiceListAppInstanceSummariesResponse)

export const listAppInstances = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'AppInstanceService_ListAppInstances',
    path: '/enterprise/app-deploy/appInstances',
    tags: ['AppInstanceService'],
  })
  .input(z.object({ query: zAppInstanceServiceListAppInstancesQuery.optional() }))
  .output(zAppInstanceServiceListAppInstancesResponse)

export const createAppInstance = oc
  .route({
    inputStructure: 'detailed',
    method: 'POST',
    operationId: 'AppInstanceService_CreateAppInstance',
    path: '/enterprise/app-deploy/appInstances',
    tags: ['AppInstanceService'],
  })
  .input(z.object({ body: zAppInstanceServiceCreateAppInstanceBody }))
  .output(zAppInstanceServiceCreateAppInstanceResponse)

export const deleteAppInstance = oc
  .route({
    inputStructure: 'detailed',
    method: 'DELETE',
    operationId: 'AppInstanceService_DeleteAppInstance',
    path: '/enterprise/app-deploy/appInstances/{appInstanceId}',
    tags: ['AppInstanceService'],
  })
  .input(z.object({ params: zAppInstanceServiceDeleteAppInstancePath }))
  .output(zAppInstanceServiceDeleteAppInstanceResponse)

export const getAppInstance = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'AppInstanceService_GetAppInstance',
    path: '/enterprise/app-deploy/appInstances/{appInstanceId}',
    tags: ['AppInstanceService'],
  })
  .input(z.object({ params: zAppInstanceServiceGetAppInstancePath }))
  .output(zAppInstanceServiceGetAppInstanceResponse)

export const updateAppInstance = oc
  .route({
    inputStructure: 'detailed',
    method: 'PATCH',
    operationId: 'AppInstanceService_UpdateAppInstance',
    path: '/enterprise/app-deploy/appInstances/{appInstanceId}',
    tags: ['AppInstanceService'],
  })
  .input(
    z.object({
      body: zAppInstanceServiceUpdateAppInstanceBody,
      params: zAppInstanceServiceUpdateAppInstancePath,
    }),
  )
  .output(zAppInstanceServiceUpdateAppInstanceResponse)

export const getAppInstanceOverview = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'AppInstanceService_GetAppInstanceOverview',
    path: '/enterprise/app-deploy/appInstances/{appInstanceId}:getOverview',
    tags: ['AppInstanceService'],
  })
  .input(z.object({ params: zAppInstanceServiceGetAppInstanceOverviewPath }))
  .output(zAppInstanceServiceGetAppInstanceOverviewResponse)

export const appInstanceService = {
  listAppInstanceSummaries,
  listAppInstances,
  createAppInstance,
  deleteAppInstance,
  getAppInstance,
  updateAppInstance,
  getAppInstanceOverview,
}

export const getAccessChannels = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'AccessService_GetAccessChannels',
    path: '/enterprise/app-deploy/appInstances/{appInstanceId}/accessChannels',
    tags: ['AccessService'],
  })
  .input(z.object({ params: zAccessServiceGetAccessChannelsPath }))
  .output(zAccessServiceGetAccessChannelsResponse)

export const updateAccessChannels = oc
  .route({
    inputStructure: 'detailed',
    method: 'PUT',
    operationId: 'AccessService_UpdateAccessChannels',
    path: '/enterprise/app-deploy/appInstances/{appInstanceId}/accessChannels',
    tags: ['AccessService'],
  })
  .input(
    z.object({
      body: zAccessServiceUpdateAccessChannelsBody,
      params: zAccessServiceUpdateAccessChannelsPath,
    }),
  )
  .output(zAccessServiceUpdateAccessChannelsResponse)

export const getAccessSettings = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'AccessService_GetAccessSettings',
    path: '/enterprise/app-deploy/appInstances/{appInstanceId}/accessSettings',
    tags: ['AccessService'],
  })
  .input(z.object({ params: zAccessServiceGetAccessSettingsPath }))
  .output(zAccessServiceGetAccessSettingsResponse)

export const getDeveloperApiSettings = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'AccessService_GetDeveloperApiSettings',
    path: '/enterprise/app-deploy/appInstances/{appInstanceId}/developerApiSettings',
    tags: ['AccessService'],
  })
  .input(z.object({ params: zAccessServiceGetDeveloperApiSettingsPath }))
  .output(zAccessServiceGetDeveloperApiSettingsResponse)

export const getAccessPolicy = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'AccessService_GetAccessPolicy',
    path: '/enterprise/app-deploy/appInstances/{appInstanceId}/environments/{environmentId}/accessPolicy',
    tags: ['AccessService'],
  })
  .input(z.object({ params: zAccessServiceGetAccessPolicyPath }))
  .output(zAccessServiceGetAccessPolicyResponse)

export const updateAccessPolicy = oc
  .route({
    inputStructure: 'detailed',
    method: 'PUT',
    operationId: 'AccessService_UpdateAccessPolicy',
    path: '/enterprise/app-deploy/appInstances/{appInstanceId}/environments/{environmentId}/accessPolicy',
    tags: ['AccessService'],
  })
  .input(
    z.object({
      body: zAccessServiceUpdateAccessPolicyBody,
      params: zAccessServiceUpdateAccessPolicyPath,
    }),
  )
  .output(zAccessServiceUpdateAccessPolicyResponse)

export const listApiKeys = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'AccessService_ListApiKeys',
    path: '/enterprise/app-deploy/appInstances/{appInstanceId}/environments/{environmentId}/apiKeys',
    tags: ['AccessService'],
  })
  .input(z.object({ params: zAccessServiceListApiKeysPath }))
  .output(zAccessServiceListApiKeysResponse)

export const createApiKey = oc
  .route({
    inputStructure: 'detailed',
    method: 'POST',
    operationId: 'AccessService_CreateApiKey',
    path: '/enterprise/app-deploy/appInstances/{appInstanceId}/environments/{environmentId}/apiKeys',
    tags: ['AccessService'],
  })
  .input(z.object({ body: zAccessServiceCreateApiKeyBody, params: zAccessServiceCreateApiKeyPath }))
  .output(zAccessServiceCreateApiKeyResponse)

export const deleteApiKey = oc
  .route({
    inputStructure: 'detailed',
    method: 'DELETE',
    operationId: 'AccessService_DeleteApiKey',
    path: '/enterprise/app-deploy/appInstances/{appInstanceId}/environments/{environmentId}/apiKeys/{apiKeyId}',
    tags: ['AccessService'],
  })
  .input(z.object({ params: zAccessServiceDeleteApiKeyPath }))
  .output(zAccessServiceDeleteApiKeyResponse)

export const accessService = {
  getAccessChannels,
  updateAccessChannels,
  getAccessSettings,
  getDeveloperApiSettings,
  getAccessPolicy,
  updateAccessPolicy,
  listApiKeys,
  createApiKey,
  deleteApiKey,
}

export const listDeployments = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'DeploymentService_ListDeployments',
    path: '/enterprise/app-deploy/appInstances/{appInstanceId}/deployments',
    tags: ['DeploymentService'],
  })
  .input(
    z.object({
      params: zDeploymentServiceListDeploymentsPath,
      query: zDeploymentServiceListDeploymentsQuery.optional(),
    }),
  )
  .output(zDeploymentServiceListDeploymentsResponse)

export const listEnvironmentDeployments = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'DeploymentService_ListEnvironmentDeployments',
    path: '/enterprise/app-deploy/appInstances/{appInstanceId}/environmentDeployments',
    tags: ['DeploymentService'],
  })
  .input(z.object({ params: zDeploymentServiceListEnvironmentDeploymentsPath }))
  .output(zDeploymentServiceListEnvironmentDeploymentsResponse)

export const listRollbackTargets = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'DeploymentService_ListRollbackTargets',
    path: '/enterprise/app-deploy/appInstances/{appInstanceId}/environments/{environmentId}/rollbackTargets',
    tags: ['DeploymentService'],
  })
  .input(
    z.object({
      params: zDeploymentServiceListRollbackTargetsPath,
      query: zDeploymentServiceListRollbackTargetsQuery.optional(),
    }),
  )
  .output(zDeploymentServiceListRollbackTargetsResponse)

export const cancelDeployment = oc
  .route({
    inputStructure: 'detailed',
    method: 'POST',
    operationId: 'DeploymentService_CancelDeployment',
    path: '/enterprise/app-deploy/appInstances/{appInstanceId}/environments/{environmentId}:cancelDeployment',
    tags: ['DeploymentService'],
  })
  .input(
    z.object({
      body: zDeploymentServiceCancelDeploymentBody,
      params: zDeploymentServiceCancelDeploymentPath,
    }),
  )
  .output(zDeploymentServiceCancelDeploymentResponse)

export const promote = oc
  .route({
    inputStructure: 'detailed',
    method: 'POST',
    operationId: 'DeploymentService_Promote',
    path: '/enterprise/app-deploy/appInstances/{appInstanceId}/environments/{environmentId}:promote',
    tags: ['DeploymentService'],
  })
  .input(z.object({ body: zDeploymentServicePromoteBody, params: zDeploymentServicePromotePath }))
  .output(zDeploymentServicePromoteResponse)

export const rollback = oc
  .route({
    inputStructure: 'detailed',
    method: 'POST',
    operationId: 'DeploymentService_Rollback',
    path: '/enterprise/app-deploy/appInstances/{appInstanceId}/environments/{environmentId}:rollback',
    tags: ['DeploymentService'],
  })
  .input(z.object({ body: zDeploymentServiceRollbackBody, params: zDeploymentServiceRollbackPath }))
  .output(zDeploymentServiceRollbackResponse)

export const undeploy = oc
  .route({
    inputStructure: 'detailed',
    method: 'POST',
    operationId: 'DeploymentService_Undeploy',
    path: '/enterprise/app-deploy/appInstances/{appInstanceId}/environments/{environmentId}:undeploy',
    tags: ['DeploymentService'],
  })
  .input(z.object({ body: zDeploymentServiceUndeployBody, params: zDeploymentServiceUndeployPath }))
  .output(zDeploymentServiceUndeployResponse)

export const deploy = oc
  .route({
    inputStructure: 'detailed',
    method: 'POST',
    operationId: 'DeploymentService_Deploy',
    path: '/enterprise/app-deploy/appInstances:deploy',
    tags: ['DeploymentService'],
  })
  .input(z.object({ body: zDeploymentServiceDeployBody }))
  .output(zDeploymentServiceDeployResponse)

export const deploymentService = {
  listDeployments,
  listEnvironmentDeployments,
  listRollbackTargets,
  cancelDeployment,
  promote,
  rollback,
  undeploy,
  deploy,
}

export const listReleaseSummaries = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'ReleaseService_ListReleaseSummaries',
    path: '/enterprise/app-deploy/appInstances/{appInstanceId}/releaseSummaries',
    tags: ['ReleaseService'],
  })
  .input(
    z.object({
      params: zReleaseServiceListReleaseSummariesPath,
      query: zReleaseServiceListReleaseSummariesQuery.optional(),
    }),
  )
  .output(zReleaseServiceListReleaseSummariesResponse)

export const listReleases = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'ReleaseService_ListReleases',
    path: '/enterprise/app-deploy/appInstances/{appInstanceId}/releases',
    tags: ['ReleaseService'],
  })
  .input(
    z.object({
      params: zReleaseServiceListReleasesPath,
      query: zReleaseServiceListReleasesQuery.optional(),
    }),
  )
  .output(zReleaseServiceListReleasesResponse)

export const computeReleaseDeploymentView = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'ReleaseService_ComputeReleaseDeploymentView',
    path: '/enterprise/app-deploy/appInstances/{appInstanceId}:computeReleaseDeploymentView',
    tags: ['ReleaseService'],
  })
  .input(
    z.object({
      params: zReleaseServiceComputeReleaseDeploymentViewPath,
      query: zReleaseServiceComputeReleaseDeploymentViewQuery.optional(),
    }),
  )
  .output(zReleaseServiceComputeReleaseDeploymentViewResponse)

export const createRelease = oc
  .route({
    inputStructure: 'detailed',
    method: 'POST',
    operationId: 'ReleaseService_CreateRelease',
    path: '/enterprise/app-deploy/releases',
    tags: ['ReleaseService'],
  })
  .input(z.object({ body: zReleaseServiceCreateReleaseBody }))
  .output(zReleaseServiceCreateReleaseResponse)

export const deleteRelease = oc
  .route({
    inputStructure: 'detailed',
    method: 'DELETE',
    operationId: 'ReleaseService_DeleteRelease',
    path: '/enterprise/app-deploy/releases/{releaseId}',
    tags: ['ReleaseService'],
  })
  .input(z.object({ params: zReleaseServiceDeleteReleasePath }))
  .output(zReleaseServiceDeleteReleaseResponse)

export const getRelease = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'ReleaseService_GetRelease',
    path: '/enterprise/app-deploy/releases/{releaseId}',
    tags: ['ReleaseService'],
  })
  .input(z.object({ params: zReleaseServiceGetReleasePath }))
  .output(zReleaseServiceGetReleaseResponse)

export const updateRelease = oc
  .route({
    inputStructure: 'detailed',
    method: 'PATCH',
    operationId: 'ReleaseService_UpdateRelease',
    path: '/enterprise/app-deploy/releases/{releaseId}',
    tags: ['ReleaseService'],
  })
  .input(
    z.object({ body: zReleaseServiceUpdateReleaseBody, params: zReleaseServiceUpdateReleasePath }),
  )
  .output(zReleaseServiceUpdateReleaseResponse)

export const exportReleaseDsl = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'ReleaseService_ExportReleaseDSL',
    path: '/enterprise/app-deploy/releases/{releaseId}:exportDsl',
    tags: ['ReleaseService'],
  })
  .input(z.object({ params: zReleaseServiceExportReleaseDslPath }))
  .output(zReleaseServiceExportReleaseDslResponse)

export const listReleaseCredentialCandidates = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'ReleaseService_ListReleaseCredentialCandidates',
    path: '/enterprise/app-deploy/releases/{releaseId}:listCredentialCandidates',
    tags: ['ReleaseService'],
  })
  .input(z.object({ params: zReleaseServiceListReleaseCredentialCandidatesPath }))
  .output(zReleaseServiceListReleaseCredentialCandidatesResponse)

export const computeDeploymentOptions = oc
  .route({
    inputStructure: 'detailed',
    method: 'POST',
    operationId: 'ReleaseService_ComputeDeploymentOptions',
    path: '/enterprise/app-deploy/releases:computeDeploymentOptions',
    tags: ['ReleaseService'],
  })
  .input(z.object({ body: zReleaseServiceComputeDeploymentOptionsBody }))
  .output(zReleaseServiceComputeDeploymentOptionsResponse)

export const precheckRelease = oc
  .route({
    inputStructure: 'detailed',
    method: 'POST',
    operationId: 'ReleaseService_PrecheckRelease',
    path: '/enterprise/app-deploy/releases:precheck',
    tags: ['ReleaseService'],
  })
  .input(z.object({ body: zReleaseServicePrecheckReleaseBody }))
  .output(zReleaseServicePrecheckReleaseResponse)

export const releaseService = {
  listReleaseSummaries,
  listReleases,
  computeReleaseDeploymentView,
  createRelease,
  deleteRelease,
  getRelease,
  updateRelease,
  exportReleaseDsl,
  listReleaseCredentialCandidates,
  computeDeploymentOptions,
  precheckRelease,
}

export const listEnvironments = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'EnvironmentService_ListEnvironments',
    path: '/enterprise/app-deploy/environments',
    tags: ['EnvironmentService'],
  })
  .input(z.object({ query: zEnvironmentServiceListEnvironmentsQuery.optional() }))
  .output(zEnvironmentServiceListEnvironmentsResponse)

export const environmentService = {
  listEnvironments,
}

export const oAuth2Login = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'ConsoleSSO_OAuth2Login',
    path: '/enterprise/sso/oauth2/login',
    tags: ['ConsoleSSO'],
  })
  .output(zConsoleSsoOAuth2LoginResponse)

export const oidcLogin = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'ConsoleSSO_OIDCLogin',
    path: '/enterprise/sso/oidc/login',
    tags: ['ConsoleSSO'],
  })
  .output(zConsoleSsoOidcLoginResponse)

export const samlLogin = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'ConsoleSSO_SAMLLogin',
    path: '/enterprise/sso/saml/login',
    tags: ['ConsoleSSO'],
  })
  .output(zConsoleSsoSamlLoginResponse)

export const consoleSso = {
  oAuth2Login,
  oidcLogin,
  samlLogin,
}

export const getWebAppAccessMode = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'WebAppAuth_GetWebAppAccessMode',
    path: '/enterprise/webapp/app/access-mode',
    tags: ['WebAppAuth'],
  })
  .input(z.object({ query: zWebAppAuthGetWebAppAccessModeQuery.optional() }))
  .output(zWebAppAuthGetWebAppAccessModeResponse)

export const updateWebAppWhitelistSubjects = oc
  .route({
    inputStructure: 'detailed',
    method: 'POST',
    operationId: 'WebAppAuth_UpdateWebAppWhitelistSubjects',
    path: '/enterprise/webapp/app/access-mode',
    tags: ['WebAppAuth'],
  })
  .input(z.object({ body: zWebAppAuthUpdateWebAppWhitelistSubjectsBody }))
  .output(zWebAppAuthUpdateWebAppWhitelistSubjectsResponse)

export const searchForWhilteListCandidates = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'WebAppAuth_SearchForWhilteListCandidates',
    path: '/enterprise/webapp/app/subject/search',
    tags: ['WebAppAuth'],
  })
  .input(z.object({ query: zWebAppAuthSearchForWhilteListCandidatesQuery.optional() }))
  .output(zWebAppAuthSearchForWhilteListCandidatesResponse)

export const getWebAppWhitelistSubjects = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'WebAppAuth_GetWebAppWhitelistSubjects',
    path: '/enterprise/webapp/app/subjects',
    tags: ['WebAppAuth'],
  })
  .input(z.object({ query: zWebAppAuthGetWebAppWhitelistSubjectsQuery.optional() }))
  .output(zWebAppAuthGetWebAppWhitelistSubjectsResponse)

export const getGroupSubjects = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'WebAppAuth_GetGroupSubjects',
    path: '/enterprise/webapp/group/subjects',
    tags: ['WebAppAuth'],
  })
  .input(z.object({ query: zWebAppAuthGetGroupSubjectsQuery.optional() }))
  .output(zWebAppAuthGetGroupSubjectsResponse)

export const isUserAllowedToAccessWebApp = oc
  .route({
    inputStructure: 'detailed',
    method: 'GET',
    operationId: 'WebAppAuth_IsUserAllowedToAccessWebApp',
    path: '/enterprise/webapp/permission',
    tags: ['WebAppAuth'],
  })
  .input(z.object({ query: zWebAppAuthIsUserAllowedToAccessWebAppQuery.optional() }))
  .output(zWebAppAuthIsUserAllowedToAccessWebAppResponse)

export const webAppAuth = {
  getWebAppAccessMode,
  updateWebAppWhitelistSubjects,
  searchForWhilteListCandidates,
  getWebAppWhitelistSubjects,
  getGroupSubjects,
  isUserAllowedToAccessWebApp,
}

export const contract = {
  appInstanceService,
  accessService,
  deploymentService,
  releaseService,
  environmentService,
  consoleSso,
  webAppAuth,
}
