/** * Represents a country with all ISO 3166-1 code formats */ interface Country { /** Full country name (e.g., "United States") */ name: string; /** ISO 3166-1 alpha-2 code (e.g., "US") */ alpha2: string; /** ISO 3166-1 alpha-3 code (e.g., "USA") */ alpha3: string; /** ISO 3166-1 numeric code (e.g., "840") */ numeric: string; } /** * Basic subdivision information (stored in data) */ interface SubdivisionInfo { /** Subdivision name (e.g., "California") */ name: string; /** Subdivision type (e.g., "State", "Province", "County") */ type: string; } /** * Full subdivision with all computed fields */ interface Subdivision extends SubdivisionInfo { /** Full ISO 3166-2 code (e.g., "US-CA") */ code: string; /** Country alpha-2 code (e.g., "US") */ countryCode: string; /** Country name (e.g., "United States") */ countryName: string; /** Region code without country prefix (e.g., "CA") */ regionCode: string; } /** * Country with all its subdivisions included */ interface CountryWithSubdivisions extends Country { /** All subdivisions indexed by full code */ subdivisions: Record; } /** * Supported country code formats */ type CountryCodeFormat = 'alpha2' | 'alpha3' | 'numeric'; /** * Country record as stored in data (without alpha2 which is the key) */ interface CountryRecord { name: string; alpha3: string; numeric: string; } /** * Main country data structure */ type CountryData = Record; /** * Subdivision data for a single country */ type SubdivisionData = Record; export type { Country as C, Subdivision as S, SubdivisionInfo as a, CountryWithSubdivisions as b, CountryCodeFormat as c, CountryRecord as d, CountryData as e, SubdivisionData as f };