# This file was auto-generated by Fern from our API Definition.

import typing

from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from ..core.request_options import RequestOptions
from ..types.country_response import CountryResponse
from ..types.timezone_response import TimezoneResponse
from .raw_client import AsyncRawReferenceDataClient, RawReferenceDataClient


class ReferenceDataClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawReferenceDataClient(client_wrapper=client_wrapper)

    @property
    def with_raw_response(self) -> RawReferenceDataClient:
        """
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        RawReferenceDataClient
        """
        return self._raw_client

    def get_timezones(
        self, *, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.List[TimezoneResponse]:
        """
        Get all active timezones.

        Returns a list of all available timezones from the IANA timezone database.
        Timezones are ordered by display order and name.

        **Returns:**
        - List of timezone objects with:
          - IANA timezone name (e.g., "America/New_York")
          - User-friendly display name
          - UTC offset information
          - Country code association

        **Use Cases:**
        - User profile timezone selection
        - Scheduling and calendar features
        - Time conversion utilities

        Parameters
        ----------
        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        typing.List[TimezoneResponse]
            Successful Response

        Examples
        --------
        from aitronos import Aitronos

        client = Aitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )
        client.reference_data.get_timezones()
        """
        _response = self._raw_client.get_timezones(request_options=request_options)
        return _response.data

    def get_countries(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.List[CountryResponse]:
        """
        Get all active countries.

        Returns a comprehensive list of countries with ISO codes, currency information,
        phone codes, and geographic data.

        **Returns:**
        - List of country objects with:
          - ISO 3166-1 alpha-2 and alpha-3 codes
          - Official and native names
          - Currency information (code, name, symbol)
          - International dialing code
          - Flag emoji
          - Geographic coordinates and regions

        **Use Cases:**
        - User profile country selection
        - Address forms
        - Phone number validation
        - Currency selection
        - Geographic filtering

        Parameters
        ----------
        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        typing.List[CountryResponse]
            Successful Response

        Examples
        --------
        from aitronos import Aitronos

        client = Aitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )
        client.reference_data.get_countries()
        """
        _response = self._raw_client.get_countries(request_options=request_options)
        return _response.data

    def get_timezones_for_country(
        self, country_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.List[TimezoneResponse]:
        """
        Get timezones for a specific country.

        Returns the timezones associated with the given country, ordered by display order.
        Useful for pre-selecting the correct timezone when a user picks their country.

        **Path Parameters:**
        - `country_id`: The country ID (country_ prefixed)

        **Returns:**
        - List of timezone objects for the country

        Parameters
        ----------
        country_id : str

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        typing.List[TimezoneResponse]
            Successful Response

        Examples
        --------
        from aitronos import Aitronos

        client = Aitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )
        client.reference_data.get_timezones_for_country(
            country_id="country_id",
        )
        """
        _response = self._raw_client.get_timezones_for_country(country_id, request_options=request_options)
        return _response.data


class AsyncReferenceDataClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawReferenceDataClient(client_wrapper=client_wrapper)

    @property
    def with_raw_response(self) -> AsyncRawReferenceDataClient:
        """
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        AsyncRawReferenceDataClient
        """
        return self._raw_client

    async def get_timezones(
        self, *, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.List[TimezoneResponse]:
        """
        Get all active timezones.

        Returns a list of all available timezones from the IANA timezone database.
        Timezones are ordered by display order and name.

        **Returns:**
        - List of timezone objects with:
          - IANA timezone name (e.g., "America/New_York")
          - User-friendly display name
          - UTC offset information
          - Country code association

        **Use Cases:**
        - User profile timezone selection
        - Scheduling and calendar features
        - Time conversion utilities

        Parameters
        ----------
        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        typing.List[TimezoneResponse]
            Successful Response

        Examples
        --------
        import asyncio

        from aitronos import AsyncAitronos

        client = AsyncAitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.reference_data.get_timezones()


        asyncio.run(main())
        """
        _response = await self._raw_client.get_timezones(request_options=request_options)
        return _response.data

    async def get_countries(
        self, *, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.List[CountryResponse]:
        """
        Get all active countries.

        Returns a comprehensive list of countries with ISO codes, currency information,
        phone codes, and geographic data.

        **Returns:**
        - List of country objects with:
          - ISO 3166-1 alpha-2 and alpha-3 codes
          - Official and native names
          - Currency information (code, name, symbol)
          - International dialing code
          - Flag emoji
          - Geographic coordinates and regions

        **Use Cases:**
        - User profile country selection
        - Address forms
        - Phone number validation
        - Currency selection
        - Geographic filtering

        Parameters
        ----------
        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        typing.List[CountryResponse]
            Successful Response

        Examples
        --------
        import asyncio

        from aitronos import AsyncAitronos

        client = AsyncAitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.reference_data.get_countries()


        asyncio.run(main())
        """
        _response = await self._raw_client.get_countries(request_options=request_options)
        return _response.data

    async def get_timezones_for_country(
        self, country_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.List[TimezoneResponse]:
        """
        Get timezones for a specific country.

        Returns the timezones associated with the given country, ordered by display order.
        Useful for pre-selecting the correct timezone when a user picks their country.

        **Path Parameters:**
        - `country_id`: The country ID (country_ prefixed)

        **Returns:**
        - List of timezone objects for the country

        Parameters
        ----------
        country_id : str

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        typing.List[TimezoneResponse]
            Successful Response

        Examples
        --------
        import asyncio

        from aitronos import AsyncAitronos

        client = AsyncAitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.reference_data.get_timezones_for_country(
                country_id="country_id",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.get_timezones_for_country(country_id, request_options=request_options)
        return _response.data
