// 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()),
})

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

/**
 * 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()),
})

/**
 * 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),
})

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

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

/**
 * 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(),
})

/**
 * 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(),
})

/**
 * 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(),
})

/**
 * DatasetPermissionEnum
 */
export const zDatasetPermissionEnum = 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: zDatasetPermissionEnum.optional(),
  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: zDatasetPermissionEnum.optional(),
  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(),
})

/**
 * 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),
})

/**
 * DocumentMetadataResponse
 */
export const zDocumentMetadataResponse = z.object({
  id: z.string(),
  name: z.string(),
  type: z.string(),
  value: z.string().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_dict: 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_details: 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),
})

/**
 * 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(),
})

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

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

/**
 * 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(),
})

/**
 * 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.unknown().optional(),
})

/**
 * 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),
})

/**
 * 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.optional(),
})

/**
 * 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,
  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,
  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,
  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.record(z.string(), z.unknown()).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.record(z.string(), z.unknown()).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.optional(),
  subchunk_segmentation: zSegmentation.optional(),
})

/**
 * ProcessRule
 */
export const zProcessRule = z.object({
  mode: z.enum(['automatic', 'custom', 'hierarchical']),
  rules: zRule.optional(),
})

/**
 * 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.unknown().optional(),
})

/**
 * 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.optional(),
  vector_setting: zWeightVectorSetting.optional(),
  weight_type: z.enum(['customized', 'keyword_first', 'semantic_first']).nullish(),
})

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

/**
 * 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.optional(),
})

/**
 * HitTestingDocument
 */
export const zHitTestingDocument = z.object({
  data_source_type: z.string(),
  doc_metadata: z.unknown(),
  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(),
})

/**
 * 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.optional(),
})

/**
 * 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.optional(),
  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.optional(),
  notion_info_list: z.array(zNotionInfo).nullish(),
  website_info_list: zWebsiteInfo.optional(),
})

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

/**
 * KnowledgeConfig
 */
export const zKnowledgeConfig = z.object({
  data_source: zDataSource.optional(),
  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.optional(),
  retrieval_model: zRetrievalModel.optional(),
  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.record(z.string(), z.never())

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.string().optional(),
  page: z.string().optional(),
})

/**
 * External API templates retrieved successfully
 */
export const zGetDatasetsExternalKnowledgeApiResponse = z.record(z.string(), z.unknown())

export const zPostDatasetsExternalKnowledgeApiBody = zExternalKnowledgeApiPayload

/**
 * Success
 */
export const zPostDatasetsExternalKnowledgeApiResponse = z.record(z.string(), z.unknown())

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

/**
 * External knowledge API deleted successfully
 */
export const zDeleteDatasetsExternalKnowledgeApiByExternalKnowledgeApiIdResponse = z.record(
  z.string(),
  z.never(),
)

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

/**
 * External API template retrieved successfully
 */
export const zGetDatasetsExternalKnowledgeApiByExternalKnowledgeApiIdResponse = z.record(
  z.string(),
  z.unknown(),
)

export const zPatchDatasetsExternalKnowledgeApiByExternalKnowledgeApiIdBody
  = zExternalKnowledgeApiPayload

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

/**
 * Success
 */
export const zPatchDatasetsExternalKnowledgeApiByExternalKnowledgeApiIdResponse = z.record(
  z.string(),
  z.unknown(),
)

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

/**
 * Success
 */
export const zGetDatasetsNotionIndexingEstimateResponse = zTextContentResponse

export const zPostDatasetsNotionIndexingEstimateBody = zNotionEstimatePayload

/**
 * Success
 */
export const zPostDatasetsNotionIndexingEstimateResponse = z.record(z.string(), z.unknown())

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

/**
 * Process rules retrieved successfully
 */
export const zGetDatasetsProcessRuleResponse = z.record(z.string(), z.unknown())

/**
 * 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.record(z.string(), z.never())

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(),
})

/**
 * Success
 */
export const zGetDatasetsByDatasetIdBatchByBatchIndexingEstimateResponse = z.record(
  z.string(),
  z.unknown(),
)

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

/**
 * Success
 */
export const zGetDatasetsByDatasetIdBatchByBatchIndexingStatusResponse = z.record(
  z.string(),
  z.unknown(),
)

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

/**
 * Documents deleted successfully
 */
export const zDeleteDatasetsByDatasetIdDocumentsResponse = z.record(z.string(), z.never())

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 = z.record(z.string(), z.unknown())

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(),
})

/**
 * Success
 */
export const zPostDatasetsByDatasetIdDocumentsDownloadZipResponse = z.record(
  z.string(),
  z.unknown(),
)

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.record(z.string(), z.never())

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.record(
  z.string(),
  z.never(),
)

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 = z.record(
  z.string(),
  z.unknown(),
)

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 = z.record(
  z.string(),
  z.unknown(),
)

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

/**
 * Indexing status retrieved successfully
 */
export const zGetDatasetsByDatasetIdDocumentsByDocumentIdIndexingStatusResponse = z.record(
  z.string(),
  z.unknown(),
)

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(),
})

/**
 * Success
 */
export const zGetDatasetsByDatasetIdDocumentsByDocumentIdPipelineExecutionLogResponse = z.record(
  z.string(),
  z.unknown(),
)

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

/**
 * Document paused successfully
 */
export const zPatchDatasetsByDatasetIdDocumentsByDocumentIdProcessingPauseResponse = z.record(
  z.string(),
  z.never(),
)

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

/**
 * Document resumed successfully
 */
export const zPatchDatasetsByDatasetIdDocumentsByDocumentIdProcessingResumeResponse = z.record(
  z.string(),
  z.never(),
)

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(),
})

/**
 * Success
 */
export const zPostDatasetsByDatasetIdDocumentsByDocumentIdSegmentResponse = z.record(
  z.string(),
  z.unknown(),
)

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

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

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

/**
 * Segments deleted successfully
 */
export const zDeleteDatasetsByDatasetIdDocumentsByDocumentIdSegmentsResponse = z.record(
  z.string(),
  z.never(),
)

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

/**
 * Success
 */
export const zGetDatasetsByDatasetIdDocumentsByDocumentIdSegmentsResponse = z.record(
  z.string(),
  z.unknown(),
)

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.record(
  z.string(),
  z.never(),
)

export const zPatchDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdBody
  = zSegmentUpdatePayload

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

/**
 * Success
 */
export const zPatchDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdResponse = z.record(
  z.string(),
  z.unknown(),
)

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

/**
 * Success
 */
export const zGetDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksResponse
  = z.record(z.string(), z.unknown())

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

/**
 * Success
 */
export const zPatchDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksResponse
  = z.record(z.string(), z.unknown())

export const zPostDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksBody
  = zChildChunkCreatePayload

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

/**
 * Success
 */
export const zPostDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksResponse
  = z.record(z.string(), z.unknown())

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.record(z.string(), z.never())

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(),
  })

/**
 * Success
 */
export const zPatchDatasetsByDatasetIdDocumentsByDocumentIdSegmentsBySegmentIdChildChunksByChildChunkIdResponse
  = z.record(z.string(), z.unknown())

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

/**
 * Summary status retrieved successfully
 */
export const zGetDatasetsByDatasetIdDocumentsByDocumentIdSummaryStatusResponse = z.record(
  z.string(),
  z.unknown(),
)

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 = z.record(z.string(), z.unknown())

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.record(
  z.string(),
  z.never(),
)

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

/**
 * Metadata deleted successfully
 */
export const zDeleteDatasetsByDatasetIdMetadataByMetadataIdResponse = z.record(
  z.string(),
  z.never(),
)

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.record(z.string(), z.never())

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.record(z.string(), z.never())
