export type GuideBooleanFilter = 'all' | 'true' | 'false'

export interface ServiceGuideListParams {
  query?: string
  q?: string
  doc_id?: string
  implementation_code?: string
  basic_code?: string
  matter_type?: string
  handled_org?: string
  region?: string
  express_supported?: boolean
  reservation_supported?: boolean
  must_onsite?: boolean
  matter_name?: string
  page?: number
  page_size?: number
}

export interface ServiceGuideListItem {
  profile_id: string
  doc_id: string
  matter_name: string
  colloquial_names: string[]
  implementation_code: string
  matter_version: string
  handled_org_names: string[]
  region_names: string[]
  express_supported: boolean | null
  reservation_supported: boolean | null
  needs_review: boolean
}

export interface ServiceGuideListResponse {
  total: number
  page: number
  page_size: number
  items: ServiceGuideListItem[]
}

export interface ServiceGuideTimeLimit {
  raw_text: string
  duration: string
  unit: string
  is_working_day: boolean | null
}

export interface ServiceGuideDocumentInfo {
  title: string
  normalized_title: string
  doc_type: string
  knowledge_category: string
  publish_date: string
  effective_date: string
  expiry_date: string
  issuing_org: string
  status: string
  [key: string]: unknown
}

export interface ServiceGuideMatterIdentity {
  matter_name: string
  colloquial_names: string[]
  matter_type: string
  basic_code: string
  implementation_code: string
  business_item_code: string
  matter_version: string
  implementing_subject: string
  subject_nature: string
  delegated_department: string
  [key: string]: unknown
}

export interface ServiceGuideBasicInfo {
  service_object: string[]
  promised_time_limit: ServiceGuideTimeLimit
  legal_time_limit: ServiceGuideTimeLimit
  visit_count_to_hall: number | null
  must_onsite: boolean | null
  must_onsite_reason: string
  case_type: string
  notified_commitment_enabled: boolean | null
  hall_required: boolean | null
  express_supported: boolean | null
  reservation_supported: boolean | null
  reservation_url: string
  service_modes: string[]
  online_depth: string
  linked_agencies: string[]
  [key: string]: unknown
}

export interface ServiceGuideCrossRegion {
  service_scope_type: string
  regions_summary: string[]
  regions_detail: string[]
  regions_truncated: boolean
  service_modes: string[]
  notes: string
  raw_text: string
  [key: string]: unknown
}

export interface ServiceGuideProcessInfo {
  summary: string
  step_titles: string[]
  raw_text: string
  notes: string
  needs_review: boolean
  [key: string]: unknown
}

export interface ServiceGuideMaterial {
  guide_material_id: string
  material_name: string
  linked_material_id: string
  requirement_level: string
  original_count: number | null
  copy_count: number | null
  form_types: string[]
  paper_spec: string
  electronic_license_linked: boolean | null
  exempt_submission: boolean | null
  reusable_previous_submission: boolean | null
  material_type: string
  source_channel: string
  fill_instructions: string
  notes: string
  applicable_conditions: string[]
  blank_form_available: boolean | null
  sample_available: boolean | null
  download_hint: string
  raw_row_text: string
  [key: string]: unknown
}

export interface ServiceGuideFee {
  fee_name: string
  amount_text: string
  amount_value: number | null
  currency: string
  charging_body: string
  charging_method: string
  reducible: boolean | null
  notes: string
  [key: string]: unknown
}

export interface ServiceGuideLegalBasis {
  law_name: string
  document_no: string
  article_no: string
  issuing_body: string
  effective_date: string | null
  article_content: string
  [key: string]: unknown
}

export interface ServiceGuideConsultation {
  consultation_phones: string[]
  consultation_urls: string[]
  complaint_phones: string[]
  complaint_urls: string[]
  [key: string]: unknown
}

export interface ServiceGuideServiceWindow {
  window_name: string
  location: string
  office_phone: string
  office_hours: string
  navigation: string
  scope: string
  [key: string]: unknown
}

export interface ServiceGuideBindings {
  matter_ids: string[]
  organization_bindings: Array<Record<string, unknown>>
  region_bindings: Array<Record<string, unknown>>
  [key: string]: unknown
}

export interface ServiceGuideQuality {
  completeness_score: number
  confidence_score: number
  missing_fields: string[]
  needs_review: boolean
  warnings: string[]
  [key: string]: unknown
}

export interface StandardServiceGuideProfile {
  schema_version: string
  profile_id: string
  doc_id: string
  content_hash: string
  acl_ids: string[]
  scene_type: string
  source: string
  source_url: string
  is_current: boolean
  guide_version: string
  extractor_version: string
  extracted_at: string
  updated_at: string
  matter_name: string
  colloquial_names: string[]
  matter_type: string
  implementation_code: string
  basic_code: string
  business_item_code: string
  matter_version: string
  implementing_subject: string
  implementing_subject_nature: string
  delegated_department: string
  service_objects: string[]
  service_modes: string[]
  online_depth: string
  hall_required: boolean | null
  express_supported: boolean | null
  reservation_supported: boolean | null
  must_onsite: boolean | null
  must_onsite_reason: string
  visit_count_to_hall: number | null
  promised_time_limit_days: number | null
  legal_time_limit_days: number | null
  handled_org_names: string[]
  region_names: string[]
  linked_matter_ids: string[]
  material_names: string[]
  fee_names: string[]
  window_names: string[]
  legal_basis_names: string[]
  cross_region_scope: string
  cross_region_summary: string[]
  guide_search_text: string
  needs_review: boolean
  completeness_score: number
  confidence_score: number
  document_info: ServiceGuideDocumentInfo
  matter_identity: ServiceGuideMatterIdentity
  basic_info: ServiceGuideBasicInfo
  cross_region_service: ServiceGuideCrossRegion[]
  process_info: ServiceGuideProcessInfo
  materials: ServiceGuideMaterial[]
  fees: ServiceGuideFee[]
  legal_basis: ServiceGuideLegalBasis[]
  consultation_and_supervision: ServiceGuideConsultation
  service_windows: ServiceGuideServiceWindow[]
  bindings: ServiceGuideBindings
  quality: ServiceGuideQuality
  raw_sections: Record<string, string>
  [key: string]: unknown
}

export interface ServiceGuideDetailResponse {
  profile_id: string
  doc_id: string
  scene_type: string
  guide_version: string
  profile: StandardServiceGuideProfile
}