/** * Represents a commune of Chile */ interface Comuna { /** Name of the commune */ name: string; /** Unique Territorial Code (CUT) of the commune */ code: string; } /** * Represents a province of Chile */ interface Provincia { /** Name of the province */ name: string; /** List of communes belonging to the province */ comunas: Comuna[]; } /** * Represents a region of Chile */ interface Region { /** Full name of the region */ region: string; /** Region number in Roman numerals (I, II, III, ... XV, XVI) */ region_number: string; /** ISO 3166-2 code of the region (e.g., CL-AP, CL-RM) */ region_iso_3166_2: string; /** List of provinces belonging to the region */ provincias: Provincia[]; } /** * Commune search result with context information */ interface ComunaSearchResult { /** The found commune */ comuna: Comuna; /** Name of the province it belongs to */ provincia: string; /** Name of the region it belongs to */ region: string; /** Region number */ region_number: string; } /** * Generic option for select/dropdown elements */ interface SelectOption { /** Visible text in the select */ label: string; /** Option value (used as key/id) */ value: string; } /** * Datos de regiones, provincias y comunas de Chile */ declare const data: Region[]; /** * Gets all regions of Chile * @returns Array with all 16 regions of Chile */ declare function getRegiones(): Region[]; /** * Finds a region by its number (in Roman numerals) * @param number Region number (e.g., "I", "XV", "XIII") * @returns The found region or undefined */ declare function getRegionByNumber(number: string): Region | undefined; /** * Finds a region by its ISO 3166-2 code * @param iso ISO code (e.g., "CL-RM", "CL-AP") * @returns The found region or undefined */ declare function getRegionByISO(iso: string): Region | undefined; /** * Finds a region by its name (partial search, case-insensitive) * @param name Name or part of the region name * @returns The found region or undefined */ declare function getRegionByName(name: string): Region | undefined; /** * Gets all provinces of a region * @param regionNumber Region number (e.g., "XIII", "V") * @returns Array of provinces or empty array if region not found */ declare function getProvincias(regionNumber: string): Provincia[]; /** * Gets all communes of a region, optionally filtered by province * @param regionNumber Region number * @param provinciaName Province name (optional) * @returns Array of communes */ declare function getComunas(regionNumber: string, provinciaName?: string): Comuna[]; /** * Finds a commune by its CUT code (Unique Territorial Code) * @param code CUT code of the commune (e.g., "13101" for Santiago) * @returns Result with the commune and its context, or undefined */ declare function getComunaByCode(code: string): ComunaSearchResult | undefined; /** * Searches communes by name (partial search, case-insensitive) * @param query Text to search in commune names * @returns Array of results with communes and their context */ declare function searchComunas(query: string): ComunaSearchResult[]; /** * Gets all communes of Chile * @returns Array with all communes */ declare function getAllComunas(): ComunaSearchResult[]; /** * Gets all provinces of Chile * @returns Array with objects containing the province and its region */ declare function getAllProvincias(): Array<{ provincia: Provincia; region: string; region_number: string; }>; /** * Gets regions formatted for a select/dropdown element * @returns Array of options with label (name) and value (region number) * @example * */ declare function getRegionOptions(): SelectOption[]; /** * Gets provinces of a region formatted for a select/dropdown element * @param regionNumber Number of the selected region * @returns Array of options with label and value (province name) */ declare function getProvinciaOptions(regionNumber: string): SelectOption[]; /** * Gets communes formatted for a select/dropdown element * @param regionNumber Number of the selected region * @param provinciaName Province name (optional, if not passed returns all communes of the region) * @returns Array of options with label (name) and value (CUT code) */ declare function getComunaOptions(regionNumber: string, provinciaName?: string): SelectOption[]; /** * Gets all communes of Chile formatted for a select/dropdown element * Useful for autocomplete or global search * @returns Array of options with label (commune - region) and value (CUT code) */ declare function getAllComunaOptions(): SelectOption[]; export { type Comuna, type ComunaSearchResult, type Provincia, type Region, type SelectOption, data, getAllComunaOptions, getAllComunas, getAllProvincias, getComunaByCode, getComunaOptions, getComunas, getProvinciaOptions, getProvincias, getRegionByISO, getRegionByName, getRegionByNumber, getRegionOptions, getRegiones, searchComunas };