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

import * as z from 'zod'

/**
 * ApiBaseUrlResponse
 */
export const zApiBaseUrlResponse = z.object({
  api_base_url: z.string(),
})

/**
 * ApiKeyItem
 */
export const zApiKeyItem = z.object({
  created_at: z.int().nullish(),
  id: z.string(),
  last_used_at: z.int().nullish(),
  token: z.string(),
  type: z.string(),
})

/**
 * ApiKeyList
 */
export const zApiKeyList = z.object({
  data: z.array(zApiKeyItem),
})

/**
 * SegmentBatchImportStatusResponse
 */
export const zSegmentBatchImportStatusResponse = z.object({
  job_id: z.string(),
  job_status: z.string(),
})

/**
 * BatchImportPayload
 */
export const zBatchImportPayload = z.object({
  upload_file_id: z.string(),
})

/**
 * ExternalDatasetCreatePayload
 */
export const zExternalDatasetCreatePayload = z.object({
  description: z.string().max(400).nullish(),
  external_knowledge_api_id: z.string(),
  external_knowledge_id: z.string(),
  external_retrieval_model: z.record(z.string(), z.unknown()).nullish(),
  name: z.string().min(1).max(100),
})

/**
 * ExternalKnowledgeApiPayload
 */
export const zExternalKnowledgeApiPayload = z.object({
  name: z.string().min(1).max(40),
  settings: z.record(z.string(), z.unknown()),
})

/**
 * UsageCountResponse
 */
export const zUsageCountResponse = z.object({
  count: z.int(),
  is_using: z.boolean(),
})

/**
 * IndexingEstimatePayload
 */
export const zIndexingEstimatePayload = z.object({
  dataset_id: z.string().nullish(),
  doc_form: z.string().optional().default('text_model'),
  doc_language: z.string().optional().default('English'),
  indexing_technique: z.string(),
  info_list: z.record(z.string(), z.unknown()),
  process_rule: z.record(z.string(), z.unknown()),
})

/**
 * NotionEstimatePayload
 */
export const zNotionEstimatePayload = z.object({
  doc_form: z.string().optional().default('text_model'),
  doc_language: z.string().optional().default('English'),
  notion_info_list: z.array(z.record(z.string(), z.unknown())),
  process_rule: z.record(z.string(), z.unknown()),
})

/**
 * OpaqueObjectResponse
 */
export const zOpaqueObjectResponse = z.record(z.string(), z.unknown())

/**
 * RetrievalSettingResponse
 */
export const zRetrievalSettingResponse = z.object({
  retrieval_method: z.array(z.string()),
})

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

/**
 * AutoDisableLogsResponse
 */
export const zAutoDisableLogsResponse = z.object({
  count: z.int(),
  document_ids: z.array(z.string()),
})

/**
 * DocumentBatchDownloadZipPayload
 *
 * Request payload for bulk downloading documents as a zip archive.
 */
export const zDocumentBatchDownloadZipPayload = z.object({
  document_ids: z.array(z.uuid()).min(1).max(100),
})

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

/**
 * GenerateSummaryPayload
 */
export const zGenerateSummaryPayload = z.object({
  document_list: z.array(z.string()),
})

/**
 * UrlResponse
 */
export const zUrlResponse = z.object({
  url: z.string(),
})

/**
 * DocumentStatusResponse
 */
export const zDocumentStatusResponse = z.object({
  cleaning_completed_at: z.int().nullable(),
  completed_at: z.int().nullable(),
  completed_segments: z.int().nullish(),
  error: z.string().nullable(),
  id: z.string(),
  indexing_status: z.string(),
  parsing_completed_at: z.int().nullable(),
  paused_at: z.int().nullable(),
  processing_started_at: z.int().nullable(),
  splitting_completed_at: z.int().nullable(),
  stopped_at: z.int().nullable(),
  total_segments: z.int().nullish(),
})

/**
 * DocumentStatusListResponse
 */
export const zDocumentStatusListResponse = z.object({
  data: z.array(zDocumentStatusResponse),
})

/**
 * DocumentMetadataUpdatePayload
 */
export const zDocumentMetadataUpdatePayload = z.object({
  doc_metadata: z.unknown().optional(),
  doc_type: z.string().nullish(),
})

/**
 * SimpleResultMessageResponse
 */
export const zSimpleResultMessageResponse = z.object({
  message: z.string(),
  result: z.string(),
})

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

/**
 * SegmentCreatePayload
 */
export const zSegmentCreatePayload = z.object({
  answer: z.string().nullish(),
  attachment_ids: z.array(z.string()).nullish(),
  content: z.string(),
  keywords: z.array(z.string()).nullish(),
})

/**
 * SegmentUpdatePayload
 */
export const zSegmentUpdatePayload = z.object({
  answer: z.string().nullish(),
  attachment_ids: z.array(z.string()).nullish(),
  content: z.string(),
  keywords: z.array(z.string()).nullish(),
  regenerate_child_chunks: z.boolean().optional().default(false),
  summary: z.string().nullish(),
})

/**
 * ChildChunkCreatePayload
 */
export const zChildChunkCreatePayload = z.object({
  content: z.string(),
})

/**
 * ChildChunkUpdatePayload
 */
export const zChildChunkUpdatePayload = z.object({
  content: z.string(),
})

/**
 * ErrorDocsResponse
 */
export const zErrorDocsResponse = z.object({
  data: z.array(zDocumentStatusResponse),
  total: z.int(),
})

/**
 * ExternalHitTestingPayload
 */
export const zExternalHitTestingPayload = z.object({
  external_retrieval_model: z.record(z.string(), z.unknown()).nullish(),
  metadata_filtering_conditions: z.record(z.string(), z.unknown()).nullish(),
  query: z.string(),
})

/**
 * ExternalRetrievalTestResponse
 */
export const zExternalRetrievalTestResponse = z.union([
  z.record(z.string(), z.unknown()),
  z.array(z.record(z.string(), z.unknown())),
])

/**
 * MetadataArgs
 */
export const zMetadataArgs = z.object({
  name: z.string(),
  type: z.enum(['number', 'string', 'time']),
})

/**
 * DatasetMetadataResponse
 */
export const zDatasetMetadataResponse = z.object({
  id: z.string(),
  name: z.string(),
  type: z.string(),
})

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

/**
 * PartialMemberListResponse
 */
export const zPartialMemberListResponse = z.object({
  data: z.array(z.string()),
})

/**
 * DocumentRetryPayload
 */
export const zDocumentRetryPayload = z.object({
  document_ids: z.array(z.string()),
})

/**
 * UsageCheckResponse
 */
export const zUsageCheckResponse = z.object({
  is_using: z.boolean(),
})

/**
 * PermissionEnum
 *
 * Shared permission levels for resources (datasets, credentials, etc.)
 */
export const zPermissionEnum = z.enum(['all_team_members', 'only_me', 'partial_members'])

/**
 * DatasetCreatePayload
 */
export const zDatasetCreatePayload = z.object({
  description: z.string().max(400).optional().default(''),
  external_knowledge_api_id: z.string().nullish(),
  external_knowledge_id: z.string().nullish(),
  indexing_technique: z.string().nullish(),
  name: z.string().min(1).max(40),
  permission: zPermissionEnum.nullish().default('only_me'),
  provider: z.string().optional().default('vendor'),
})

/**
 * DatasetUpdatePayload
 */
export const zDatasetUpdatePayload = z.object({
  description: z.string().max(400).nullish(),
  embedding_model: z.string().nullish(),
  embedding_model_provider: z.string().nullish(),
  external_knowledge_api_id: z.string().nullish(),
  external_knowledge_id: z.string().nullish(),
  external_retrieval_model: z.record(z.string(), z.unknown()).nullish(),
  icon_info: z.record(z.string(), z.unknown()).nullish(),
  indexing_technique: z.string().nullish(),
  is_multimodal: z.boolean().nullish().default(false),
  name: z.string().min(1).max(40).nullish(),
  partial_member_list: z.array(z.record(z.string(), z.string())).nullish(),
  permission: zPermissionEnum.nullish(),
  retrieval_model: z.record(z.string(), z.unknown()).nullish(),
  summary_index_setting: z.record(z.string(), z.unknown()).nullish(),
})

/**
 * DatasetDocMetadataResponse
 */
export const zDatasetDocMetadataResponse = z.object({
  id: z.string(),
  name: z.string(),
  type: z.string(),
})

/**
 * DatasetExternalKnowledgeInfoResponse
 */
export const zDatasetExternalKnowledgeInfoResponse = z.object({
  external_knowledge_api_endpoint: z.string().nullish(),
  external_knowledge_api_id: z.string().nullish(),
  external_knowledge_api_name: z.string().nullish(),
  external_knowledge_id: z.string().nullish(),
})

/**
 * DatasetExternalRetrievalModelResponse
 */
export const zDatasetExternalRetrievalModelResponse = z.object({
  score_threshold: z.number().nullish(),
  score_threshold_enabled: z.boolean().nullish(),
  top_k: z.int(),
})

/**
 * DatasetIconInfoResponse
 */
export const zDatasetIconInfoResponse = z.object({
  icon: z.string().nullish(),
  icon_background: z.string().nullish(),
  icon_type: z.string().nullish(),
  icon_url: z.string().nullish(),
})

/**
 * DatasetSummaryIndexSettingResponse
 */
export const zDatasetSummaryIndexSettingResponse = z.object({
  enable: z.boolean().nullish(),
  model_name: z.string().nullish(),
  model_provider_name: z.string().nullish(),
  summary_prompt: z.string().nullish(),
})

/**
 * DatasetTagResponse
 */
export const zDatasetTagResponse = z.object({
  id: z.string(),
  name: z.string(),
  type: z.string(),
})

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

export const zExternalKnowledgeInfo = z.object({
  external_knowledge_api_endpoint: z.string().optional(),
  external_knowledge_api_id: z.string().optional(),
  external_knowledge_api_name: z.string().optional(),
  external_knowledge_id: z.string().optional(),
})

export const zExternalRetrievalModel = z.object({
  score_threshold: z.number().optional(),
  score_threshold_enabled: z.boolean().optional(),
  top_k: z.int().optional(),
})

export const zDatasetIconInfo = z.object({
  icon: z.string().optional(),
  icon_background: z.string().optional(),
  icon_type: z.string().optional(),
  icon_url: z.string().optional(),
})

export const zAnonymousInlineModelB1954337D565 = z.object({
  enable: z.boolean().optional(),
  model_name: z.string().optional(),
  model_provider_name: z.string().optional(),
  summary_prompt: z.string().optional(),
})

/**
 * Tag
 */
export const zTag = z.object({
  id: z.string(),
  name: z.string(),
  type: z.string(),
})

/**
 * ExternalKnowledgeDatasetBindingResponse
 */
export const zExternalKnowledgeDatasetBindingResponse = z.object({
  id: z.string(),
  name: z.string(),
})

/**
 * ExternalKnowledgeApiResponse
 */
export const zExternalKnowledgeApiResponse = z.object({
  created_at: z.string(),
  created_by: z.string(),
  dataset_bindings: z.array(zExternalKnowledgeDatasetBindingResponse).optional(),
  description: z.string(),
  id: z.string(),
  name: z.string(),
  settings: z.record(z.string(), z.unknown()).nullish(),
  tenant_id: z.string(),
})

/**
 * ExternalKnowledgeApiListResponse
 */
export const zExternalKnowledgeApiListResponse = z.object({
  data: z.array(zExternalKnowledgeApiResponse),
  has_more: z.boolean(),
  limit: z.int(),
  page: z.int(),
  total: z.int(),
})

/**
 * IndexingEstimatePreviewItemResponse
 */
export const zIndexingEstimatePreviewItemResponse = z.object({
  child_chunks: z.array(z.string()).nullish(),
  content: z.string(),
  summary: z.string().nullish(),
})

/**
 * IndexingEstimateQaPreviewItemResponse
 */
export const zIndexingEstimateQaPreviewItemResponse = z.object({
  answer: z.string(),
  question: z.string(),
})

/**
 * IndexingEstimateResponse
 */
export const zIndexingEstimateResponse = z.object({
  preview: z.array(zIndexingEstimatePreviewItemResponse),
  qa_preview: z.array(zIndexingEstimateQaPreviewItemResponse).nullish(),
  total_segments: z.int(),
})

/**
 * DatasetResponse
 */
export const zDatasetResponse = z.object({
  created_at: z.int().nullish(),
  created_by: z.string().nullish(),
  data_source_type: z.string().nullish(),
  description: z.string().nullish(),
  id: z.string(),
  indexing_technique: z.string().nullish(),
  name: z.string(),
  permission: z.string().nullish(),
})

/**
 * DatasetMetadataBuiltInFieldResponse
 */
export const zDatasetMetadataBuiltInFieldResponse = z.object({
  name: z.string(),
  type: z.string(),
})

/**
 * DatasetMetadataBuiltInFieldsResponse
 */
export const zDatasetMetadataBuiltInFieldsResponse = z.object({
  fields: z.array(zDatasetMetadataBuiltInFieldResponse),
})

/**
 * PreviewDetail
 */
export const zPreviewDetail = z.object({
  child_chunks: z.array(z.string()).nullish(),
  content: z.string(),
  summary: z.string().nullish(),
})

/**
 * QAPreviewDetail
 */
export const zQaPreviewDetail = z.object({
  answer: z.string(),
  question: z.string(),
})

/**
 * IndexingEstimate
 */
export const zIndexingEstimate = z.object({
  preview: z.array(zPreviewDetail),
  qa_preview: z.array(zQaPreviewDetail).nullish(),
  total_segments: z.int(),
})

/**
 * DocumentMetadataResponse
 */
export const zDocumentMetadataResponse = z.object({
  id: z.string(),
  name: z.string(),
  type: z.string(),
  value: z.union([z.string(), z.int(), z.number(), z.boolean()]).nullish(),
})

/**
 * DocumentResponse
 */
export const zDocumentResponse = z.object({
  archived: z.boolean().nullish(),
  created_at: z.int().nullish(),
  created_by: z.string().nullish(),
  created_from: z.string().nullish(),
  data_source_detail_dict: z.unknown().optional(),
  data_source_info: z.unknown().optional(),
  data_source_type: z.string().nullish(),
  dataset_process_rule_id: z.string().nullish(),
  disabled_at: z.int().nullish(),
  disabled_by: z.string().nullish(),
  display_status: z.string().nullish(),
  doc_form: z.string().nullish(),
  doc_metadata: z.array(zDocumentMetadataResponse).optional(),
  enabled: z.boolean().nullish(),
  error: z.string().nullish(),
  hit_count: z.int().nullish(),
  id: z.string(),
  indexing_status: z.string().nullish(),
  name: z.string(),
  need_summary: z.boolean().nullish(),
  position: z.int().nullish(),
  summary_index_status: z.string().nullish(),
  tokens: z.int().nullish(),
  word_count: z.int().nullish(),
})

/**
 * DatasetAndDocumentResponse
 */
export const zDatasetAndDocumentResponse = z.object({
  batch: z.string(),
  dataset: zDatasetResponse,
  documents: z.array(zDocumentResponse),
})

/**
 * DocumentWithSegmentsResponse
 */
export const zDocumentWithSegmentsResponse = z.object({
  archived: z.boolean().nullish(),
  completed_segments: z.int().nullish(),
  created_at: z.int().nullish(),
  created_by: z.string().nullish(),
  created_from: z.string().nullish(),
  data_source_detail_dict: z.unknown().optional(),
  data_source_info: z.unknown().optional(),
  data_source_type: z.string().nullish(),
  dataset_process_rule_id: z.string().nullish(),
  disabled_at: z.int().nullish(),
  disabled_by: z.string().nullish(),
  display_status: z.string().nullish(),
  doc_form: z.string().nullish(),
  doc_metadata: z.array(zDocumentMetadataResponse).optional(),
  enabled: z.boolean().nullish(),
  error: z.string().nullish(),
  hit_count: z.int().nullish(),
  id: z.string(),
  indexing_status: z.string().nullish(),
  name: z.string(),
  need_summary: z.boolean().nullish(),
  position: z.int().nullish(),
  process_rule_dict: z.unknown().optional(),
  summary_index_status: z.string().nullish(),
  tokens: z.int().nullish(),
  total_segments: z.int().nullish(),
  word_count: z.int().nullish(),
})

/**
 * DocumentWithSegmentsListResponse
 */
export const zDocumentWithSegmentsListResponse = z.object({
  data: z.array(zDocumentWithSegmentsResponse),
  has_more: z.boolean(),
  limit: z.int(),
  page: z.int(),
  total: z.int(),
})

/**
 * ChildChunkResponse
 */
export const zChildChunkResponse = z.object({
  content: z.string(),
  created_at: z.int(),
  id: z.string(),
  position: z.int(),
  segment_id: z.string(),
  type: z.string(),
  updated_at: z.int(),
  word_count: z.int(),
})

/**
 * ChildChunkListResponse
 */
export const zChildChunkListResponse = z.object({
  data: z.array(zChildChunkResponse),
  limit: z.int(),
  page: z.int(),
  total: z.int(),
  total_pages: z.int(),
})

/**
 * ChildChunkBatchUpdateResponse
 */
export const zChildChunkBatchUpdateResponse = z.object({
  data: z.array(zChildChunkResponse),
})

/**
 * ChildChunkDetailResponse
 */
export const zChildChunkDetailResponse = z.object({
  data: zChildChunkResponse,
})

/**
 * ChildChunkUpdateArgs
 */
export const zChildChunkUpdateArgs = z.object({
  content: z.string(),
  id: z.string().nullish(),
})

/**
 * ChildChunkBatchUpdatePayload
 */
export const zChildChunkBatchUpdatePayload = z.object({
  chunks: z.array(zChildChunkUpdateArgs),
})

/**
 * HitTestingQuery
 */
export const zHitTestingQuery = z.object({
  content: z.string(),
})

/**
 * DatasetMetadataListItemResponse
 */
export const zDatasetMetadataListItemResponse = z.object({
  count: z.int().optional().default(0),
  id: z.string(),
  name: z.string(),
  type: z.string(),
})

/**
 * DatasetMetadataListResponse
 */
export const zDatasetMetadataListResponse = z.object({
  built_in_field_enabled: z.boolean(),
  doc_metadata: z.array(zDatasetMetadataListItemResponse),
})

/**
 * RelatedAppResponse
 */
export const zRelatedAppResponse = z.object({
  description: z.string(),
  icon: z.string().nullable(),
  icon_background: z.string().nullable(),
  icon_type: z.string().nullable(),
  icon_url: z.string().nullish(),
  id: z.string(),
  mode: z.string(),
  name: z.string(),
})

/**
 * RelatedAppListResponse
 */
export const zRelatedAppListResponse = z.object({
  data: z.array(zRelatedAppResponse),
  total: z.int(),
})

/**
 * DatasetRerankingModelResponse
 */
export const zDatasetRerankingModelResponse = z.object({
  reranking_model_name: z.string().nullish(),
  reranking_provider_name: z.string().nullish(),
})

export const zDatasetRerankingModel = z.object({
  reranking_model_name: z.string().optional(),
  reranking_provider_name: z.string().optional(),
})

/**
 * ProcessRuleMode
 *
 * Dataset Process Rule Mode
 */
export const zProcessRuleMode = z.enum(['automatic', 'custom', 'hierarchical'])

/**
 * RerankingModel
 */
export const zRerankingModel = z.object({
  reranking_model_name: z.string().nullish(),
  reranking_provider_name: z.string().nullish(),
})

/**
 * RetrievalMethod
 */
export const zRetrievalMethod = z.enum([
  'full_text_search',
  'hybrid_search',
  'keyword_search',
  'semantic_search',
])

/**
 * MetadataDetail
 */
export const zMetadataDetail = z.object({
  id: z.string(),
  name: z.string(),
  value: z.union([z.string(), z.int(), z.number()]).nullish(),
})

/**
 * DocumentMetadataOperation
 */
export const zDocumentMetadataOperation = z.object({
  document_id: z.string(),
  metadata_list: z.array(zMetadataDetail),
  partial_update: z.boolean().optional().default(false),
})

/**
 * MetadataOperationData
 *
 * Metadata operation data
 */
export const zMetadataOperationData = z.object({
  operation_data: z.array(zDocumentMetadataOperation),
})

/**
 * SegmentAttachmentResponse
 */
export const zSegmentAttachmentResponse = z.object({
  extension: z.string(),
  id: z.string(),
  mime_type: z.string().nullable(),
  name: z.string(),
  size: z.int(),
  source_url: z.string(),
})

/**
 * SegmentResponse
 */
export const zSegmentResponse = z.object({
  answer: z.string().nullable(),
  attachments: z.array(zSegmentAttachmentResponse),
  child_chunks: z.array(zChildChunkResponse),
  completed_at: z.int().nullable(),
  content: z.string(),
  created_at: z.int(),
  created_by: z.string(),
  disabled_at: z.int().nullable(),
  disabled_by: z.string().nullable(),
  document_id: z.string(),
  enabled: z.boolean(),
  error: z.string().nullable(),
  hit_count: z.int(),
  id: z.string(),
  index_node_hash: z.string().nullable(),
  index_node_id: z.string().nullable(),
  indexing_at: z.int().nullable(),
  keywords: z.array(z.string()).nullable(),
  position: z.int(),
  sign_content: z.string(),
  status: z.string(),
  stopped_at: z.int().nullable(),
  summary: z.string().nullable(),
  tokens: z.int(),
  updated_at: z.int(),
  updated_by: z.string().nullable(),
  word_count: z.int(),
})

/**
 * SegmentDetailResponse
 */
export const zSegmentDetailResponse = z.object({
  data: zSegmentResponse,
  doc_form: z.string(),
})

/**
 * ConsoleSegmentListResponse
 */
export const zConsoleSegmentListResponse = z.object({
  data: z.array(zSegmentResponse),
  limit: z.int(),
  page: z.int(),
  total: z.int(),
  total_pages: z.int(),
})

/**
 * HitTestingChildChunk
 */
export const zHitTestingChildChunk = z.object({
  content: z.string(),
  id: z.string(),
  position: z.int(),
  score: z.number(),
})

/**
 * HitTestingFile
 */
export const zHitTestingFile = z.object({
  extension: z.string(),
  id: z.string(),
  mime_type: z.string(),
  name: z.string(),
  size: z.int(),
  source_url: z.string(),
})

/**
 * DatasetKeywordSettingResponse
 */
export const zDatasetKeywordSettingResponse = z.object({
  keyword_weight: z.number().nullish(),
})

/**
 * DatasetVectorSettingResponse
 */
export const zDatasetVectorSettingResponse = z.object({
  embedding_model_name: z.string().nullish(),
  embedding_provider_name: z.string().nullish(),
  vector_weight: z.number().nullish(),
})

/**
 * DatasetWeightedScoreResponse
 */
export const zDatasetWeightedScoreResponse = z.object({
  keyword_setting: zDatasetKeywordSettingResponse.optional(),
  vector_setting: zDatasetVectorSettingResponse.optional(),
  weight_type: z.string().nullish(),
})

/**
 * DatasetRetrievalModelResponse
 */
export const zDatasetRetrievalModelResponse = z.object({
  reranking_enable: z.boolean(),
  reranking_mode: z.string().nullish(),
  reranking_model: zDatasetRerankingModelResponse.optional(),
  score_threshold: z.number().nullish(),
  score_threshold_enabled: z.boolean(),
  search_method: z.string(),
  top_k: z.int(),
  weights: zDatasetWeightedScoreResponse.nullish(),
})

/**
 * DatasetDetailResponse
 */
export const zDatasetDetailResponse = z.object({
  app_count: z.int(),
  author_name: z.string().nullable(),
  built_in_field_enabled: z.boolean(),
  chunk_structure: z.string().nullable(),
  created_at: z.int(),
  created_by: z.string(),
  data_source_type: z.string().nullable(),
  description: z.string().nullable(),
  doc_form: z.string().nullable(),
  doc_metadata: z.array(zDatasetDocMetadataResponse),
  document_count: z.int(),
  embedding_available: z.boolean().nullish(),
  embedding_model: z.string().nullable(),
  embedding_model_provider: z.string().nullable(),
  enable_api: z.boolean(),
  external_knowledge_info: zDatasetExternalKnowledgeInfoResponse.optional(),
  external_retrieval_model: zDatasetExternalRetrievalModelResponse.nullable(),
  icon_info: zDatasetIconInfoResponse.optional(),
  id: z.string(),
  indexing_technique: z.string().nullable(),
  is_multimodal: z.boolean(),
  is_published: z.boolean(),
  name: z.string(),
  permission: z.string(),
  pipeline_id: z.string().nullable(),
  provider: z.string(),
  retrieval_model_dict: zDatasetRetrievalModelResponse,
  runtime_mode: z.string().nullable(),
  summary_index_setting: zDatasetSummaryIndexSettingResponse.optional(),
  tags: z.array(zDatasetTagResponse),
  total_available_documents: z.int(),
  total_documents: z.int(),
  updated_at: z.int(),
  updated_by: z.string().nullable(),
  word_count: z.int(),
})

/**
 * DatasetDetailWithPartialMembersResponse
 */
export const zDatasetDetailWithPartialMembersResponse = z.object({
  app_count: z.int(),
  author_name: z.string().nullable(),
  built_in_field_enabled: z.boolean(),
  chunk_structure: z.string().nullable(),
  created_at: z.int(),
  created_by: z.string(),
  data_source_type: z.string().nullable(),
  description: z.string().nullable(),
  doc_form: z.string().nullable(),
  doc_metadata: z.array(zDatasetDocMetadataResponse),
  document_count: z.int(),
  embedding_available: z.boolean().nullish(),
  embedding_model: z.string().nullable(),
  embedding_model_provider: z.string().nullable(),
  enable_api: z.boolean(),
  external_knowledge_info: zDatasetExternalKnowledgeInfoResponse.optional(),
  external_retrieval_model: zDatasetExternalRetrievalModelResponse.nullable(),
  icon_info: zDatasetIconInfoResponse.optional(),
  id: z.string(),
  indexing_technique: z.string().nullable(),
  is_multimodal: z.boolean(),
  is_published: z.boolean(),
  name: z.string(),
  partial_member_list: z.array(z.string()).nullish(),
  permission: z.string(),
  pipeline_id: z.string().nullable(),
  provider: z.string(),
  retrieval_model_dict: zDatasetRetrievalModelResponse,
  runtime_mode: z.string().nullable(),
  summary_index_setting: zDatasetSummaryIndexSettingResponse.optional(),
  tags: z.array(zDatasetTagResponse),
  total_available_documents: z.int(),
  total_documents: z.int(),
  updated_at: z.int(),
  updated_by: z.string().nullable(),
  word_count: z.int(),
})

/**
 * DatasetListItemResponse
 */
export const zDatasetListItemResponse = z.object({
  app_count: z.int(),
  author_name: z.string().nullable(),
  built_in_field_enabled: z.boolean(),
  chunk_structure: z.string().nullable(),
  created_at: z.int(),
  created_by: z.string(),
  data_source_type: z.string().nullable(),
  description: z.string().nullable(),
  doc_form: z.string().nullable(),
  doc_metadata: z.array(zDatasetDocMetadataResponse),
  document_count: z.int(),
  embedding_available: z.boolean().nullish(),
  embedding_model: z.string().nullable(),
  embedding_model_provider: z.string().nullable(),
  enable_api: z.boolean(),
  external_knowledge_info: zDatasetExternalKnowledgeInfoResponse.optional(),
  external_retrieval_model: zDatasetExternalRetrievalModelResponse.nullable(),
  icon_info: zDatasetIconInfoResponse.optional(),
  id: z.string(),
  indexing_technique: z.string().nullable(),
  is_multimodal: z.boolean(),
  is_published: z.boolean(),
  name: z.string(),
  partial_member_list: z.array(z.string()),
  permission: z.string(),
  pipeline_id: z.string().nullable(),
  provider: z.string(),
  retrieval_model_dict: zDatasetRetrievalModelResponse,
  runtime_mode: z.string().nullable(),
  summary_index_setting: zDatasetSummaryIndexSettingResponse.optional(),
  tags: z.array(zDatasetTagResponse),
  total_available_documents: z.int(),
  total_documents: z.int(),
  updated_at: z.int(),
  updated_by: z.string().nullable(),
  word_count: z.int(),
})

/**
 * DatasetListResponse
 */
export const zDatasetListResponse = z.object({
  data: z.array(zDatasetListItemResponse),
  has_more: z.boolean(),
  limit: z.int(),
  page: z.int(),
  total: z.int(),
})

export const zDatasetKeywordSetting = z.object({
  keyword_weight: z.number().optional(),
})

export const zDatasetVectorSetting = z.object({
  embedding_model_name: z.string().optional(),
  embedding_provider_name: z.string().optional(),
  vector_weight: z.number().optional(),
})

export const zDatasetWeightedScore = z.object({
  keyword_setting: zDatasetKeywordSetting.optional(),
  vector_setting: zDatasetVectorSetting.optional(),
  weight_type: z.string().optional(),
})

export const zDatasetRetrievalModel = z.object({
  reranking_enable: z.boolean().optional(),
  reranking_mode: z.string().optional(),
  reranking_model: zDatasetRerankingModel.optional(),
  score_threshold: z.number().optional(),
  score_threshold_enabled: z.boolean().optional(),
  search_method: z.string().optional(),
  top_k: z.int().optional(),
  weights: zDatasetWeightedScore.optional(),
})

export const zDatasetDetail = z.object({
  app_count: z.int().optional(),
  author_name: z.string().optional(),
  built_in_field_enabled: z.boolean().optional(),
  chunk_structure: 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(),
  data_source_type: z.string().optional(),
  description: z.string().optional(),
  doc_form: z.string().optional(),
  doc_metadata: z.array(zDatasetDocMetadata).optional(),
  document_count: z.int().optional(),
  embedding_available: z.boolean().optional(),
  embedding_model: z.string().optional(),
  embedding_model_provider: z.string().optional(),
  enable_api: z.boolean().optional(),
  external_knowledge_info: zExternalKnowledgeInfo.optional(),
  external_retrieval_model: zExternalRetrievalModel.optional(),
  icon_info: zDatasetIconInfo.optional(),
  id: z.string().optional(),
  indexing_technique: z.string().optional(),
  is_multimodal: z.boolean().optional(),
  is_published: z.boolean().optional(),
  name: z.string().optional(),
  permission: z.string().optional(),
  pipeline_id: z.string().optional(),
  provider: z.string().optional(),
  retrieval_model_dict: zDatasetRetrievalModel.optional(),
  runtime_mode: z.string().optional(),
  summary_index_setting: zAnonymousInlineModelB1954337D565.optional(),
  tags: z.array(zTag).optional(),
  total_available_documents: z.int().optional(),
  total_documents: z.int().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(),
  word_count: z.int().optional(),
})

/**
 * FileInfo
 */
export const zFileInfo = z.object({
  file_ids: z.array(z.string()),
})

/**
 * WebsiteInfo
 */
export const zWebsiteInfo = z.object({
  job_id: z.string(),
  only_main_content: z.boolean().optional().default(true),
  provider: z.string(),
  urls: z.array(z.string()),
})

/**
 * PreProcessingRule
 */
export const zPreProcessingRule = z.object({
  enabled: z.boolean(),
  id: z.string(),
})

/**
 * Segmentation
 */
export const zSegmentation = z.object({
  chunk_overlap: z.int().optional().default(0),
  max_tokens: z.int(),
  separator: z.string().optional().default('\n'),
})

/**
 * Rule
 */
export const zRule = z.object({
  parent_mode: z.enum(['full-doc', 'paragraph']).nullish(),
  pre_processing_rules: z.array(zPreProcessingRule).nullish(),
  segmentation: zSegmentation.nullish(),
  subchunk_segmentation: zSegmentation.nullish(),
})

/**
 * ProcessRule
 */
export const zProcessRule = z.object({
  mode: zProcessRuleMode,
  rules: zRule.nullish(),
})

/**
 * Condition
 *
 * Condition detail
 */
export const zCondition = z.object({
  comparison_operator: z.enum([
    '<',
    '=',
    '>',
    'after',
    'before',
    'contains',
    'empty',
    'end with',
    'in',
    'is',
    'is not',
    'not contains',
    'not empty',
    'not in',
    'start with',
    '≠',
    '≤',
    '≥',
  ]),
  name: z.string(),
  value: z.union([z.string(), z.array(z.string()), z.int(), z.number()]).nullish(),
})

/**
 * MetadataFilteringCondition
 *
 * Metadata Filtering Condition.
 */
export const zMetadataFilteringCondition = z.object({
  conditions: z.array(zCondition).nullish(),
  logical_operator: z.enum(['and', 'or']).nullish().default('and'),
})

/**
 * WeightKeywordSetting
 */
export const zWeightKeywordSetting = z.object({
  keyword_weight: z.number(),
})

/**
 * WeightVectorSetting
 */
export const zWeightVectorSetting = z.object({
  embedding_model_name: z.string(),
  embedding_provider_name: z.string(),
  vector_weight: z.number(),
})

/**
 * WeightModel
 */
export const zWeightModel = z.object({
  keyword_setting: zWeightKeywordSetting.nullish(),
  vector_setting: zWeightVectorSetting.nullish(),
  weight_type: z.enum(['customized', 'keyword_first', 'semantic_first']).nullish(),
})

/**
 * RetrievalModel
 */
export const zRetrievalModel = z.object({
  metadata_filtering_conditions: zMetadataFilteringCondition.nullish(),
  reranking_enable: z.boolean(),
  reranking_mode: z.string().nullish(),
  reranking_model: zRerankingModel.nullish(),
  score_threshold: z.number().nullish(),
  score_threshold_enabled: z.boolean(),
  search_method: zRetrievalMethod,
  top_k: z.int(),
  weights: zWeightModel.nullish(),
})

/**
 * HitTestingPayload
 */
export const zHitTestingPayload = z.object({
  attachment_ids: z.array(z.string()).nullish(),
  external_retrieval_model: z.record(z.string(), z.unknown()).nullish(),
  query: z.string().max(250),
  retrieval_model: zRetrievalModel.nullish(),
})

/**
 * HitTestingDocument
 */
export const zHitTestingDocument = z.object({
  data_source_type: z.string(),
  doc_metadata: z.unknown().nullable(),
  doc_type: z.string().nullable(),
  id: z.string(),
  name: z.string(),
})

/**
 * HitTestingSegment
 */
export const zHitTestingSegment = z.object({
  answer: z.string().nullable(),
  completed_at: z.int().nullable(),
  content: z.string(),
  created_at: z.int(),
  created_by: z.string(),
  disabled_at: z.int().nullable(),
  disabled_by: z.string().nullable(),
  document: zHitTestingDocument,
  document_id: z.string(),
  enabled: z.boolean(),
  error: z.string().nullable(),
  hit_count: z.int(),
  id: z.string(),
  index_node_hash: z.string().nullable(),
  index_node_id: z.string().nullable(),
  indexing_at: z.int().nullable(),
  keywords: z.array(z.string()),
  position: z.int(),
  sign_content: z.string().nullable(),
  status: z.string(),
  stopped_at: z.int().nullable(),
  tokens: z.int(),
  word_count: z.int(),
})

/**
 * HitTestingRecord
 */
export const zHitTestingRecord = z.object({
  child_chunks: z.array(zHitTestingChildChunk),
  files: z.array(zHitTestingFile),
  score: z.number().nullable(),
  segment: zHitTestingSegment,
  summary: z.string().nullable(),
  tsne_position: z.unknown().nullable(),
})

/**
 * HitTestingResponse
 */
export const zHitTestingResponse = z.object({
  query: zHitTestingQuery,
  records: z.array(zHitTestingRecord),
})

/**
 * DatasetQueryFileInfoResponse
 */
export const zDatasetQueryFileInfoResponse = z.object({
  extension: z.string(),
  id: z.string(),
  mime_type: z.string(),
  name: z.string(),
  size: z.int(),
  source_url: z.string(),
})

/**
 * DatasetQueryContentResponse
 */
export const zDatasetQueryContentResponse = z.object({
  content: z.string(),
  content_type: z.string(),
  file_info: zDatasetQueryFileInfoResponse.nullish(),
})

/**
 * DatasetQueryDetailResponse
 */
export const zDatasetQueryDetailResponse = z.object({
  created_at: z.int(),
  created_by: z.string(),
  created_by_role: z.string(),
  id: z.string(),
  queries: z.array(zDatasetQueryContentResponse),
  source: z.string(),
  source_app_id: z.string().nullable(),
})

/**
 * DatasetQueryListResponse
 */
export const zDatasetQueryListResponse = z.object({
  data: z.array(zDatasetQueryDetailResponse),
  has_more: z.boolean(),
  limit: z.int(),
  page: z.int(),
  total: z.int(),
})

/**
 * NotionIcon
 */
export const zNotionIcon = z.object({
  emoji: z.string().nullish(),
  type: z.string(),
  url: z.string().nullish(),
})

/**
 * NotionPage
 */
export const zNotionPage = z.object({
  page_icon: zNotionIcon.nullish(),
  page_id: z.string(),
  page_name: z.string(),
  type: z.string(),
})

/**
 * NotionInfo
 */
export const zNotionInfo = z.object({
  credential_id: z.string(),
  pages: z.array(zNotionPage),
  workspace_id: z.string(),
})

/**
 * InfoList
 */
export const zInfoList = z.object({
  data_source_type: z.enum(['notion_import', 'upload_file', 'website_crawl']),
  file_info_list: zFileInfo.nullish(),
  notion_info_list: z.array(zNotionInfo).nullish(),
  website_info_list: zWebsiteInfo.nullish(),
})

/**
 * DataSource
 */
export const zDataSource = z.object({
  info_list: zInfoList,
})

/**
 * KnowledgeConfig
 */
export const zKnowledgeConfig = z.object({
  data_source: zDataSource.nullish(),
  doc_form: z.string().optional().default('text_model'),
  doc_language: z.string().optional().default('English'),
  duplicate: z.boolean().optional().default(true),
  embedding_model: z.string().nullish(),
  embedding_model_provider: z.string().nullish(),
  indexing_technique: z.enum(['economy', 'high_quality']),
  is_multimodal: z.boolean().optional().default(false),
  name: z.string().nullish(),
  original_document_id: z.string().nullish(),
  process_rule: zProcessRule.nullish(),
  retrieval_model: zRetrievalModel.nullish(),
  summary_index_setting: z.record(z.string(), z.unknown()).nullish(),
})

export const zGetDatasetsQuery = z.object({
  ids: z.array(z.string()).optional(),
  include_all: z.boolean().optional().default(false),
  keyword: z.string().optional(),
  limit: z.int().optional().default(20),
  page: z.int().optional().default(1),
  tag_ids: z.array(z.string()).optional(),
})

/**
 * Datasets retrieved successfully
 */
export const zGetDatasetsResponse = zDatasetListResponse

export const zPostDatasetsBody = zDatasetCreatePayload

/**
 * Dataset created successfully
 */
export const zPostDatasetsResponse = zDatasetDetailResponse

/**
 * API base info retrieved successfully
 */
export const zGetDatasetsApiBaseInfoResponse = zApiBaseUrlResponse

/**
 * API keys retrieved successfully
 */
export const zGetDatasetsApiKeysResponse = zApiKeyList

/**
 * API key created successfully
 */
export const zPostDatasetsApiKeysResponse = zApiKeyItem

export const zDeleteDatasetsApiKeysByApiKeyIdPath = z.object({
  api_key_id: z.string(),
})

/**
 * API key deleted successfully
 */
export const zDeleteDatasetsApiKeysByApiKeyIdResponse = z.void()

export const zGetDatasetsBatchImportStatusByJobIdPath = z.object({
  job_id: z.string(),
})

/**
 * Batch import status
 */
export const zGetDatasetsBatchImportStatusByJobIdResponse = zSegmentBatchImportStatusResponse

export const zPostDatasetsBatchImportStatusByJobIdBody = zBatchImportPayload

export const zPostDatasetsBatchImportStatusByJobIdPath = z.object({
  job_id: z.string(),
})

/**
 * Batch import started
 */
export const zPostDatasetsBatchImportStatusByJobIdResponse = zSegmentBatchImportStatusResponse

export const zPostDatasetsExternalBody = zExternalDatasetCreatePayload

/**
 * External dataset created successfully
 */
export const zPostDatasetsExternalResponse = zDatasetDetail

export const zGetDatasetsExternalKnowledgeApiQuery = z.object({
  keyword: z.string().optional(),
  limit: z.int().optional().default(20),
  page: z.int().optional().default(1),
})

/**
 * External API templates retrieved successfully
 */
export const zGetDatasetsExternalKnowledgeApiResponse = zExternalKnowledgeApiListResponse

export const zPostDatasetsExternalKnowledgeApiBody = zExternalKnowledgeApiPayload

/**
 * External API template created successfully
 */
export const zPostDatasetsExternalKnowledgeApiResponse = zExternalKnowledgeApiResponse

export const zDeleteDatasetsExternalKnowledgeApiByExternalKnowledgeApiIdPath = z.object({
  external_knowledge_api_id: z.string(),
})

/**
 * External knowledge API deleted successfully
 */
export const zDeleteDatasetsExternalKnowledgeApiByExternalKnowledgeApiIdResponse = z.void()

export const zGetDatasetsExternalKnowledgeApiByExternalKnowledgeApiIdPath = z.object({
  external_knowledge_api_id: z.string(),
})

/**
 * External API template retrieved successfully
 */
export const zGetDatasetsExternalKnowledgeApiByExternalKnowledgeApiIdResponse
  = zExternalKnowledgeApiResponse

export const zPatchDatasetsExternalKnowledgeApiByExternalKnowledgeApiIdBody
  = zExternalKnowledgeApiPayload

export const zPatchDatasetsExternalKnowledgeApiByExternalKnowledgeApiIdPath = z.object({
  external_knowledge_api_id: z.string(),
})

/**
 * External API template updated successfully
 */
export const zPatchDatasetsExternalKnowledgeApiByExternalKnowledgeApiIdResponse
  = zExternalKnowledgeApiResponse

export const zGetDatasetsExternalKnowledgeApiByExternalKnowledgeApiIdUseCheckPath = z.object({
  external_knowledge_api_id: z.string(),
})

/**
 * Usage check completed successfully
 */
export const zGetDatasetsExternalKnowledgeApiByExternalKnowledgeApiIdUseCheckResponse
  = zUsageCountResponse

export const zPostDatasetsIndexingEstimateBody = zIndexingEstimatePayload

/**
 * Indexing estimate calculated successfully
 */
export const zPostDatasetsIndexingEstimateResponse = zIndexingEstimateResponse

export const zPostDatasetsInitBody = zKnowledgeConfig

/**
 * Dataset initialized successfully
 */
export const zPostDatasetsInitResponse = zDatasetAndDocumentResponse

/**
 * Built-in fields retrieved successfully
 */
export const zGetDatasetsMetadataBuiltInResponse = zDatasetMetadataBuiltInFieldsResponse

export const zPostDatasetsNotionIndexingEstimateBody = zNotionEstimatePayload

/**
 * Success
 */
export const zPostDatasetsNotionIndexingEstimateResponse = zIndexingEstimate

export const zGetDatasetsProcessRuleQuery = z.object({
  document_id: z.string().optional(),
})

/**
 * Process rules retrieved successfully
 */
export const zGetDatasetsProcessRuleResponse = zOpaqueObjectResponse

/**
 * Retrieval settings retrieved successfully
 */
export const zGetDatasetsRetrievalSettingResponse = zRetrievalSettingResponse

export const zGetDatasetsRetrievalSettingByVectorTypePath = z.object({
  vector_type: z.string(),
})

/**
 * Mock retrieval settings retrieved successfully
 */
export const zGetDatasetsRetrievalSettingByVectorTypeResponse = zRetrievalSettingResponse

export const zDeleteDatasetsByDatasetIdPath = z.object({
  dataset_id: z.string(),
})

/**
 * Dataset deleted successfully
 */
export const zDeleteDatasetsByDatasetIdResponse = z.void()

export const zGetDatasetsByDatasetIdPath = z.object({
  dataset_id: z.string(),
})

/**
 * Dataset retrieved successfully
 */
export const zGetDatasetsByDatasetIdResponse = zDatasetDetailWithPartialMembersResponse

export const zPatchDatasetsByDatasetIdBody = zDatasetUpdatePayload

export const zPatchDatasetsByDatasetIdPath = z.object({
  dataset_id: z.string(),
})

/**
 * Dataset updated successfully
 */
export const zPatchDatasetsByDatasetIdResponse = zDatasetDetailWithPartialMembersResponse

export const zPostDatasetsByDatasetIdApiKeysByStatusPath = z.object({
  dataset_id: z.string(),
  status: z.string(),
})

/**
 * Success
 */
export const zPostDatasetsByDatasetIdApiKeysByStatusResponse = zSimpleResultResponse

export const zGetDatasetsByDatasetIdAutoDisableLogsPath = z.object({
  dataset_id: z.string(),
})

/**
 * Auto disable logs retrieved successfully
 */
export const zGetDatasetsByDatasetIdAutoDisableLogsResponse = zAutoDisableLogsResponse

export const zGetDatasetsByDatasetIdBatchByBatchIndexingEstimatePath = z.object({
  batch: z.string(),
  dataset_id: z.string(),
})

/**
 * Batch indexing estimate calculated successfully
 */
export const zGetDatasetsByDatasetIdBatchByBatchIndexingEstimateResponse = zOpaqueObjectResponse

export const zGetDatasetsByDatasetIdBatchByBatchIndexingStatusPath = z.object({
  batch: z.string(),
  dataset_id: z.string(),
})

/**
 * Indexing status retrieved successfully
 */
export const zGetDatasetsByDatasetIdBatchByBatchIndexingStatusResponse = zDocumentStatusListResponse

export const zDeleteDatasetsByDatasetIdDocumentsPath = z.object({
  dataset_id: z.string(),
})

/**
 * Documents deleted successfully
 */
export const zDeleteDatasetsByDatasetIdDocumentsResponse = z.void()

export const zGetDatasetsByDatasetIdDocumentsPath = z.object({
  dataset_id: z.string(),
})

export const zGetDatasetsByDatasetIdDocumentsQuery = z.object({
  fetch: z.string().optional(),
  keyword: z.string().optional(),
  limit: z.string().optional(),
  page: z.string().optional(),
  sort: z.string().optional(),
  status: z.string().optional(),
})

/**
 * Documents retrieved successfully
 */
export const zGetDatasetsByDatasetIdDocumentsResponse = zDocumentWithSegmentsListResponse

export const zPostDatasetsByDatasetIdDocumentsBody = zKnowledgeConfig

export const zPostDatasetsByDatasetIdDocumentsPath = z.object({
  dataset_id: z.string(),
})

/**
 * Documents created successfully
 */
export const zPostDatasetsByDatasetIdDocumentsResponse = zDatasetAndDocumentResponse

export const zPostDatasetsByDatasetIdDocumentsDownloadZipBody = zDocumentBatchDownloadZipPayload

export const zPostDatasetsByDatasetIdDocumentsDownloadZipPath = z.object({
  dataset_id: z.string(),
})

/**
 * ZIP archive generated successfully
 */
export const zPostDatasetsByDatasetIdDocumentsDownloadZipResponse = zBinaryFileResponse

export const zPostDatasetsByDatasetIdDocumentsGenerateSummaryBody = zGenerateSummaryPayload

export const zPostDatasetsByDatasetIdDocumentsGenerateSummaryPath = z.object({
  dataset_id: z.string(),
})

/**
 * Summary generation started successfully
 */
export const zPostDatasetsByDatasetIdDocumentsGenerateSummaryResponse = zSimpleResultResponse

export const zPostDatasetsByDatasetIdDocumentsMetadataBody = zMetadataOperationData

export const zPostDatasetsByDatasetIdDocumentsMetadataPath = z.object({
  dataset_id: z.string(),
})

/**
 * Documents metadata updated successfully
 */
export const zPostDatasetsByDatasetIdDocumentsMetadataResponse = z.void()

export const zPatchDatasetsByDatasetIdDocumentsStatusByActionBatchPath = z.object({
  action: z.string(),
  dataset_id: z.string(),
})

/**
 * Success
 */
export const zPatchDatasetsByDatasetIdDocumentsStatusByActionBatchResponse = zSimpleResultResponse

export const zDeleteDatasetsByDatasetIdDocumentsByDocumentIdPath = z.object({
  dataset_id: z.string(),
  document_id: z.string(),
})

/**
 * Document deleted successfully
 */
export const zDeleteDatasetsByDatasetIdDocumentsByDocumentIdResponse = z.void()

export const zGetDatasetsByDatasetIdDocumentsByDocumentIdPath = z.object({
  dataset_id: z.string(),
  document_id: z.string(),
})

export const zGetDatasetsByDatasetIdDocumentsByDocumentIdQuery = z.object({
  metadata: z.string().optional(),
})

/**
 * Document retrieved successfully
 */
export const zGetDatasetsByDatasetIdDocumentsByDocumentIdResponse = zOpaqueObjectResponse

export const zGetDatasetsByDatasetIdDocumentsByDocumentIdDownloadPath = z.object({
  dataset_id: z.string(),
  document_id: z.string(),
})

/**
 * Download URL generated successfully
 */
export const zGetDatasetsByDatasetIdDocumentsByDocumentIdDownloadResponse = zUrlResponse

export const zGetDatasetsByDatasetIdDocumentsByDocumentIdIndexingEstimatePath = z.object({
  dataset_id: z.string(),
  document_id: z.string(),
})

/**
 * Indexing estimate calculated successfully
 */
export const zGetDatasetsByDatasetIdDocumentsByDocumentIdIndexingEstimateResponse
  = zOpaqueObjectResponse

export const zGetDatasetsByDatasetIdDocumentsByDocumentIdIndexingStatusPath = z.object({
  dataset_id: z.string(),
  document_id: z.string(),
})

/**
 * Indexing status retrieved successfully
 */
export const zGetDatasetsByDatasetIdDocumentsByDocumentIdIndexingStatusResponse
  = zDocumentStatusResponse

export const zPutDatasetsByDatasetIdDocumentsByDocumentIdMetadataBody
  = zDocumentMetadataUpdatePayload

export const zPutDatasetsByDatasetIdDocumentsByDocumentIdMetadataPath = z.object({
  dataset_id: z.string(),
  document_id: z.string(),
})

/**
 * Document metadata updated successfully
 */
export const zPutDatasetsByDatasetIdDocumentsByDocumentIdMetadataResponse
  = zSimpleResultMessageResponse

export const zGetDatasetsByDatasetIdDocumentsByDocumentIdNotionSyncPath = z.object({
  dataset_id: z.string(),
  document_id: z.string(),
})

/**
 * Success
 */
export const zGetDatasetsByDatasetIdDocumentsByDocumentIdNotionSyncResponse = zSimpleResultResponse

export const zGetDatasetsByDatasetIdDocumentsByDocumentIdPipelineExecutionLogPath = z.object({
  dataset_id: z.string(),
  document_id: z.string(),
})

/**
 * Document pipeline execution log retrieved successfully
 */
export const zGetDatasetsByDatasetIdDocumentsByDocumentIdPipelineExecutionLogResponse
  = zOpaqueObjectResponse

export const zPatchDatasetsByDatasetIdDocumentsByDocumentIdProcessingPausePath = z.object({
  dataset_id: z.string(),
  document_id: z.string(),
})

/**
 * Document paused successfully
 */
export const zPatchDatasetsByDatasetIdDocumentsByDocumentIdProcessingPauseResponse = z.void()

export const zPatchDatasetsByDatasetIdDocumentsByDocumentIdProcessingResumePath = z.object({
  dataset_id: z.string(),
  document_id: z.string(),
})

/**
 * Document resumed successfully
 */
export const zPatchDatasetsByDatasetIdDocumentsByDocumentIdProcessingResumeResponse = z.void()

export const zPatchDatasetsByDatasetIdDocumentsByDocumentIdProcessingByActionPath = z.object({
  action: z.string(),
  dataset_id: z.string(),
  document_id: z.string(),
})

/**
 * Processing status updated successfully
 */
export const zPatchDatasetsByDatasetIdDocumentsByDocumentIdProcessingByActionResponse
  = zSimpleResultResponse

export const zPostDatasetsByDatasetIdDocumentsByDocumentIdRenameBody = zDocumentRenamePayload

export const zPostDatasetsByDatasetIdDocumentsByDocumentIdRenamePath = z.object({
  dataset_id: z.string(),
  document_id: z.string(),
})

/**
 * Document renamed successfully
 */
export const zPostDatasetsByDatasetIdDocumentsByDocumentIdRenameResponse = zDocumentResponse

export const zPostDatasetsByDatasetIdDocumentsByDocumentIdSegmentBody = zSegmentCreatePayload

export const zPostDatasetsByDatasetIdDocumentsByDocumentIdSegmentPath = z.object({
  dataset_id: z.string(),
  document_id: z.string(),
})

/**
 * Segment created successfully
 */
export const zPostDatasetsByDatasetIdDocumentsByDocumentIdSegmentResponse = zSegmentDetailResponse

export const zPatchDatasetsByDatasetIdDocumentsByDocumentIdSegmentByActionPath = z.object({
  action: z.string(),
  dataset_id: z.string(),
  document_id: z.string(),
})

export const zPatchDatasetsByDatasetIdDocumentsByDocumentIdSegmentByActionQuery = z.object({
  segment_id: z.array(z.string()).optional(),
})

/**
 * Success
 */
export const zPatchDatasetsByDatasetIdDocumentsByDocumentIdSegmentByActionResponse
  = zSimpleResultResponse

export const zDeleteDatasetsByDatasetIdDocumentsByDocumentIdSegmentsPath = z.object({
  dataset_id: z.string(),
  document_id: z.string(),
})

export const zDeleteDatasetsByDatasetIdDocumentsByDocumentIdSegmentsQuery = z.object({
  segment_id: z.array(z.string()).optional(),
})

/**
 * Segments deleted successfully
 */
export const zDeleteDatasetsByDatasetIdDocumentsByDocumentIdSegmentsResponse = z.void()

export const zGetDatasetsByDatasetIdDocumentsByDocumentIdSegmentsPath = z.object({
  dataset_id: z.string(),
  document_id: z.string(),
})

export const zGetDatasetsByDatasetIdDocumentsByDocumentIdSegmentsQuery = z.object({
  enabled: z.string().optional().default('all'),
  hit_count_gte: z.int().optional(),
  keyword: z.string().optional(),
  limit: z.int().gte(1).lte(100).optional().default(20),
  page: z.int().gte(1).optional().default(1),
  status: z.array(z.string()).optional(),
})

/**
 * Segments retrieved successfully
 */
export const zGetDatasetsByDatasetIdDocumentsByDocumentIdSegmentsResponse
  = zConsoleSegmentListResponse

export const zGetDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBatchImportPath = z.object({
  dataset_id: z.string(),
  document_id: z.string(),
})

/**
 * Batch import status
 */
export const zGetDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBatchImportResponse
  = zSegmentBatchImportStatusResponse

export const zPostDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBatchImportBody
  = zBatchImportPayload

export const zPostDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBatchImportPath = z.object({
  dataset_id: z.string(),
  document_id: z.string(),
})

/**
 * Batch import started
 */
export const zPostDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBatchImportResponse
  = zSegmentBatchImportStatusResponse

export const zDeleteDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdPath = z.object({
  dataset_id: z.string(),
  document_id: z.string(),
  segment_id: z.string(),
})

/**
 * Segment deleted successfully
 */
export const zDeleteDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdResponse = z.void()

export const zPatchDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdBody
  = zSegmentUpdatePayload

export const zPatchDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdPath = z.object({
  dataset_id: z.string(),
  document_id: z.string(),
  segment_id: z.string(),
})

/**
 * Segment updated successfully
 */
export const zPatchDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdResponse
  = zSegmentDetailResponse

export const zGetDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksPath
  = z.object({
    dataset_id: z.string(),
    document_id: z.string(),
    segment_id: z.string(),
  })

export const zGetDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksQuery
  = z.object({
    keyword: z.string().optional(),
    limit: z.int().gte(1).lte(100).optional().default(20),
    page: z.int().gte(1).optional().default(1),
  })

/**
 * Child chunks retrieved successfully
 */
export const zGetDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksResponse
  = zChildChunkListResponse

export const zPatchDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksBody
  = zChildChunkBatchUpdatePayload

export const zPatchDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksPath
  = z.object({
    dataset_id: z.string(),
    document_id: z.string(),
    segment_id: z.string(),
  })

/**
 * Child chunks updated successfully
 */
export const zPatchDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksResponse
  = zChildChunkBatchUpdateResponse

export const zPostDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksBody
  = zChildChunkCreatePayload

export const zPostDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksPath
  = z.object({
    dataset_id: z.string(),
    document_id: z.string(),
    segment_id: z.string(),
  })

/**
 * Child chunk created successfully
 */
export const zPostDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksResponse
  = zChildChunkDetailResponse

export const zDeleteDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksByChildChunkIdPath
  = z.object({
    child_chunk_id: z.string(),
    dataset_id: z.string(),
    document_id: z.string(),
    segment_id: z.string(),
  })

/**
 * Child chunk deleted successfully
 */
export const zDeleteDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksByChildChunkIdResponse
  = z.void()

export const zPatchDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksByChildChunkIdBody
  = zChildChunkUpdatePayload

export const zPatchDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksByChildChunkIdPath
  = z.object({
    child_chunk_id: z.string(),
    dataset_id: z.string(),
    document_id: z.string(),
    segment_id: z.string(),
  })

/**
 * Child chunk updated successfully
 */
export const zPatchDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksByChildChunkIdResponse
  = zChildChunkDetailResponse

export const zGetDatasetsByDatasetIdDocumentsByDocumentIdSummaryStatusPath = z.object({
  dataset_id: z.string(),
  document_id: z.string(),
})

/**
 * Summary status retrieved successfully
 */
export const zGetDatasetsByDatasetIdDocumentsByDocumentIdSummaryStatusResponse
  = zOpaqueObjectResponse

export const zGetDatasetsByDatasetIdDocumentsByDocumentIdWebsiteSyncPath = z.object({
  dataset_id: z.string(),
  document_id: z.string(),
})

/**
 * Success
 */
export const zGetDatasetsByDatasetIdDocumentsByDocumentIdWebsiteSyncResponse = zSimpleResultResponse

export const zGetDatasetsByDatasetIdErrorDocsPath = z.object({
  dataset_id: z.string(),
})

/**
 * Error documents retrieved successfully
 */
export const zGetDatasetsByDatasetIdErrorDocsResponse = zErrorDocsResponse

export const zPostDatasetsByDatasetIdExternalHitTestingBody = zExternalHitTestingPayload

export const zPostDatasetsByDatasetIdExternalHitTestingPath = z.object({
  dataset_id: z.string(),
})

/**
 * External hit testing completed successfully
 */
export const zPostDatasetsByDatasetIdExternalHitTestingResponse = zExternalRetrievalTestResponse

export const zPostDatasetsByDatasetIdHitTestingBody = zHitTestingPayload

export const zPostDatasetsByDatasetIdHitTestingPath = z.object({
  dataset_id: z.string(),
})

/**
 * Hit testing completed successfully
 */
export const zPostDatasetsByDatasetIdHitTestingResponse = zHitTestingResponse

export const zGetDatasetsByDatasetIdIndexingStatusPath = z.object({
  dataset_id: z.string(),
})

/**
 * Indexing status retrieved successfully
 */
export const zGetDatasetsByDatasetIdIndexingStatusResponse = zDocumentStatusListResponse

export const zGetDatasetsByDatasetIdMetadataPath = z.object({
  dataset_id: z.string(),
})

/**
 * Metadata retrieved successfully
 */
export const zGetDatasetsByDatasetIdMetadataResponse = zDatasetMetadataListResponse

export const zPostDatasetsByDatasetIdMetadataBody = zMetadataArgs

export const zPostDatasetsByDatasetIdMetadataPath = z.object({
  dataset_id: z.string(),
})

/**
 * Metadata created successfully
 */
export const zPostDatasetsByDatasetIdMetadataResponse = zDatasetMetadataResponse

export const zPostDatasetsByDatasetIdMetadataBuiltInByActionPath = z.object({
  action: z.string(),
  dataset_id: z.string(),
})

/**
 * Action completed successfully
 */
export const zPostDatasetsByDatasetIdMetadataBuiltInByActionResponse = z.void()

export const zDeleteDatasetsByDatasetIdMetadataByMetadataIdPath = z.object({
  dataset_id: z.string(),
  metadata_id: z.string(),
})

/**
 * Metadata deleted successfully
 */
export const zDeleteDatasetsByDatasetIdMetadataByMetadataIdResponse = z.void()

export const zPatchDatasetsByDatasetIdMetadataByMetadataIdBody = zMetadataUpdatePayload

export const zPatchDatasetsByDatasetIdMetadataByMetadataIdPath = z.object({
  dataset_id: z.string(),
  metadata_id: z.string(),
})

/**
 * Metadata updated successfully
 */
export const zPatchDatasetsByDatasetIdMetadataByMetadataIdResponse = zDatasetMetadataResponse

export const zGetDatasetsByDatasetIdNotionSyncPath = z.object({
  dataset_id: z.string(),
})

/**
 * Success
 */
export const zGetDatasetsByDatasetIdNotionSyncResponse = zSimpleResultResponse

export const zGetDatasetsByDatasetIdPermissionPartUsersPath = z.object({
  dataset_id: z.string(),
})

/**
 * Permission users retrieved successfully
 */
export const zGetDatasetsByDatasetIdPermissionPartUsersResponse = zPartialMemberListResponse

export const zGetDatasetsByDatasetIdQueriesPath = z.object({
  dataset_id: z.string(),
})

/**
 * Query history retrieved successfully
 */
export const zGetDatasetsByDatasetIdQueriesResponse = zDatasetQueryListResponse

export const zGetDatasetsByDatasetIdRelatedAppsPath = z.object({
  dataset_id: z.string(),
})

/**
 * Related apps retrieved successfully
 */
export const zGetDatasetsByDatasetIdRelatedAppsResponse = zRelatedAppListResponse

export const zPostDatasetsByDatasetIdRetryBody = zDocumentRetryPayload

export const zPostDatasetsByDatasetIdRetryPath = z.object({
  dataset_id: z.string(),
})

/**
 * Documents retry started successfully
 */
export const zPostDatasetsByDatasetIdRetryResponse = z.void()

export const zGetDatasetsByDatasetIdUseCheckPath = z.object({
  dataset_id: z.string(),
})

/**
 * Dataset use status retrieved successfully
 */
export const zGetDatasetsByDatasetIdUseCheckResponse = zUsageCheckResponse

export const zGetDatasetsByResourceIdApiKeysPath = z.object({
  resource_id: z.string(),
})

/**
 * API keys retrieved successfully
 */
export const zGetDatasetsByResourceIdApiKeysResponse = zApiKeyList

export const zPostDatasetsByResourceIdApiKeysPath = z.object({
  resource_id: z.string(),
})

/**
 * API key created successfully
 */
export const zPostDatasetsByResourceIdApiKeysResponse = zApiKeyItem

export const zDeleteDatasetsByResourceIdApiKeysByApiKeyIdPath = z.object({
  api_key_id: z.string(),
  resource_id: z.string(),
})

/**
 * API key deleted successfully
 */
export const zDeleteDatasetsByResourceIdApiKeysByApiKeyIdResponse = z.void()
