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

import * as z from 'zod'

/**
 * AgentProviderResponse
 */
export const zAgentProviderResponse = z.record(z.string(), z.unknown())

/**
 * AgentProviderListResponse
 */
export const zAgentProviderListResponse = z.array(z.record(z.string(), z.unknown()))

/**
 * SnippetImportPayload
 *
 * Payload for importing snippet from DSL.
 */
export const zSnippetImportPayload = z.object({
  description: z.string().nullish(),
  mode: z.string(),
  name: z.string().nullish(),
  snippet_id: z.string().nullish(),
  yaml_content: z.string().nullish(),
  yaml_url: z.string().nullish(),
})

/**
 * SnippetImportResponse
 */
export const zSnippetImportResponse = z.record(z.string(), z.unknown())

/**
 * SnippetDependencyCheckResponse
 */
export const zSnippetDependencyCheckResponse = z.record(z.string(), z.unknown())

/**
 * TextFileResponse
 */
export const zTextFileResponse = z.string()

/**
 * SnippetUseCountResponse
 */
export const zSnippetUseCountResponse = z.object({
  result: z.string(),
  use_count: z.int(),
})

/**
 * SimpleResultResponse
 */
export const zSimpleResultResponse = z.object({
  result: z.string(),
})

/**
 * EndpointCreatePayload
 */
export const zEndpointCreatePayload = z.object({
  name: z.string().min(1),
  plugin_unique_identifier: z.string(),
  settings: z.record(z.string(), z.unknown()),
})

/**
 * EndpointCreateResponse
 */
export const zEndpointCreateResponse = z.object({
  success: z.boolean(),
})

/**
 * EndpointIdPayload
 */
export const zEndpointIdPayload = z.object({
  endpoint_id: z.string(),
})

/**
 * EndpointDeleteResponse
 */
export const zEndpointDeleteResponse = z.object({
  success: z.boolean(),
})

/**
 * EndpointDisableResponse
 */
export const zEndpointDisableResponse = z.object({
  success: z.boolean(),
})

/**
 * EndpointEnableResponse
 */
export const zEndpointEnableResponse = z.object({
  success: z.boolean(),
})

/**
 * EndpointListResponse
 */
export const zEndpointListResponse = z.object({
  endpoints: z.array(z.record(z.string(), z.unknown())),
})

/**
 * PluginEndpointListResponse
 */
export const zPluginEndpointListResponse = z.object({
  endpoints: z.array(z.record(z.string(), z.unknown())),
})

/**
 * LegacyEndpointUpdatePayload
 */
export const zLegacyEndpointUpdatePayload = z.object({
  endpoint_id: z.string(),
  name: z.string().min(1),
  settings: z.record(z.string(), z.unknown()),
})

/**
 * EndpointUpdateResponse
 */
export const zEndpointUpdateResponse = z.object({
  success: z.boolean(),
})

/**
 * EndpointUpdatePayload
 */
export const zEndpointUpdatePayload = z.object({
  name: z.string().min(1),
  settings: z.record(z.string(), z.unknown()),
})

/**
 * OwnerTransferCheckPayload
 */
export const zOwnerTransferCheckPayload = z.object({
  code: z.string(),
  token: z.string(),
})

/**
 * VerificationTokenResponse
 */
export const zVerificationTokenResponse = z.object({
  email: z.string(),
  is_valid: z.boolean(),
  token: z.string(),
})

/**
 * OwnerTransferEmailPayload
 */
export const zOwnerTransferEmailPayload = z.object({
  language: z.string().nullish(),
})

/**
 * SimpleResultDataResponse
 */
export const zSimpleResultDataResponse = z.object({
  data: z.string(),
  result: z.string(),
})

/**
 * MemberActionTenantResponse
 */
export const zMemberActionTenantResponse = z.object({
  result: z.string(),
  tenant_id: z.string(),
})

/**
 * OwnerTransferPayload
 */
export const zOwnerTransferPayload = z.object({
  token: z.string(),
})

/**
 * MemberRoleUpdatePayload
 */
export const zMemberRoleUpdatePayload = z.object({
  role: z.string(),
})

/**
 * ModelProviderPaymentCheckoutUrlResponse
 */
export const zModelProviderPaymentCheckoutUrlResponse = z.object({
  payment_link: z.string(),
})

/**
 * ParserCredentialDelete
 */
export const zParserCredentialDelete = z.object({
  credential_id: z.string(),
})

/**
 * ProviderCredentialResponse
 */
export const zProviderCredentialResponse = z.object({
  credentials: z.record(z.string(), z.unknown()).nullish(),
})

/**
 * ParserCredentialCreate
 */
export const zParserCredentialCreate = z.object({
  credentials: z.record(z.string(), z.unknown()),
  name: z.string().max(30).nullish(),
})

/**
 * ParserCredentialUpdate
 */
export const zParserCredentialUpdate = z.object({
  credential_id: z.string(),
  credentials: z.record(z.string(), z.unknown()),
  name: z.string().max(30).nullish(),
})

/**
 * ParserCredentialSwitch
 */
export const zParserCredentialSwitch = z.object({
  credential_id: z.string(),
})

/**
 * ParserCredentialValidate
 */
export const zParserCredentialValidate = z.object({
  credentials: z.record(z.string(), z.unknown()),
})

/**
 * ProviderCredentialValidateResponse
 */
export const zProviderCredentialValidateResponse = z.object({
  error: z.string().nullish(),
  result: z.enum(['error', 'success']),
})

/**
 * ModelCredentialValidateResponse
 */
export const zModelCredentialValidateResponse = z.object({
  error: z.string().nullish(),
  result: z.string(),
})

/**
 * LoadBalancingCredentialValidateResponse
 */
export const zLoadBalancingCredentialValidateResponse = z.object({
  error: z.string().nullish(),
  result: z.string(),
})

/**
 * ParserPreferredProviderType
 */
export const zParserPreferredProviderType = z.object({
  preferred_provider_type: z.enum(['custom', 'system']),
})

/**
 * WorkspacePermissionResponse
 */
export const zWorkspacePermissionResponse = z.object({
  allow_member_invite: z.boolean(),
  allow_owner_transfer: z.boolean(),
  workspace_id: z.string(),
})

/**
 * BinaryFileResponse
 */
export const zBinaryFileResponse = z.custom<Blob | File>()

/**
 * PluginDebuggingKeyResponse
 */
export const zPluginDebuggingKeyResponse = z.object({
  host: z.string(),
  key: z.string(),
  port: z.int(),
})

/**
 * PluginManifestResponse
 */
export const zPluginManifestResponse = z.object({
  manifest: z.unknown(),
})

/**
 * ParserGithubInstall
 */
export const zParserGithubInstall = z.object({
  package: z.string(),
  plugin_unique_identifier: z.string(),
  repo: z.string(),
  version: z.string(),
})

/**
 * PluginDaemonOperationResponse
 */
export const zPluginDaemonOperationResponse = z.unknown()

/**
 * ParserPluginIdentifiers
 */
export const zParserPluginIdentifiers = z.object({
  plugin_unique_identifiers: z.array(z.string()),
})

/**
 * PluginListResponse
 */
export const zPluginListResponse = z.object({
  plugins: z.unknown(),
  total: z.int(),
})

/**
 * ParserLatest
 */
export const zParserLatest = z.object({
  plugin_ids: z.array(z.string()),
})

/**
 * PluginInstallationsResponse
 */
export const zPluginInstallationsResponse = z.object({
  plugins: z.unknown(),
})

/**
 * PluginVersionsResponse
 */
export const zPluginVersionsResponse = z.object({
  versions: z.unknown(),
})

/**
 * PluginDynamicOptionsResponse
 */
export const zPluginDynamicOptionsResponse = z.object({
  options: z.unknown(),
})

/**
 * ParserDynamicOptionsWithCredentials
 */
export const zParserDynamicOptionsWithCredentials = z.object({
  action: z.string(),
  credential_id: z.string(),
  credentials: z.record(z.string(), z.unknown()),
  parameter: z.string(),
  plugin_id: z.string(),
  provider: z.string(),
})

/**
 * SuccessResponse
 */
export const zSuccessResponse = z.object({
  success: z.boolean(),
})

/**
 * ParserExcludePlugin
 */
export const zParserExcludePlugin = z.object({
  plugin_id: z.string(),
})

/**
 * PluginOperationSuccessResponse
 */
export const zPluginOperationSuccessResponse = z.object({
  message: z.string().nullish(),
  success: z.boolean(),
})

/**
 * PluginReadmeResponse
 */
export const zPluginReadmeResponse = z.object({
  readme: z.string(),
})

/**
 * PluginTasksResponse
 */
export const zPluginTasksResponse = z.object({
  tasks: z.unknown(),
})

/**
 * PluginTaskResponse
 */
export const zPluginTaskResponse = z.object({
  task: z.unknown(),
})

/**
 * ParserUninstall
 */
export const zParserUninstall = z.object({
  plugin_installation_id: z.string(),
})

/**
 * ParserGithubUpgrade
 */
export const zParserGithubUpgrade = z.object({
  new_plugin_unique_identifier: z.string(),
  original_plugin_unique_identifier: z.string(),
  package: z.string(),
  repo: z.string(),
  version: z.string(),
})

/**
 * ParserMarketplaceUpgrade
 */
export const zParserMarketplaceUpgrade = z.object({
  new_plugin_unique_identifier: z.string(),
  original_plugin_unique_identifier: z.string(),
})

/**
 * ParserGithubUpload
 */
export const zParserGithubUpload = z.object({
  package: z.string(),
  repo: z.string(),
  version: z.string(),
})

/**
 * ToolProviderOpaqueResponse
 */
export const zToolProviderOpaqueResponse = z.unknown()

/**
 * ApiToolProviderDeletePayload
 */
export const zApiToolProviderDeletePayload = z.object({
  provider: z.string(),
})

/**
 * ApiToolSchemaPayload
 */
export const zApiToolSchemaPayload = z.object({
  schema: z.string(),
})

/**
 * BuiltinProviderDefaultCredentialPayload
 */
export const zBuiltinProviderDefaultCredentialPayload = z.object({
  id: z.string(),
})

/**
 * BuiltinToolCredentialDeletePayload
 */
export const zBuiltinToolCredentialDeletePayload = z.object({
  credential_id: z.string(),
})

/**
 * ToolOAuthClientSchemaResponse
 */
export const zToolOAuthClientSchemaResponse = z.array(z.record(z.string(), z.unknown()))

/**
 * ToolOAuthCustomClientResponse
 */
export const zToolOAuthCustomClientResponse = z.record(z.string(), z.unknown())

/**
 * ToolOAuthCustomClientPayload
 */
export const zToolOAuthCustomClientPayload = z.object({
  client_params: z.record(z.string(), z.unknown()).nullish(),
  enable_oauth_custom_client: z.boolean().nullish().default(true),
})

/**
 * BuiltinToolUpdatePayload
 */
export const zBuiltinToolUpdatePayload = z.object({
  credential_id: z.string(),
  credentials: z.record(z.string(), z.unknown()).nullish(),
  name: z.string().max(30).nullish(),
})

/**
 * MCPProviderDeletePayload
 */
export const zMcpProviderDeletePayload = z.object({
  provider_id: z.string(),
})

/**
 * MCPAuthPayload
 */
export const zMcpAuthPayload = z.object({
  authorization_code: z.string().nullish(),
  provider_id: z.string(),
})

/**
 * WorkflowToolDeletePayload
 */
export const zWorkflowToolDeletePayload = z.object({
  workflow_tool_id: z.string(),
})

/**
 * TriggerProviderOpaqueResponse
 */
export const zTriggerProviderOpaqueResponse = z.unknown()

/**
 * TriggerOAuthClientResponse
 */
export const zTriggerOAuthClientResponse = z.object({
  configured: z.boolean(),
  custom_configured: z.boolean(),
  custom_enabled: z.boolean(),
  oauth_client_schema: z.unknown(),
  params: z.record(z.string(), z.unknown()),
  redirect_uri: z.string(),
  system_configured: z.boolean(),
})

/**
 * TriggerOAuthClientPayload
 */
export const zTriggerOAuthClientPayload = z.object({
  client_params: z.record(z.string(), z.unknown()).nullish(),
  enabled: z.boolean().nullish(),
})

/**
 * TriggerSubscriptionBuilderUpdatePayload
 */
export const zTriggerSubscriptionBuilderUpdatePayload = z.object({
  credentials: z.record(z.string(), z.unknown()).nullish(),
  name: z.string().nullish(),
  parameters: z.record(z.string(), z.unknown()).nullish(),
  properties: z.record(z.string(), z.unknown()).nullish(),
})

/**
 * TriggerSubscriptionBuilderCreatePayload
 */
export const zTriggerSubscriptionBuilderCreatePayload = z.object({
  credential_type: z.string().optional().default('unauthorized'),
})

/**
 * TriggerSubscriptionBuilderVerifyPayload
 */
export const zTriggerSubscriptionBuilderVerifyPayload = z.object({
  credentials: z.record(z.string(), z.unknown()),
})

/**
 * TriggerOAuthAuthorizeResponse
 */
export const zTriggerOAuthAuthorizeResponse = z.object({
  authorization_url: z.string(),
  subscription_builder: z.unknown(),
  subscription_builder_id: z.string(),
})

/**
 * WorkspaceCustomConfigPayload
 */
export const zWorkspaceCustomConfigPayload = z.object({
  remove_webapp_brand: z.boolean().nullish(),
  replace_webapp_logo: z.string().nullish(),
})

/**
 * WorkspaceLogoUploadResponse
 */
export const zWorkspaceLogoUploadResponse = z.object({
  id: z.string(),
})

/**
 * WorkspaceInfoPayload
 */
export const zWorkspaceInfoPayload = z.object({
  name: z.string(),
})

/**
 * SwitchWorkspacePayload
 */
export const zSwitchWorkspacePayload = z.object({
  tenant_id: z.string(),
})

/**
 * TenantListItemResponse
 */
export const zTenantListItemResponse = z.object({
  created_at: z.int().nullish(),
  current: z.boolean(),
  id: z.string(),
  name: z.string().nullish(),
  plan: z.string().nullish(),
  status: z.string().nullish(),
})

/**
 * TenantListResponse
 */
export const zTenantListResponse = z.object({
  workspaces: z.array(zTenantListItemResponse),
})

/**
 * WorkspaceCustomConfigResponse
 */
export const zWorkspaceCustomConfigResponse = z.object({
  remove_webapp_brand: z.boolean().nullish(),
  replace_webapp_logo: z.string().nullish(),
})

/**
 * TenantInfoResponse
 */
export const zTenantInfoResponse = z.object({
  created_at: z.int().nullish(),
  custom_config: zWorkspaceCustomConfigResponse.nullish(),
  id: z.string(),
  in_trial: z.boolean().nullish(),
  name: z.string().nullish(),
  next_credit_reset_date: z.int().nullish(),
  plan: z.string().nullish(),
  role: z.string().nullish(),
  status: z.string().nullish(),
  trial_credits: z.int().nullish(),
  trial_credits_used: z.int().nullish(),
  trial_end_reason: z.string().nullish(),
})

/**
 * WorkspaceMutationResponse
 */
export const zWorkspaceMutationResponse = z.object({
  result: z.string(),
  tenant: zTenantInfoResponse,
})

/**
 * SwitchWorkspaceResponse
 */
export const zSwitchWorkspaceResponse = z.object({
  new_tenant: zTenantInfoResponse,
  result: z.string(),
})

/**
 * IconInfo
 *
 * Icon information model.
 */
export const zIconInfo = z.object({
  icon: z.string().nullish(),
  icon_background: z.string().nullish(),
  icon_type: z.enum(['emoji', 'image']).nullish(),
  icon_url: z.string().nullish(),
})

/**
 * UpdateSnippetPayload
 *
 * Payload for updating a snippet.
 */
export const zUpdateSnippetPayload = z.object({
  description: z.string().max(2000).nullish(),
  icon_info: zIconInfo.nullish(),
  name: z.string().min(1).max(255).nullish(),
})

/**
 * InputFieldDefinition
 *
 * Input field definition for snippet parameters.
 */
export const zInputFieldDefinition = z.object({
  default: z.string().nullish(),
  hint: z.boolean().nullish(),
  label: z.string().nullish(),
  max_length: z.int().nullish(),
  options: z.array(z.string()).nullish(),
  placeholder: z.string().nullish(),
  required: z.boolean().nullish(),
  type: z.string().nullish(),
})

/**
 * CreateSnippetPayload
 *
 * Payload for creating a new snippet.
 */
export const zCreateSnippetPayload = z.object({
  description: z.string().max(2000).nullish(),
  graph: z.record(z.string(), z.unknown()).nullish(),
  icon_info: zIconInfo.nullish(),
  input_fields: z.array(zInputFieldDefinition).nullish(),
  name: z.string().min(1).max(255),
  type: z.enum(['group', 'node']).optional().default('node'),
})

export const zAnonymousInlineModelB0Fd3F86D9D5 = z.object({
  email: z.string().optional(),
  id: z.string().optional(),
  name: z.string().optional(),
})

export const zAnonymousInlineModel7B8B49Ca164e = z.object({
  id: z.string().optional(),
  name: z.string().optional(),
  type: z.string().optional(),
})

export const zSnippet = z.object({
  created_at: z.coerce
    .bigint()
    .min(BigInt('-9223372036854775808'), {
      error: 'Invalid value: Expected int64 to be >= -9223372036854775808',
    })
    .max(BigInt('9223372036854775807'), {
      error: 'Invalid value: Expected int64 to be <= 9223372036854775807',
    })
    .optional(),
  created_by: zAnonymousInlineModelB0Fd3F86D9D5.optional(),
  description: z.string().optional(),
  graph: z.record(z.string(), z.unknown()).optional(),
  icon_info: z.record(z.string(), z.unknown()).optional(),
  id: z.string().optional(),
  input_fields: z.record(z.string(), z.unknown()).optional(),
  is_published: z.boolean().optional(),
  name: z.string().optional(),
  tags: z.array(zAnonymousInlineModel7B8B49Ca164e).optional(),
  type: z.string().optional(),
  updated_at: z.coerce
    .bigint()
    .min(BigInt('-9223372036854775808'), {
      error: 'Invalid value: Expected int64 to be >= -9223372036854775808',
    })
    .max(BigInt('9223372036854775807'), {
      error: 'Invalid value: Expected int64 to be <= 9223372036854775807',
    })
    .optional(),
  updated_by: zAnonymousInlineModelB0Fd3F86D9D5.optional(),
  use_count: z.int().optional(),
  version: z.int().optional(),
})

export const zAnonymousInlineModelEfd591151Ea9 = z.object({
  author_name: z.string().optional(),
  created_at: z.coerce
    .bigint()
    .min(BigInt('-9223372036854775808'), {
      error: 'Invalid value: Expected int64 to be >= -9223372036854775808',
    })
    .max(BigInt('9223372036854775807'), {
      error: 'Invalid value: Expected int64 to be <= 9223372036854775807',
    })
    .optional(),
  created_by: z.string().optional(),
  description: z.string().optional(),
  icon_info: z.record(z.string(), z.unknown()).optional(),
  id: z.string().optional(),
  is_published: z.boolean().optional(),
  name: z.string().optional(),
  tags: z.array(zAnonymousInlineModel7B8B49Ca164e).optional(),
  type: z.string().optional(),
  updated_at: z.coerce
    .bigint()
    .min(BigInt('-9223372036854775808'), {
      error: 'Invalid value: Expected int64 to be >= -9223372036854775808',
    })
    .max(BigInt('9223372036854775807'), {
      error: 'Invalid value: Expected int64 to be <= 9223372036854775807',
    })
    .optional(),
  updated_by: z.string().optional(),
  use_count: z.int().optional(),
  version: z.int().optional(),
})

export const zSnippetPagination = z.object({
  data: z.array(zAnonymousInlineModelEfd591151Ea9).optional(),
  has_more: z.boolean().optional(),
  limit: z.int().optional(),
  page: z.int().optional(),
  total: z.int().optional(),
})

/**
 * AccountWithRole
 */
export const zAccountWithRole = z.object({
  avatar: z.string().nullish(),
  created_at: z.int().nullish(),
  email: z.string(),
  id: z.string(),
  last_active_at: z.int().nullish(),
  last_login_at: z.int().nullish(),
  name: z.string(),
  role: z.string(),
  status: z.string(),
})

/**
 * AccountWithRoleList
 */
export const zAccountWithRoleList = z.object({
  accounts: z.array(zAccountWithRole),
})

/**
 * TenantAccountRole
 */
export const zTenantAccountRole = z.enum(['admin', 'dataset_operator', 'editor', 'normal', 'owner'])

/**
 * MemberInvitePayload
 */
export const zMemberInvitePayload = z.object({
  emails: z.array(z.string()).optional(),
  language: z.string().nullish(),
  role: zTenantAccountRole,
})

/**
 * MemberInviteResultResponse
 */
export const zMemberInviteResultResponse = z.object({
  email: z.string(),
  message: z.string().nullish(),
  status: z.string(),
  url: z.string().nullish(),
})

/**
 * MemberInviteResponse
 */
export const zMemberInviteResponse = z.object({
  invitation_results: z.array(zMemberInviteResultResponse),
  result: z.string(),
  tenant_id: z.string(),
})

/**
 * ModelType
 *
 * Enum class for model type.
 */
export const zModelType = z.enum([
  'llm',
  'moderation',
  'rerank',
  'speech2text',
  'text-embedding',
  'tts',
])

/**
 * ParserDeleteModels
 */
export const zParserDeleteModels = z.object({
  model: z.string(),
  model_type: zModelType,
})

/**
 * ParserDeleteCredential
 */
export const zParserDeleteCredential = z.object({
  credential_id: z.string(),
  model: z.string(),
  model_type: zModelType,
})

/**
 * ParserCreateCredential
 */
export const zParserCreateCredential = z.object({
  credentials: z.record(z.string(), z.unknown()),
  model: z.string(),
  model_type: zModelType,
  name: z.string().max(30).nullish(),
})

/**
 * ParserUpdateCredential
 */
export const zParserUpdateCredential = z.object({
  credential_id: z.string(),
  credentials: z.record(z.string(), z.unknown()),
  model: z.string(),
  model_type: zModelType,
  name: z.string().max(30).nullish(),
})

/**
 * ParserSwitch
 */
export const zParserSwitch = z.object({
  credential_id: z.string(),
  model: z.string(),
  model_type: zModelType,
})

/**
 * ParserValidate
 */
export const zParserValidate = z.object({
  credentials: z.record(z.string(), z.unknown()),
  model: z.string(),
  model_type: zModelType,
})

/**
 * LoadBalancingCredentialPayload
 */
export const zLoadBalancingCredentialPayload = z.object({
  credentials: z.record(z.string(), z.unknown()),
  model: z.string(),
  model_type: zModelType,
})

/**
 * Inner
 */
export const zInner = z.object({
  model: z.string().nullish(),
  model_type: zModelType,
  provider: z.string().nullish(),
})

/**
 * ParserPostDefault
 */
export const zParserPostDefault = z.object({
  model_settings: z.array(zInner),
})

/**
 * LoadBalancingPayload
 */
export const zLoadBalancingPayload = z.object({
  configs: z.array(z.record(z.string(), z.unknown())).nullish(),
  enabled: z.boolean().nullish(),
})

/**
 * ParserPostModels
 */
export const zParserPostModels = z.object({
  config_from: z.string().nullish(),
  credential_id: z.string().nullish(),
  load_balancing: zLoadBalancingPayload.nullish(),
  model: z.string(),
  model_type: zModelType,
})

/**
 * CredentialConfiguration
 *
 * Model class for credential configuration.
 */
export const zCredentialConfiguration = z.object({
  credential_id: z.string(),
  credential_name: z.string(),
})

/**
 * ModelCredentialLoadBalancingResponse
 */
export const zModelCredentialLoadBalancingResponse = z.object({
  configs: z.array(z.record(z.string(), z.unknown())).optional(),
  enabled: z.boolean(),
})

/**
 * ModelCredentialResponse
 */
export const zModelCredentialResponse = z.object({
  available_credentials: z.array(zCredentialConfiguration),
  credentials: z.record(z.string(), z.unknown()).optional(),
  current_credential_id: z.string().nullish(),
  current_credential_name: z.string().nullish(),
  load_balancing: zModelCredentialLoadBalancingResponse,
})

/**
 * DebugPermission
 */
export const zDebugPermission = z.enum(['admins', 'everyone', 'noone'])

/**
 * InstallPermission
 */
export const zInstallPermission = z.enum(['admins', 'everyone', 'noone'])

/**
 * ParserPermissionChange
 */
export const zParserPermissionChange = z.object({
  debug_permission: zDebugPermission,
  install_permission: zInstallPermission,
})

/**
 * PluginPermissionResponse
 */
export const zPluginPermissionResponse = z.object({
  debug_permission: zDebugPermission,
  install_permission: zInstallPermission,
})

/**
 * PluginPermissionSettingsPayload
 */
export const zPluginPermissionSettingsPayload = z.object({
  debug_permission: zDebugPermission.optional().default('everyone'),
  install_permission: zInstallPermission.optional().default('everyone'),
})

/**
 * ApiProviderSchemaType
 *
 * Enum class for api provider schema type.
 */
export const zApiProviderSchemaType = z.enum([
  'openai_actions',
  'openai_plugin',
  'openapi',
  'swagger',
])

/**
 * ApiToolProviderAddPayload
 */
export const zApiToolProviderAddPayload = z.object({
  credentials: z.record(z.string(), z.unknown()),
  custom_disclaimer: z.string().optional().default(''),
  icon: z.record(z.string(), z.unknown()),
  labels: z.array(z.string()).nullish(),
  privacy_policy: z.string().nullish(),
  provider: z.string(),
  schema: z.string(),
  schema_type: zApiProviderSchemaType,
})

/**
 * ApiToolTestPayload
 */
export const zApiToolTestPayload = z.object({
  credentials: z.record(z.string(), z.unknown()),
  parameters: z.record(z.string(), z.unknown()),
  provider_name: z.string().nullish(),
  schema: z.string(),
  schema_type: zApiProviderSchemaType,
  tool_name: z.string(),
})

/**
 * ApiToolProviderUpdatePayload
 */
export const zApiToolProviderUpdatePayload = z.object({
  credentials: z.record(z.string(), z.unknown()),
  custom_disclaimer: z.string().optional().default(''),
  icon: z.record(z.string(), z.unknown()),
  labels: z.array(z.string()).nullish(),
  original_provider: z.string(),
  privacy_policy: z.string().nullish(),
  provider: z.string(),
  schema: z.string(),
  schema_type: zApiProviderSchemaType,
})

/**
 * CredentialType
 */
export const zCredentialType = z.enum(['api-key', 'oauth2', 'unauthorized'])

/**
 * BuiltinToolAddPayload
 */
export const zBuiltinToolAddPayload = z.object({
  credentials: z.record(z.string(), z.unknown()),
  name: z.string().max(30).nullish(),
  type: zCredentialType,
  visibility: z.string().nullish(),
})

/**
 * IdentityMode
 *
 * How Dify forwards the end-user's identity to an MCP server.
 */
export const zIdentityMode = z.enum(['idp_token', 'off'])

/**
 * MCPProviderCreatePayload
 */
export const zMcpProviderCreatePayload = z.object({
  authentication: z.record(z.string(), z.unknown()).nullish(),
  configuration: z.record(z.string(), z.unknown()).nullish(),
  headers: z.record(z.string(), z.unknown()).nullish(),
  icon: z.string(),
  icon_background: z.string().optional().default(''),
  icon_type: z.string(),
  identity_mode: zIdentityMode.nullish(),
  name: z.string(),
  server_identifier: z.string(),
  server_url: z.string(),
})

/**
 * MCPProviderUpdatePayload
 */
export const zMcpProviderUpdatePayload = z.object({
  authentication: z.record(z.string(), z.unknown()).nullish(),
  configuration: z.record(z.string(), z.unknown()).nullish(),
  headers: z.record(z.string(), z.unknown()).nullish(),
  icon: z.string(),
  icon_background: z.string().optional().default(''),
  icon_type: z.string(),
  identity_mode: zIdentityMode.nullish(),
  name: z.string(),
  provider_id: z.string(),
  server_identifier: z.string(),
  server_url: z.string(),
})

/**
 * ConfigurateMethod
 *
 * Enum class for configurate method of provider model.
 */
export const zConfigurateMethod = z.enum(['customizable-model', 'predefined-model'])

/**
 * I18nObject
 *
 * Model class for i18n object.
 */
export const zI18nObject = z.object({
  en_US: z.string(),
  zh_Hans: z.string().nullish(),
})

/**
 * ProviderHelpEntity
 *
 * Model class for provider help.
 */
export const zProviderHelpEntity = z.object({
  title: zI18nObject,
  url: zI18nObject,
})

/**
 * ProviderType
 */
export const zProviderType = z.enum(['custom', 'system'])

/**
 * ModelFeature
 *
 * Enum class for llm feature.
 */
export const zModelFeature = z.enum([
  'agent-thought',
  'audio',
  'document',
  'multi-tool-call',
  'polling',
  'stream-tool-call',
  'structured-output',
  'tool-call',
  'video',
  'vision',
])

/**
 * FetchFrom
 *
 * Enum class for fetch from.
 */
export const zFetchFrom = z.enum(['customizable-model', 'predefined-model'])

/**
 * ModelPropertyKey
 *
 * Enum class for model property key.
 */
export const zModelPropertyKey = z.enum([
  'audio_type',
  'context_size',
  'default_voice',
  'file_upload_limit',
  'max_characters_per_chunk',
  'max_chunks',
  'max_workers',
  'mode',
  'supported_file_extensions',
  'voices',
  'word_limit',
])

/**
 * ModelStatus
 *
 * Enum class for model status.
 */
export const zModelStatus = z.enum([
  'active',
  'credential-removed',
  'disabled',
  'no-configure',
  'no-permission',
  'quota-exceeded',
])

/**
 * ParameterType
 *
 * Enum class for parameter type.
 */
export const zParameterType = z.enum(['boolean', 'float', 'int', 'string', 'text'])

/**
 * ParameterRule
 *
 * Model class for parameter rule.
 */
export const zParameterRule = z.object({
  default: z.unknown().nullish(),
  help: zI18nObject.nullish(),
  label: zI18nObject,
  max: z.number().nullish(),
  min: z.number().nullish(),
  name: z.string(),
  options: z.array(z.string()).optional().default([]),
  precision: z.int().nullish(),
  required: z.boolean().optional().default(false),
  type: zParameterType,
  use_template: z.string().nullish(),
})

/**
 * ModelParameterRulesResponse
 */
export const zModelParameterRulesResponse = z.object({
  data: z.array(zParameterRule),
})

/**
 * ProviderModelWithStatusEntity
 *
 * Model class for model response.
 */
export const zProviderModelWithStatusEntity = z.object({
  deprecated: z.boolean().optional().default(false),
  features: z.array(zModelFeature).nullish(),
  fetch_from: zFetchFrom,
  has_invalid_load_balancing_configs: z.boolean().optional().default(false),
  label: zI18nObject,
  load_balancing_enabled: z.boolean().optional().default(false),
  model: z.string(),
  model_properties: z.record(z.string(), z.unknown()),
  model_type: zModelType,
  status: zModelStatus,
})

/**
 * CustomConfigurationStatus
 *
 * Enum class for custom configuration status.
 */
export const zCustomConfigurationStatus = z.enum(['active', 'no-configure'])

/**
 * ProviderWithModelsResponse
 *
 * Model class for provider with models response.
 */
export const zProviderWithModelsResponse = z.object({
  icon_small: zI18nObject.nullish(),
  icon_small_dark: zI18nObject.nullish(),
  label: zI18nObject,
  models: z.array(zProviderModelWithStatusEntity),
  provider: z.string(),
  status: zCustomConfigurationStatus,
  tenant_id: z.string(),
})

/**
 * ProviderWithModelsDataResponse
 */
export const zProviderWithModelsDataResponse = z.object({
  data: z.array(zProviderWithModelsResponse),
})

/**
 * StrategySetting
 */
export const zStrategySetting = z.enum(['disabled', 'fix_only', 'latest'])

/**
 * UpgradeMode
 */
export const zUpgradeMode = z.enum(['all', 'exclude', 'partial'])

/**
 * PluginAutoUpgradeSettingsPayload
 */
export const zPluginAutoUpgradeSettingsPayload = z.object({
  exclude_plugins: z.array(z.string()).optional(),
  include_plugins: z.array(z.string()).optional(),
  strategy_setting: zStrategySetting.optional().default('fix_only'),
  upgrade_mode: zUpgradeMode.optional().default('exclude'),
  upgrade_time_of_day: z.int().optional().default(0),
})

/**
 * ParserPreferencesChange
 */
export const zParserPreferencesChange = z.object({
  auto_upgrade: zPluginAutoUpgradeSettingsPayload,
  permission: zPluginPermissionSettingsPayload,
})

/**
 * PluginPreferencesResponse
 */
export const zPluginPreferencesResponse = z.object({
  auto_upgrade: zPluginAutoUpgradeSettingsPayload,
  permission: zPluginPermissionSettingsPayload,
})

/**
 * ToolParameterForm
 */
export const zToolParameterForm = z.enum(['form', 'llm', 'schema'])

/**
 * WorkflowToolParameterConfiguration
 *
 * Workflow tool configuration
 */
export const zWorkflowToolParameterConfiguration = z.object({
  description: z.string(),
  form: zToolParameterForm,
  name: z.string(),
})

/**
 * WorkflowToolCreatePayload
 */
export const zWorkflowToolCreatePayload = z.object({
  description: z.string(),
  icon: z.record(z.string(), z.unknown()),
  label: z.string(),
  labels: z.array(z.string()).nullish(),
  name: z.string(),
  parameters: z.array(zWorkflowToolParameterConfiguration).optional(),
  privacy_policy: z.string().nullish().default(''),
  workflow_app_id: z.string(),
})

/**
 * WorkflowToolUpdatePayload
 */
export const zWorkflowToolUpdatePayload = z.object({
  description: z.string(),
  icon: z.record(z.string(), z.unknown()),
  label: z.string(),
  labels: z.array(z.string()).nullish(),
  name: z.string(),
  parameters: z.array(zWorkflowToolParameterConfiguration).optional(),
  privacy_policy: z.string().nullish().default(''),
  workflow_tool_id: z.string(),
})

/**
 * UnaddedModelConfiguration
 *
 * Model class for provider unadded model configuration.
 */
export const zUnaddedModelConfiguration = z.object({
  model: z.string(),
  model_type: zModelType,
})

/**
 * CustomModelConfiguration
 *
 * Model class for provider custom model configuration.
 */
export const zCustomModelConfiguration = z.object({
  available_model_credentials: z.array(zCredentialConfiguration).optional().default([]),
  credentials: z.record(z.string(), z.unknown()).nullable(),
  current_credential_id: z.string().nullish(),
  current_credential_name: z.string().nullish(),
  model: z.string(),
  model_type: zModelType,
  unadded_to_model_list: z.boolean().nullish().default(false),
})

/**
 * CustomConfigurationResponse
 *
 * Model class for provider custom configuration response.
 */
export const zCustomConfigurationResponse = z.object({
  available_credentials: z.array(zCredentialConfiguration).nullish(),
  can_added_models: z.array(zUnaddedModelConfiguration).nullish(),
  current_credential_id: z.string().nullish(),
  current_credential_name: z.string().nullish(),
  custom_models: z.array(zCustomModelConfiguration).nullish(),
  status: zCustomConfigurationStatus,
})

/**
 * FieldModelSchema
 */
export const zFieldModelSchema = z.object({
  label: zI18nObject,
  placeholder: zI18nObject.nullish(),
})

/**
 * ProviderQuotaType
 */
export const zProviderQuotaType = z.enum(['free', 'paid', 'trial'])

/**
 * PriceConfigResponse
 *
 * Serialized pricing info with codegen-safe decimal string patterns.
 */
export const zPriceConfigResponse = z.object({
  currency: z.string(),
  input: z.string().regex(/^(?![-+.]*$)[+-]?\d*(?:\.\d*)?$/),
  output: z
    .string()
    .regex(/^(?![-+.]*$)[+-]?\d*(?:\.\d*)?$/)
    .nullish(),
  unit: z.string().regex(/^(?![-+.]*$)[+-]?\d*(?:\.\d*)?$/),
})

/**
 * AIModelEntityResponse
 */
export const zAiModelEntityResponse = z.object({
  deprecated: z.boolean().optional().default(false),
  features: z.array(zModelFeature).nullish(),
  fetch_from: zFetchFrom,
  label: zI18nObject,
  model: z.string(),
  model_properties: z.record(z.string(), z.unknown()),
  model_type: zModelType,
  parameter_rules: z.array(zParameterRule).optional().default([]),
  pricing: zPriceConfigResponse.nullish(),
})

/**
 * SimpleProviderEntityResponse
 *
 * Simple provider entity response.
 */
export const zSimpleProviderEntityResponse = z.object({
  icon_small: zI18nObject.nullish(),
  icon_small_dark: zI18nObject.nullish(),
  label: zI18nObject,
  models: z.array(zAiModelEntityResponse).optional().default([]),
  provider: z.string(),
  provider_name: z.string().optional().default(''),
  supported_model_types: z.array(zModelType),
  tenant_id: z.string(),
})

/**
 * DefaultModelResponse
 *
 * Default model entity.
 */
export const zDefaultModelResponse = z.object({
  model: z.string(),
  model_type: zModelType,
  provider: zSimpleProviderEntityResponse,
})

/**
 * DefaultModelDataResponse
 */
export const zDefaultModelDataResponse = z.object({
  data: zDefaultModelResponse.nullish(),
})

/**
 * ModelWithProviderEntityResponse
 *
 * Model with provider entity.
 */
export const zModelWithProviderEntityResponse = z.object({
  deprecated: z.boolean().optional().default(false),
  features: z.array(zModelFeature).nullish(),
  fetch_from: zFetchFrom,
  has_invalid_load_balancing_configs: z.boolean().optional().default(false),
  label: zI18nObject,
  load_balancing_enabled: z.boolean().optional().default(false),
  model: z.string(),
  model_properties: z.record(z.string(), z.unknown()),
  model_type: zModelType,
  provider: zSimpleProviderEntityResponse,
  status: zModelStatus,
})

/**
 * ModelWithProviderListResponse
 */
export const zModelWithProviderListResponse = z.object({
  data: z.array(zModelWithProviderEntityResponse),
})

/**
 * FormShowOnObject
 *
 * Model class for form show on.
 */
export const zFormShowOnObject = z.object({
  value: z.string(),
  variable: z.string(),
})

/**
 * FormOption
 *
 * Model class for form option.
 */
export const zFormOption = z.object({
  label: zI18nObject,
  show_on: z.array(zFormShowOnObject).optional().default([]),
  value: z.string(),
})

/**
 * FormType
 *
 * Enum class for form type.
 */
export const zFormType = z.enum(['radio', 'secret-input', 'select', 'switch', 'text-input'])

/**
 * CredentialFormSchema
 *
 * Model class for credential form schema.
 */
export const zCredentialFormSchema = z.object({
  default: z.string().nullish(),
  label: zI18nObject,
  max_length: z.int().optional().default(0),
  options: z.array(zFormOption).nullish(),
  placeholder: zI18nObject.nullish(),
  required: z.boolean().optional().default(true),
  show_on: z.array(zFormShowOnObject).optional().default([]),
  type: zFormType,
  variable: z.string(),
})

/**
 * ModelCredentialSchema
 *
 * Model class for model credential schema.
 */
export const zModelCredentialSchema = z.object({
  credential_form_schemas: z.array(zCredentialFormSchema),
  model: zFieldModelSchema,
})

/**
 * ProviderCredentialSchema
 *
 * Model class for provider credential schema.
 */
export const zProviderCredentialSchema = z.object({
  credential_form_schemas: z.array(zCredentialFormSchema),
})

/**
 * QuotaUnit
 */
export const zQuotaUnit = z.enum(['credits', 'times', 'tokens'])

/**
 * RestrictModel
 */
export const zRestrictModel = z.object({
  base_model_name: z.string().nullish(),
  model: z.string(),
  model_type: zModelType,
})

/**
 * QuotaConfiguration
 *
 * Model class for provider quota configuration.
 */
export const zQuotaConfiguration = z.object({
  is_valid: z.boolean(),
  quota_limit: z.int(),
  quota_type: zProviderQuotaType,
  quota_unit: zQuotaUnit,
  quota_used: z.int(),
  restrict_models: z.array(zRestrictModel).optional().default([]),
})

/**
 * SystemConfigurationResponse
 *
 * Model class for provider system configuration response.
 */
export const zSystemConfigurationResponse = z.object({
  current_quota_type: zProviderQuotaType.nullish(),
  enabled: z.boolean(),
  quota_configurations: z.array(zQuotaConfiguration).optional().default([]),
})

/**
 * ProviderResponse
 *
 * Model class for provider response.
 */
export const zProviderResponse = z.object({
  background: z.string().nullish(),
  configurate_methods: z.array(zConfigurateMethod),
  custom_configuration: zCustomConfigurationResponse,
  description: zI18nObject.nullish(),
  help: zProviderHelpEntity.nullish(),
  icon_small: zI18nObject.nullish(),
  icon_small_dark: zI18nObject.nullish(),
  label: zI18nObject,
  model_credential_schema: zModelCredentialSchema.nullish(),
  preferred_provider_type: zProviderType,
  provider: z.string(),
  provider_credential_schema: zProviderCredentialSchema.nullish(),
  supported_model_types: z.array(zModelType),
  system_configuration: zSystemConfigurationResponse,
  tenant_id: z.string(),
})

/**
 * ModelProviderListResponse
 */
export const zModelProviderListResponse = z.object({
  data: z.array(zProviderResponse),
})

/**
 * Success
 */
export const zGetWorkspacesResponse = zTenantListResponse

/**
 * Success
 */
export const zPostWorkspacesCurrentResponse = zTenantInfoResponse

export const zGetWorkspacesCurrentAgentProviderByProviderNamePath = z.object({
  provider_name: z.string(),
})

/**
 * Success
 */
export const zGetWorkspacesCurrentAgentProviderByProviderNameResponse = zAgentProviderResponse

/**
 * Success
 */
export const zGetWorkspacesCurrentAgentProvidersResponse = zAgentProviderListResponse

export const zGetWorkspacesCurrentCustomizedSnippetsQuery = z.object({
  creators: z.array(z.string()).optional(),
  is_published: z.boolean().optional(),
  keyword: z.string().optional(),
  limit: z.int().gte(1).lte(100).optional().default(20),
  page: z.int().gte(1).lte(99999).optional().default(1),
  tag_ids: z.array(z.string()).optional(),
})

/**
 * Snippets retrieved successfully
 */
export const zGetWorkspacesCurrentCustomizedSnippetsResponse = zSnippetPagination

export const zPostWorkspacesCurrentCustomizedSnippetsBody = zCreateSnippetPayload

/**
 * Snippet created successfully
 */
export const zPostWorkspacesCurrentCustomizedSnippetsResponse = zSnippet

export const zPostWorkspacesCurrentCustomizedSnippetsImportsBody = zSnippetImportPayload

/**
 * Snippet imported successfully
 */
export const zPostWorkspacesCurrentCustomizedSnippetsImportsResponse = zSnippetImportResponse

export const zPostWorkspacesCurrentCustomizedSnippetsImportsByImportIdConfirmPath = z.object({
  import_id: z.string(),
})

/**
 * Import confirmed successfully
 */
export const zPostWorkspacesCurrentCustomizedSnippetsImportsByImportIdConfirmResponse
  = zSnippetImportResponse

export const zDeleteWorkspacesCurrentCustomizedSnippetsBySnippetIdPath = z.object({
  snippet_id: z.string(),
})

/**
 * Snippet deleted successfully
 */
export const zDeleteWorkspacesCurrentCustomizedSnippetsBySnippetIdResponse = z.void()

export const zGetWorkspacesCurrentCustomizedSnippetsBySnippetIdPath = z.object({
  snippet_id: z.string(),
})

/**
 * Snippet retrieved successfully
 */
export const zGetWorkspacesCurrentCustomizedSnippetsBySnippetIdResponse = zSnippet

export const zPatchWorkspacesCurrentCustomizedSnippetsBySnippetIdBody = zUpdateSnippetPayload

export const zPatchWorkspacesCurrentCustomizedSnippetsBySnippetIdPath = z.object({
  snippet_id: z.string(),
})

/**
 * Snippet updated successfully
 */
export const zPatchWorkspacesCurrentCustomizedSnippetsBySnippetIdResponse = zSnippet

export const zGetWorkspacesCurrentCustomizedSnippetsBySnippetIdCheckDependenciesPath = z.object({
  snippet_id: z.string(),
})

/**
 * Dependencies checked successfully
 */
export const zGetWorkspacesCurrentCustomizedSnippetsBySnippetIdCheckDependenciesResponse
  = zSnippetDependencyCheckResponse

export const zGetWorkspacesCurrentCustomizedSnippetsBySnippetIdExportPath = z.object({
  snippet_id: z.string(),
})

export const zGetWorkspacesCurrentCustomizedSnippetsBySnippetIdExportQuery = z.object({
  include_secret: z.string().optional().default('false'),
})

/**
 * Snippet exported successfully
 */
export const zGetWorkspacesCurrentCustomizedSnippetsBySnippetIdExportResponse = zTextFileResponse

export const zPostWorkspacesCurrentCustomizedSnippetsBySnippetIdUseCountIncrementPath = z.object({
  snippet_id: z.string(),
})

/**
 * Use count incremented successfully
 */
export const zPostWorkspacesCurrentCustomizedSnippetsBySnippetIdUseCountIncrementResponse
  = zSnippetUseCountResponse

/**
 * Success
 */
export const zGetWorkspacesCurrentDatasetOperatorsResponse = zAccountWithRoleList

export const zGetWorkspacesCurrentDefaultModelQuery = z.object({
  model_type: z.enum(['llm', 'moderation', 'rerank', 'speech2text', 'text-embedding', 'tts']),
})

/**
 * Success
 */
export const zGetWorkspacesCurrentDefaultModelResponse = zDefaultModelDataResponse

export const zPostWorkspacesCurrentDefaultModelBody = zParserPostDefault

/**
 * Success
 */
export const zPostWorkspacesCurrentDefaultModelResponse = zSimpleResultResponse

export const zPostWorkspacesCurrentEndpointsBody = zEndpointCreatePayload

/**
 * Endpoint created successfully
 */
export const zPostWorkspacesCurrentEndpointsResponse = zEndpointCreateResponse

export const zPostWorkspacesCurrentEndpointsCreateBody = zEndpointCreatePayload

/**
 * Endpoint created successfully
 */
export const zPostWorkspacesCurrentEndpointsCreateResponse = zEndpointCreateResponse

export const zPostWorkspacesCurrentEndpointsDeleteBody = zEndpointIdPayload

/**
 * Endpoint deleted successfully
 */
export const zPostWorkspacesCurrentEndpointsDeleteResponse = zEndpointDeleteResponse

export const zPostWorkspacesCurrentEndpointsDisableBody = zEndpointIdPayload

/**
 * Endpoint disabled successfully
 */
export const zPostWorkspacesCurrentEndpointsDisableResponse = zEndpointDisableResponse

export const zPostWorkspacesCurrentEndpointsEnableBody = zEndpointIdPayload

/**
 * Endpoint enabled successfully
 */
export const zPostWorkspacesCurrentEndpointsEnableResponse = zEndpointEnableResponse

export const zGetWorkspacesCurrentEndpointsListQuery = z.object({
  page: z.int().gte(1),
  page_size: z.int().gt(0),
})

/**
 * Success
 */
export const zGetWorkspacesCurrentEndpointsListResponse = zEndpointListResponse

export const zGetWorkspacesCurrentEndpointsListPluginQuery = z.object({
  page: z.int().gte(1),
  page_size: z.int().gt(0),
  plugin_id: z.string(),
})

/**
 * Success
 */
export const zGetWorkspacesCurrentEndpointsListPluginResponse = zPluginEndpointListResponse

export const zPostWorkspacesCurrentEndpointsUpdateBody = zLegacyEndpointUpdatePayload

/**
 * Endpoint updated successfully
 */
export const zPostWorkspacesCurrentEndpointsUpdateResponse = zEndpointUpdateResponse

export const zDeleteWorkspacesCurrentEndpointsByIdPath = z.object({
  id: z.string(),
})

/**
 * Endpoint deleted successfully
 */
export const zDeleteWorkspacesCurrentEndpointsByIdResponse = zEndpointDeleteResponse

export const zPatchWorkspacesCurrentEndpointsByIdBody = zEndpointUpdatePayload

export const zPatchWorkspacesCurrentEndpointsByIdPath = z.object({
  id: z.string(),
})

/**
 * Endpoint updated successfully
 */
export const zPatchWorkspacesCurrentEndpointsByIdResponse = zEndpointUpdateResponse

/**
 * Success
 */
export const zGetWorkspacesCurrentMembersResponse = zAccountWithRoleList

export const zPostWorkspacesCurrentMembersInviteEmailBody = zMemberInvitePayload

/**
 * Success
 */
export const zPostWorkspacesCurrentMembersInviteEmailResponse = zMemberInviteResponse

export const zPostWorkspacesCurrentMembersOwnerTransferCheckBody = zOwnerTransferCheckPayload

/**
 * Success
 */
export const zPostWorkspacesCurrentMembersOwnerTransferCheckResponse = zVerificationTokenResponse

export const zPostWorkspacesCurrentMembersSendOwnerTransferConfirmEmailBody
  = zOwnerTransferEmailPayload

/**
 * Success
 */
export const zPostWorkspacesCurrentMembersSendOwnerTransferConfirmEmailResponse
  = zSimpleResultDataResponse

export const zDeleteWorkspacesCurrentMembersByMemberIdPath = z.object({
  member_id: z.string(),
})

/**
 * Success
 */
export const zDeleteWorkspacesCurrentMembersByMemberIdResponse = zMemberActionTenantResponse

export const zPostWorkspacesCurrentMembersByMemberIdOwnerTransferBody = zOwnerTransferPayload

export const zPostWorkspacesCurrentMembersByMemberIdOwnerTransferPath = z.object({
  member_id: z.string(),
})

/**
 * Success
 */
export const zPostWorkspacesCurrentMembersByMemberIdOwnerTransferResponse = zSimpleResultResponse

export const zPutWorkspacesCurrentMembersByMemberIdUpdateRoleBody = zMemberRoleUpdatePayload

export const zPutWorkspacesCurrentMembersByMemberIdUpdateRolePath = z.object({
  member_id: z.string(),
})

/**
 * Success
 */
export const zPutWorkspacesCurrentMembersByMemberIdUpdateRoleResponse = zSimpleResultResponse

export const zGetWorkspacesCurrentModelProvidersQuery = z.object({
  model_type: z
    .enum(['llm', 'moderation', 'rerank', 'speech2text', 'text-embedding', 'tts'])
    .optional(),
})

/**
 * Success
 */
export const zGetWorkspacesCurrentModelProvidersResponse = zModelProviderListResponse

export const zGetWorkspacesCurrentModelProvidersByProviderCheckoutUrlPath = z.object({
  provider: z.string(),
})

/**
 * Success
 */
export const zGetWorkspacesCurrentModelProvidersByProviderCheckoutUrlResponse
  = zModelProviderPaymentCheckoutUrlResponse

export const zDeleteWorkspacesCurrentModelProvidersByProviderCredentialsBody
  = zParserCredentialDelete

export const zDeleteWorkspacesCurrentModelProvidersByProviderCredentialsPath = z.object({
  provider: z.string(),
})

/**
 * Credential deleted successfully
 */
export const zDeleteWorkspacesCurrentModelProvidersByProviderCredentialsResponse = z.void()

export const zGetWorkspacesCurrentModelProvidersByProviderCredentialsPath = z.object({
  provider: z.string(),
})

export const zGetWorkspacesCurrentModelProvidersByProviderCredentialsQuery = z.object({
  credential_id: z.string().optional(),
})

/**
 * Success
 */
export const zGetWorkspacesCurrentModelProvidersByProviderCredentialsResponse
  = zProviderCredentialResponse

export const zPostWorkspacesCurrentModelProvidersByProviderCredentialsBody = zParserCredentialCreate

export const zPostWorkspacesCurrentModelProvidersByProviderCredentialsPath = z.object({
  provider: z.string(),
})

/**
 * Credential created successfully
 */
export const zPostWorkspacesCurrentModelProvidersByProviderCredentialsResponse
  = zSimpleResultResponse

export const zPutWorkspacesCurrentModelProvidersByProviderCredentialsBody = zParserCredentialUpdate

export const zPutWorkspacesCurrentModelProvidersByProviderCredentialsPath = z.object({
  provider: z.string(),
})

/**
 * Credential updated successfully
 */
export const zPutWorkspacesCurrentModelProvidersByProviderCredentialsResponse
  = zSimpleResultResponse

export const zPostWorkspacesCurrentModelProvidersByProviderCredentialsSwitchBody
  = zParserCredentialSwitch

export const zPostWorkspacesCurrentModelProvidersByProviderCredentialsSwitchPath = z.object({
  provider: z.string(),
})

/**
 * Success
 */
export const zPostWorkspacesCurrentModelProvidersByProviderCredentialsSwitchResponse
  = zSimpleResultResponse

export const zPostWorkspacesCurrentModelProvidersByProviderCredentialsValidateBody
  = zParserCredentialValidate

export const zPostWorkspacesCurrentModelProvidersByProviderCredentialsValidatePath = z.object({
  provider: z.string(),
})

/**
 * Credential validation result
 */
export const zPostWorkspacesCurrentModelProvidersByProviderCredentialsValidateResponse
  = zProviderCredentialValidateResponse

export const zDeleteWorkspacesCurrentModelProvidersByProviderModelsBody = zParserDeleteModels

export const zDeleteWorkspacesCurrentModelProvidersByProviderModelsPath = z.object({
  provider: z.string(),
})

/**
 * Model deleted successfully
 */
export const zDeleteWorkspacesCurrentModelProvidersByProviderModelsResponse = z.void()

export const zGetWorkspacesCurrentModelProvidersByProviderModelsPath = z.object({
  provider: z.string(),
})

/**
 * Success
 */
export const zGetWorkspacesCurrentModelProvidersByProviderModelsResponse
  = zModelWithProviderListResponse

export const zPostWorkspacesCurrentModelProvidersByProviderModelsBody = zParserPostModels

export const zPostWorkspacesCurrentModelProvidersByProviderModelsPath = z.object({
  provider: z.string(),
})

/**
 * Success
 */
export const zPostWorkspacesCurrentModelProvidersByProviderModelsResponse = zSimpleResultResponse

export const zDeleteWorkspacesCurrentModelProvidersByProviderModelsCredentialsBody
  = zParserDeleteCredential

export const zDeleteWorkspacesCurrentModelProvidersByProviderModelsCredentialsPath = z.object({
  provider: z.string(),
})

/**
 * Credential deleted successfully
 */
export const zDeleteWorkspacesCurrentModelProvidersByProviderModelsCredentialsResponse = z.void()

export const zGetWorkspacesCurrentModelProvidersByProviderModelsCredentialsPath = z.object({
  provider: z.string(),
})

export const zGetWorkspacesCurrentModelProvidersByProviderModelsCredentialsQuery = z.object({
  config_from: z.string().optional(),
  credential_id: z.string().optional(),
  model: z.string(),
  model_type: z.enum(['llm', 'moderation', 'rerank', 'speech2text', 'text-embedding', 'tts']),
})

/**
 * Success
 */
export const zGetWorkspacesCurrentModelProvidersByProviderModelsCredentialsResponse
  = zModelCredentialResponse

export const zPostWorkspacesCurrentModelProvidersByProviderModelsCredentialsBody
  = zParserCreateCredential

export const zPostWorkspacesCurrentModelProvidersByProviderModelsCredentialsPath = z.object({
  provider: z.string(),
})

/**
 * Credential created successfully
 */
export const zPostWorkspacesCurrentModelProvidersByProviderModelsCredentialsResponse
  = zSimpleResultResponse

export const zPutWorkspacesCurrentModelProvidersByProviderModelsCredentialsBody
  = zParserUpdateCredential

export const zPutWorkspacesCurrentModelProvidersByProviderModelsCredentialsPath = z.object({
  provider: z.string(),
})

/**
 * Credential updated successfully
 */
export const zPutWorkspacesCurrentModelProvidersByProviderModelsCredentialsResponse
  = zSimpleResultResponse

export const zPostWorkspacesCurrentModelProvidersByProviderModelsCredentialsSwitchBody
  = zParserSwitch

export const zPostWorkspacesCurrentModelProvidersByProviderModelsCredentialsSwitchPath = z.object({
  provider: z.string(),
})

/**
 * Success
 */
export const zPostWorkspacesCurrentModelProvidersByProviderModelsCredentialsSwitchResponse
  = zSimpleResultResponse

export const zPostWorkspacesCurrentModelProvidersByProviderModelsCredentialsValidateBody
  = zParserValidate

export const zPostWorkspacesCurrentModelProvidersByProviderModelsCredentialsValidatePath = z.object(
  {
    provider: z.string(),
  },
)

/**
 * Credential validation result
 */
export const zPostWorkspacesCurrentModelProvidersByProviderModelsCredentialsValidateResponse
  = zModelCredentialValidateResponse

export const zPatchWorkspacesCurrentModelProvidersByProviderModelsDisableBody = zParserDeleteModels

export const zPatchWorkspacesCurrentModelProvidersByProviderModelsDisablePath = z.object({
  provider: z.string(),
})

/**
 * Success
 */
export const zPatchWorkspacesCurrentModelProvidersByProviderModelsDisableResponse
  = zSimpleResultResponse

export const zPatchWorkspacesCurrentModelProvidersByProviderModelsEnableBody = zParserDeleteModels

export const zPatchWorkspacesCurrentModelProvidersByProviderModelsEnablePath = z.object({
  provider: z.string(),
})

/**
 * Success
 */
export const zPatchWorkspacesCurrentModelProvidersByProviderModelsEnableResponse
  = zSimpleResultResponse

export const zPostWorkspacesCurrentModelProvidersByProviderModelsLoadBalancingConfigsCredentialsValidateBody
  = zLoadBalancingCredentialPayload

export const zPostWorkspacesCurrentModelProvidersByProviderModelsLoadBalancingConfigsCredentialsValidatePath
  = z.object({
    provider: z.string(),
  })

/**
 * Credential validation result
 */
export const zPostWorkspacesCurrentModelProvidersByProviderModelsLoadBalancingConfigsCredentialsValidateResponse
  = zLoadBalancingCredentialValidateResponse

export const zPostWorkspacesCurrentModelProvidersByProviderModelsLoadBalancingConfigsByConfigIdCredentialsValidateBody
  = zLoadBalancingCredentialPayload

export const zPostWorkspacesCurrentModelProvidersByProviderModelsLoadBalancingConfigsByConfigIdCredentialsValidatePath
  = z.object({
    config_id: z.string(),
    provider: z.string(),
  })

/**
 * Credential validation result
 */
export const zPostWorkspacesCurrentModelProvidersByProviderModelsLoadBalancingConfigsByConfigIdCredentialsValidateResponse
  = zLoadBalancingCredentialValidateResponse

export const zGetWorkspacesCurrentModelProvidersByProviderModelsParameterRulesPath = z.object({
  provider: z.string(),
})

export const zGetWorkspacesCurrentModelProvidersByProviderModelsParameterRulesQuery = z.object({
  model: z.string(),
})

/**
 * Success
 */
export const zGetWorkspacesCurrentModelProvidersByProviderModelsParameterRulesResponse
  = zModelParameterRulesResponse

export const zPostWorkspacesCurrentModelProvidersByProviderPreferredProviderTypeBody
  = zParserPreferredProviderType

export const zPostWorkspacesCurrentModelProvidersByProviderPreferredProviderTypePath = z.object({
  provider: z.string(),
})

/**
 * Success
 */
export const zPostWorkspacesCurrentModelProvidersByProviderPreferredProviderTypeResponse
  = zSimpleResultResponse

export const zGetWorkspacesCurrentModelsModelTypesByModelTypePath = z.object({
  model_type: z.string(),
})

/**
 * Success
 */
export const zGetWorkspacesCurrentModelsModelTypesByModelTypeResponse
  = zProviderWithModelsDataResponse

/**
 * Success
 */
export const zGetWorkspacesCurrentPermissionResponse = zWorkspacePermissionResponse

export const zGetWorkspacesCurrentPluginAssetQuery = z.object({
  file_name: z.string(),
  plugin_unique_identifier: z.string(),
})

/**
 * Success
 */
export const zGetWorkspacesCurrentPluginAssetResponse = zBinaryFileResponse

/**
 * Success
 */
export const zGetWorkspacesCurrentPluginDebuggingKeyResponse = zPluginDebuggingKeyResponse

export const zGetWorkspacesCurrentPluginFetchManifestQuery = z.object({
  plugin_unique_identifier: z.string(),
})

/**
 * Success
 */
export const zGetWorkspacesCurrentPluginFetchManifestResponse = zPluginManifestResponse

export const zGetWorkspacesCurrentPluginIconQuery = z.object({
  filename: z.string(),
  tenant_id: z.string(),
})

/**
 * Success
 */
export const zGetWorkspacesCurrentPluginIconResponse = zBinaryFileResponse

export const zPostWorkspacesCurrentPluginInstallGithubBody = zParserGithubInstall

/**
 * Success
 */
export const zPostWorkspacesCurrentPluginInstallGithubResponse = zPluginDaemonOperationResponse

export const zPostWorkspacesCurrentPluginInstallMarketplaceBody = zParserPluginIdentifiers

/**
 * Success
 */
export const zPostWorkspacesCurrentPluginInstallMarketplaceResponse = zPluginDaemonOperationResponse

export const zPostWorkspacesCurrentPluginInstallPkgBody = zParserPluginIdentifiers

/**
 * Success
 */
export const zPostWorkspacesCurrentPluginInstallPkgResponse = zPluginDaemonOperationResponse

export const zGetWorkspacesCurrentPluginListQuery = z.object({
  page: z.int().gte(1).optional().default(1),
  page_size: z.int().gte(1).lte(256).optional().default(256),
})

/**
 * Success
 */
export const zGetWorkspacesCurrentPluginListResponse = zPluginListResponse

export const zPostWorkspacesCurrentPluginListInstallationsIdsBody = zParserLatest

/**
 * Success
 */
export const zPostWorkspacesCurrentPluginListInstallationsIdsResponse = zPluginInstallationsResponse

export const zPostWorkspacesCurrentPluginListLatestVersionsBody = zParserLatest

/**
 * Success
 */
export const zPostWorkspacesCurrentPluginListLatestVersionsResponse = zPluginVersionsResponse

export const zGetWorkspacesCurrentPluginMarketplacePkgQuery = z.object({
  plugin_unique_identifier: z.string(),
})

/**
 * Success
 */
export const zGetWorkspacesCurrentPluginMarketplacePkgResponse = zPluginManifestResponse

export const zGetWorkspacesCurrentPluginParametersDynamicOptionsQuery = z.object({
  action: z.string(),
  credential_id: z.string().optional(),
  parameter: z.string(),
  plugin_id: z.string(),
  provider: z.string(),
  provider_type: z.enum(['tool', 'trigger']),
})

/**
 * Success
 */
export const zGetWorkspacesCurrentPluginParametersDynamicOptionsResponse
  = zPluginDynamicOptionsResponse

export const zPostWorkspacesCurrentPluginParametersDynamicOptionsWithCredentialsBody
  = zParserDynamicOptionsWithCredentials

/**
 * Success
 */
export const zPostWorkspacesCurrentPluginParametersDynamicOptionsWithCredentialsResponse
  = zPluginDynamicOptionsResponse

export const zPostWorkspacesCurrentPluginPermissionChangeBody = zParserPermissionChange

/**
 * Success
 */
export const zPostWorkspacesCurrentPluginPermissionChangeResponse = zSuccessResponse

/**
 * Success
 */
export const zGetWorkspacesCurrentPluginPermissionFetchResponse = zPluginPermissionResponse

export const zPostWorkspacesCurrentPluginPreferencesAutoupgradeExcludeBody = zParserExcludePlugin

/**
 * Success
 */
export const zPostWorkspacesCurrentPluginPreferencesAutoupgradeExcludeResponse
  = zPluginOperationSuccessResponse

export const zPostWorkspacesCurrentPluginPreferencesChangeBody = zParserPreferencesChange

/**
 * Success
 */
export const zPostWorkspacesCurrentPluginPreferencesChangeResponse = zPluginOperationSuccessResponse

/**
 * Success
 */
export const zGetWorkspacesCurrentPluginPreferencesFetchResponse = zPluginPreferencesResponse

export const zGetWorkspacesCurrentPluginReadmeQuery = z.object({
  language: z.string().optional().default('en-US'),
  plugin_unique_identifier: z.string(),
})

/**
 * Success
 */
export const zGetWorkspacesCurrentPluginReadmeResponse = zPluginReadmeResponse

export const zGetWorkspacesCurrentPluginTasksQuery = z.object({
  page: z.int().gte(1).optional().default(1),
  page_size: z.int().gte(1).lte(256).optional().default(256),
})

/**
 * Success
 */
export const zGetWorkspacesCurrentPluginTasksResponse = zPluginTasksResponse

/**
 * Success
 */
export const zPostWorkspacesCurrentPluginTasksDeleteAllResponse = zSuccessResponse

export const zGetWorkspacesCurrentPluginTasksByTaskIdPath = z.object({
  task_id: z.string(),
})

/**
 * Success
 */
export const zGetWorkspacesCurrentPluginTasksByTaskIdResponse = zPluginTaskResponse

export const zPostWorkspacesCurrentPluginTasksByTaskIdDeletePath = z.object({
  task_id: z.string(),
})

/**
 * Success
 */
export const zPostWorkspacesCurrentPluginTasksByTaskIdDeleteResponse = zSuccessResponse

export const zPostWorkspacesCurrentPluginTasksByTaskIdDeleteByIdentifierPath = z.object({
  identifier: z.string(),
  task_id: z.string(),
})

/**
 * Success
 */
export const zPostWorkspacesCurrentPluginTasksByTaskIdDeleteByIdentifierResponse = zSuccessResponse

export const zPostWorkspacesCurrentPluginUninstallBody = zParserUninstall

/**
 * Success
 */
export const zPostWorkspacesCurrentPluginUninstallResponse = zSuccessResponse

export const zPostWorkspacesCurrentPluginUpgradeGithubBody = zParserGithubUpgrade

/**
 * Success
 */
export const zPostWorkspacesCurrentPluginUpgradeGithubResponse = zPluginDaemonOperationResponse

export const zPostWorkspacesCurrentPluginUpgradeMarketplaceBody = zParserMarketplaceUpgrade

/**
 * Success
 */
export const zPostWorkspacesCurrentPluginUpgradeMarketplaceResponse = zPluginDaemonOperationResponse

/**
 * Success
 */
export const zPostWorkspacesCurrentPluginUploadBundleResponse = zPluginDaemonOperationResponse

export const zPostWorkspacesCurrentPluginUploadGithubBody = zParserGithubUpload

/**
 * Success
 */
export const zPostWorkspacesCurrentPluginUploadGithubResponse = zPluginDaemonOperationResponse

/**
 * Success
 */
export const zPostWorkspacesCurrentPluginUploadPkgResponse = zPluginDaemonOperationResponse

/**
 * Success
 */
export const zGetWorkspacesCurrentToolLabelsResponse = zToolProviderOpaqueResponse

export const zPostWorkspacesCurrentToolProviderApiAddBody = zApiToolProviderAddPayload

/**
 * Success
 */
export const zPostWorkspacesCurrentToolProviderApiAddResponse = zToolProviderOpaqueResponse

export const zPostWorkspacesCurrentToolProviderApiDeleteBody = zApiToolProviderDeletePayload

/**
 * Success
 */
export const zPostWorkspacesCurrentToolProviderApiDeleteResponse = zToolProviderOpaqueResponse

export const zGetWorkspacesCurrentToolProviderApiGetQuery = z.object({
  provider: z.string(),
})

/**
 * Success
 */
export const zGetWorkspacesCurrentToolProviderApiGetResponse = zToolProviderOpaqueResponse

export const zGetWorkspacesCurrentToolProviderApiRemoteQuery = z.object({
  url: z.url().min(1).max(2083),
})

/**
 * Success
 */
export const zGetWorkspacesCurrentToolProviderApiRemoteResponse = zToolProviderOpaqueResponse

export const zPostWorkspacesCurrentToolProviderApiSchemaBody = zApiToolSchemaPayload

/**
 * Success
 */
export const zPostWorkspacesCurrentToolProviderApiSchemaResponse = zToolProviderOpaqueResponse

export const zPostWorkspacesCurrentToolProviderApiTestPreBody = zApiToolTestPayload

/**
 * Success
 */
export const zPostWorkspacesCurrentToolProviderApiTestPreResponse = zToolProviderOpaqueResponse

export const zGetWorkspacesCurrentToolProviderApiToolsQuery = z.object({
  provider: z.string(),
})

/**
 * Success
 */
export const zGetWorkspacesCurrentToolProviderApiToolsResponse = zToolProviderOpaqueResponse

export const zPostWorkspacesCurrentToolProviderApiUpdateBody = zApiToolProviderUpdatePayload

/**
 * Success
 */
export const zPostWorkspacesCurrentToolProviderApiUpdateResponse = zToolProviderOpaqueResponse

export const zPostWorkspacesCurrentToolProviderBuiltinByProviderAddBody = zBuiltinToolAddPayload

export const zPostWorkspacesCurrentToolProviderBuiltinByProviderAddPath = z.object({
  provider: z.string(),
})

/**
 * Success
 */
export const zPostWorkspacesCurrentToolProviderBuiltinByProviderAddResponse
  = zToolProviderOpaqueResponse

export const zGetWorkspacesCurrentToolProviderBuiltinByProviderCredentialInfoPath = z.object({
  provider: z.string(),
})

export const zGetWorkspacesCurrentToolProviderBuiltinByProviderCredentialInfoQuery = z.object({
  include_credential_ids: z.array(z.string()).optional(),
})

/**
 * Success
 */
export const zGetWorkspacesCurrentToolProviderBuiltinByProviderCredentialInfoResponse
  = zToolProviderOpaqueResponse

export const zGetWorkspacesCurrentToolProviderBuiltinByProviderCredentialSchemaByCredentialTypePath
  = z.object({
    credential_type: z.string(),
    provider: z.string(),
  })

/**
 * Success
 */
export const zGetWorkspacesCurrentToolProviderBuiltinByProviderCredentialSchemaByCredentialTypeResponse
  = zToolProviderOpaqueResponse

export const zGetWorkspacesCurrentToolProviderBuiltinByProviderCredentialsPath = z.object({
  provider: z.string(),
})

export const zGetWorkspacesCurrentToolProviderBuiltinByProviderCredentialsQuery = z.object({
  include_credential_ids: z.array(z.string()).optional(),
})

/**
 * Success
 */
export const zGetWorkspacesCurrentToolProviderBuiltinByProviderCredentialsResponse
  = zToolProviderOpaqueResponse

export const zPostWorkspacesCurrentToolProviderBuiltinByProviderDefaultCredentialBody
  = zBuiltinProviderDefaultCredentialPayload

export const zPostWorkspacesCurrentToolProviderBuiltinByProviderDefaultCredentialPath = z.object({
  provider: z.string(),
})

/**
 * Success
 */
export const zPostWorkspacesCurrentToolProviderBuiltinByProviderDefaultCredentialResponse
  = zToolProviderOpaqueResponse

export const zPostWorkspacesCurrentToolProviderBuiltinByProviderDeleteBody
  = zBuiltinToolCredentialDeletePayload

export const zPostWorkspacesCurrentToolProviderBuiltinByProviderDeletePath = z.object({
  provider: z.string(),
})

/**
 * Success
 */
export const zPostWorkspacesCurrentToolProviderBuiltinByProviderDeleteResponse
  = zToolProviderOpaqueResponse

export const zGetWorkspacesCurrentToolProviderBuiltinByProviderIconPath = z.object({
  provider: z.string(),
})

/**
 * Success
 */
export const zGetWorkspacesCurrentToolProviderBuiltinByProviderIconResponse = zBinaryFileResponse

export const zGetWorkspacesCurrentToolProviderBuiltinByProviderInfoPath = z.object({
  provider: z.string(),
})

/**
 * Success
 */
export const zGetWorkspacesCurrentToolProviderBuiltinByProviderInfoResponse
  = zToolProviderOpaqueResponse

export const zGetWorkspacesCurrentToolProviderBuiltinByProviderOauthClientSchemaPath = z.object({
  provider: z.string(),
})

/**
 * Success
 */
export const zGetWorkspacesCurrentToolProviderBuiltinByProviderOauthClientSchemaResponse
  = zToolOAuthClientSchemaResponse

export const zDeleteWorkspacesCurrentToolProviderBuiltinByProviderOauthCustomClientPath = z.object({
  provider: z.string(),
})

/**
 * Success
 */
export const zDeleteWorkspacesCurrentToolProviderBuiltinByProviderOauthCustomClientResponse
  = zSimpleResultResponse

export const zGetWorkspacesCurrentToolProviderBuiltinByProviderOauthCustomClientPath = z.object({
  provider: z.string(),
})

/**
 * Success
 */
export const zGetWorkspacesCurrentToolProviderBuiltinByProviderOauthCustomClientResponse
  = zToolOAuthCustomClientResponse

export const zPostWorkspacesCurrentToolProviderBuiltinByProviderOauthCustomClientBody
  = zToolOAuthCustomClientPayload

export const zPostWorkspacesCurrentToolProviderBuiltinByProviderOauthCustomClientPath = z.object({
  provider: z.string(),
})

/**
 * Success
 */
export const zPostWorkspacesCurrentToolProviderBuiltinByProviderOauthCustomClientResponse
  = zSimpleResultResponse

export const zGetWorkspacesCurrentToolProviderBuiltinByProviderToolsPath = z.object({
  provider: z.string(),
})

/**
 * Success
 */
export const zGetWorkspacesCurrentToolProviderBuiltinByProviderToolsResponse
  = zToolProviderOpaqueResponse

export const zPostWorkspacesCurrentToolProviderBuiltinByProviderUpdateBody
  = zBuiltinToolUpdatePayload

export const zPostWorkspacesCurrentToolProviderBuiltinByProviderUpdatePath = z.object({
  provider: z.string(),
})

/**
 * Success
 */
export const zPostWorkspacesCurrentToolProviderBuiltinByProviderUpdateResponse
  = zToolProviderOpaqueResponse

export const zDeleteWorkspacesCurrentToolProviderMcpBody = zMcpProviderDeletePayload

/**
 * Success
 */
export const zDeleteWorkspacesCurrentToolProviderMcpResponse = zSimpleResultResponse

export const zPostWorkspacesCurrentToolProviderMcpBody = zMcpProviderCreatePayload

/**
 * Success
 */
export const zPostWorkspacesCurrentToolProviderMcpResponse = zToolProviderOpaqueResponse

export const zPutWorkspacesCurrentToolProviderMcpBody = zMcpProviderUpdatePayload

/**
 * Success
 */
export const zPutWorkspacesCurrentToolProviderMcpResponse = zSimpleResultResponse

export const zPostWorkspacesCurrentToolProviderMcpAuthBody = zMcpAuthPayload

/**
 * Success
 */
export const zPostWorkspacesCurrentToolProviderMcpAuthResponse = zToolProviderOpaqueResponse

export const zGetWorkspacesCurrentToolProviderMcpToolsByProviderIdPath = z.object({
  provider_id: z.string(),
})

/**
 * Success
 */
export const zGetWorkspacesCurrentToolProviderMcpToolsByProviderIdResponse
  = zToolProviderOpaqueResponse

export const zGetWorkspacesCurrentToolProviderMcpUpdateByProviderIdPath = z.object({
  provider_id: z.string(),
})

/**
 * Success
 */
export const zGetWorkspacesCurrentToolProviderMcpUpdateByProviderIdResponse
  = zToolProviderOpaqueResponse

export const zPostWorkspacesCurrentToolProviderWorkflowCreateBody = zWorkflowToolCreatePayload

/**
 * Success
 */
export const zPostWorkspacesCurrentToolProviderWorkflowCreateResponse = zToolProviderOpaqueResponse

export const zPostWorkspacesCurrentToolProviderWorkflowDeleteBody = zWorkflowToolDeletePayload

/**
 * Success
 */
export const zPostWorkspacesCurrentToolProviderWorkflowDeleteResponse = zToolProviderOpaqueResponse

export const zGetWorkspacesCurrentToolProviderWorkflowGetQuery = z.object({
  workflow_app_id: z.string().optional(),
  workflow_tool_id: z.string().optional(),
})

/**
 * Success
 */
export const zGetWorkspacesCurrentToolProviderWorkflowGetResponse = zToolProviderOpaqueResponse

export const zGetWorkspacesCurrentToolProviderWorkflowToolsQuery = z.object({
  workflow_tool_id: z.string(),
})

/**
 * Success
 */
export const zGetWorkspacesCurrentToolProviderWorkflowToolsResponse = zToolProviderOpaqueResponse

export const zPostWorkspacesCurrentToolProviderWorkflowUpdateBody = zWorkflowToolUpdatePayload

/**
 * Success
 */
export const zPostWorkspacesCurrentToolProviderWorkflowUpdateResponse = zToolProviderOpaqueResponse

export const zGetWorkspacesCurrentToolProvidersQuery = z.object({
  type: z.enum(['api', 'builtin', 'mcp', 'model', 'workflow']).optional(),
})

/**
 * Success
 */
export const zGetWorkspacesCurrentToolProvidersResponse = zToolProviderOpaqueResponse

/**
 * Success
 */
export const zGetWorkspacesCurrentToolsApiResponse = zToolProviderOpaqueResponse

/**
 * Success
 */
export const zGetWorkspacesCurrentToolsBuiltinResponse = zToolProviderOpaqueResponse

/**
 * Success
 */
export const zGetWorkspacesCurrentToolsMcpResponse = zToolProviderOpaqueResponse

/**
 * Success
 */
export const zGetWorkspacesCurrentToolsWorkflowResponse = zToolProviderOpaqueResponse

export const zGetWorkspacesCurrentTriggerProviderByProviderIconPath = z.object({
  provider: z.string(),
})

/**
 * Success
 */
export const zGetWorkspacesCurrentTriggerProviderByProviderIconResponse = zBinaryFileResponse

export const zGetWorkspacesCurrentTriggerProviderByProviderInfoPath = z.object({
  provider: z.string(),
})

/**
 * Success
 */
export const zGetWorkspacesCurrentTriggerProviderByProviderInfoResponse
  = zTriggerProviderOpaqueResponse

export const zDeleteWorkspacesCurrentTriggerProviderByProviderOauthClientPath = z.object({
  provider: z.string(),
})

/**
 * Success
 */
export const zDeleteWorkspacesCurrentTriggerProviderByProviderOauthClientResponse
  = zSimpleResultResponse

export const zGetWorkspacesCurrentTriggerProviderByProviderOauthClientPath = z.object({
  provider: z.string(),
})

/**
 * Success
 */
export const zGetWorkspacesCurrentTriggerProviderByProviderOauthClientResponse
  = zTriggerOAuthClientResponse

export const zPostWorkspacesCurrentTriggerProviderByProviderOauthClientBody
  = zTriggerOAuthClientPayload

export const zPostWorkspacesCurrentTriggerProviderByProviderOauthClientPath = z.object({
  provider: z.string(),
})

/**
 * Success
 */
export const zPostWorkspacesCurrentTriggerProviderByProviderOauthClientResponse
  = zSimpleResultResponse

export const zPostWorkspacesCurrentTriggerProviderByProviderSubscriptionsBuilderBuildBySubscriptionBuilderIdBody
  = zTriggerSubscriptionBuilderUpdatePayload

export const zPostWorkspacesCurrentTriggerProviderByProviderSubscriptionsBuilderBuildBySubscriptionBuilderIdPath
  = z.object({
    provider: z.string(),
    subscription_builder_id: z.string(),
  })

/**
 * Success
 */
export const zPostWorkspacesCurrentTriggerProviderByProviderSubscriptionsBuilderBuildBySubscriptionBuilderIdResponse
  = zTriggerProviderOpaqueResponse

export const zPostWorkspacesCurrentTriggerProviderByProviderSubscriptionsBuilderCreateBody
  = zTriggerSubscriptionBuilderCreatePayload

export const zPostWorkspacesCurrentTriggerProviderByProviderSubscriptionsBuilderCreatePath
  = z.object({
    provider: z.string(),
  })

/**
 * Success
 */
export const zPostWorkspacesCurrentTriggerProviderByProviderSubscriptionsBuilderCreateResponse
  = zTriggerProviderOpaqueResponse

export const zGetWorkspacesCurrentTriggerProviderByProviderSubscriptionsBuilderLogsBySubscriptionBuilderIdPath
  = z.object({
    provider: z.string(),
    subscription_builder_id: z.string(),
  })

/**
 * Success
 */
export const zGetWorkspacesCurrentTriggerProviderByProviderSubscriptionsBuilderLogsBySubscriptionBuilderIdResponse
  = zTriggerProviderOpaqueResponse

export const zPostWorkspacesCurrentTriggerProviderByProviderSubscriptionsBuilderUpdateBySubscriptionBuilderIdBody
  = zTriggerSubscriptionBuilderUpdatePayload

export const zPostWorkspacesCurrentTriggerProviderByProviderSubscriptionsBuilderUpdateBySubscriptionBuilderIdPath
  = z.object({
    provider: z.string(),
    subscription_builder_id: z.string(),
  })

/**
 * Success
 */
export const zPostWorkspacesCurrentTriggerProviderByProviderSubscriptionsBuilderUpdateBySubscriptionBuilderIdResponse
  = zTriggerProviderOpaqueResponse

export const zPostWorkspacesCurrentTriggerProviderByProviderSubscriptionsBuilderVerifyAndUpdateBySubscriptionBuilderIdBody
  = zTriggerSubscriptionBuilderVerifyPayload

export const zPostWorkspacesCurrentTriggerProviderByProviderSubscriptionsBuilderVerifyAndUpdateBySubscriptionBuilderIdPath
  = z.object({
    provider: z.string(),
    subscription_builder_id: z.string(),
  })

/**
 * Success
 */
export const zPostWorkspacesCurrentTriggerProviderByProviderSubscriptionsBuilderVerifyAndUpdateBySubscriptionBuilderIdResponse
  = zTriggerProviderOpaqueResponse

export const zGetWorkspacesCurrentTriggerProviderByProviderSubscriptionsBuilderBySubscriptionBuilderIdPath
  = z.object({
    provider: z.string(),
    subscription_builder_id: z.string(),
  })

/**
 * Success
 */
export const zGetWorkspacesCurrentTriggerProviderByProviderSubscriptionsBuilderBySubscriptionBuilderIdResponse
  = zTriggerProviderOpaqueResponse

export const zGetWorkspacesCurrentTriggerProviderByProviderSubscriptionsListPath = z.object({
  provider: z.string(),
})

/**
 * Success
 */
export const zGetWorkspacesCurrentTriggerProviderByProviderSubscriptionsListResponse
  = zTriggerProviderOpaqueResponse

export const zGetWorkspacesCurrentTriggerProviderByProviderSubscriptionsOauthAuthorizePath
  = z.object({
    provider: z.string(),
  })

/**
 * Authorization URL retrieved successfully
 */
export const zGetWorkspacesCurrentTriggerProviderByProviderSubscriptionsOauthAuthorizeResponse
  = zTriggerOAuthAuthorizeResponse

export const zPostWorkspacesCurrentTriggerProviderByProviderSubscriptionsVerifyBySubscriptionIdBody
  = zTriggerSubscriptionBuilderVerifyPayload

export const zPostWorkspacesCurrentTriggerProviderByProviderSubscriptionsVerifyBySubscriptionIdPath
  = z.object({
    provider: z.string(),
    subscription_id: z.string(),
  })

/**
 * Success
 */
export const zPostWorkspacesCurrentTriggerProviderByProviderSubscriptionsVerifyBySubscriptionIdResponse
  = zTriggerProviderOpaqueResponse

export const zPostWorkspacesCurrentTriggerProviderBySubscriptionIdSubscriptionsDeletePath
  = z.object({
    subscription_id: z.string(),
  })

/**
 * Success
 */
export const zPostWorkspacesCurrentTriggerProviderBySubscriptionIdSubscriptionsDeleteResponse
  = zSimpleResultResponse

export const zPostWorkspacesCurrentTriggerProviderBySubscriptionIdSubscriptionsUpdateBody
  = zTriggerSubscriptionBuilderUpdatePayload

export const zPostWorkspacesCurrentTriggerProviderBySubscriptionIdSubscriptionsUpdatePath
  = z.object({
    subscription_id: z.string(),
  })

/**
 * Success
 */
export const zPostWorkspacesCurrentTriggerProviderBySubscriptionIdSubscriptionsUpdateResponse
  = zTriggerProviderOpaqueResponse

/**
 * Success
 */
export const zGetWorkspacesCurrentTriggersResponse = zTriggerProviderOpaqueResponse

export const zPostWorkspacesCustomConfigBody = zWorkspaceCustomConfigPayload

/**
 * Success
 */
export const zPostWorkspacesCustomConfigResponse = zWorkspaceMutationResponse

/**
 * Logo uploaded
 */
export const zPostWorkspacesCustomConfigWebappLogoUploadResponse = zWorkspaceLogoUploadResponse

export const zPostWorkspacesInfoBody = zWorkspaceInfoPayload

/**
 * Success
 */
export const zPostWorkspacesInfoResponse = zWorkspaceMutationResponse

export const zPostWorkspacesSwitchBody = zSwitchWorkspacePayload

/**
 * Success
 */
export const zPostWorkspacesSwitchResponse = zSwitchWorkspaceResponse

export const zGetWorkspacesByTenantIdModelProvidersByProviderByIconTypeByLangPath = z.object({
  icon_type: z.string(),
  lang: z.string(),
  provider: z.string(),
  tenant_id: z.string(),
})

/**
 * Success
 */
export const zGetWorkspacesByTenantIdModelProvidersByProviderByIconTypeByLangResponse
  = zBinaryFileResponse
