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

from ..core.client_wrapper import SyncClientWrapper
from .raw_client import RawCycloneClient
import typing
import datetime as dt
from ..types.model_name import ModelName
from ..core.request_options import RequestOptions
from ..types.cyclone_forecast_response import CycloneForecastResponse
from ..types.feature_collection import FeatureCollection
from ..core.client_wrapper import AsyncClientWrapper
from .raw_client import AsyncRawCycloneClient


class CycloneClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawCycloneClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawCycloneClient
        """
        return self._raw_client

    def query_forecasts(
        self,
        *,
        time: typing.Optional[dt.datetime] = None,
        min_storm_category: typing.Optional[int] = None,
        model: typing.Optional[ModelName] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> typing.List[CycloneForecastResponse]:
        """
        Query the available cyclone forecasts for a particular time

        Parameters
        ----------
        time : typing.Optional[dt.datetime]
            *Default value: (current time) - Default time zone: UTC*

        min_storm_category : typing.Optional[int]

        model : typing.Optional[ModelName]

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

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

        Examples
        --------
        from silurian import Earth

        client = Earth(
            api_key="YOUR_API_KEY",
        )
        client.cyclone.query_forecasts()
        """
        response = self._raw_client.query_forecasts(
            time=time, min_storm_category=min_storm_category, model=model, request_options=request_options
        )
        return response.data

    def get_forecast_track(
        self,
        storm_id: str,
        *,
        time: typing.Optional[dt.datetime] = None,
        model: typing.Optional[ModelName] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> FeatureCollection:
        """
        Get cyclone tracks in GeoJSON (MF-GeoJSON) format

        Parameters
        ----------
        storm_id : str

        time : typing.Optional[dt.datetime]
            *Default value: (current time) - Default time zone: UTC*

        model : typing.Optional[ModelName]

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

        Returns
        -------
        FeatureCollection
            Successful Response

        Examples
        --------
        from silurian import Earth

        client = Earth(
            api_key="YOUR_API_KEY",
        )
        client.cyclone.get_forecast_track(
            storm_id="storm_id",
        )
        """
        response = self._raw_client.get_forecast_track(
            storm_id, time=time, model=model, request_options=request_options
        )
        return response.data

    def get_forecast_cone(
        self,
        storm_id: str,
        *,
        time: typing.Optional[dt.datetime] = None,
        lead_time: typing.Optional[str] = None,
        smooth_cone: typing.Optional[bool] = None,
        model: typing.Optional[ModelName] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> FeatureCollection:
        """
        Get cyclone forecast cone in GeoJSON format

        Parameters
        ----------
        storm_id : str

        time : typing.Optional[dt.datetime]
            *Default value: (current time) - Default time zone: UTC*

        lead_time : typing.Optional[str]

        smooth_cone : typing.Optional[bool]

        model : typing.Optional[ModelName]

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

        Returns
        -------
        FeatureCollection
            Successful Response

        Examples
        --------
        from silurian import Earth

        client = Earth(
            api_key="YOUR_API_KEY",
        )
        client.cyclone.get_forecast_cone(
            storm_id="storm_id",
        )
        """
        response = self._raw_client.get_forecast_cone(
            storm_id,
            time=time,
            lead_time=lead_time,
            smooth_cone=smooth_cone,
            model=model,
            request_options=request_options,
        )
        return response.data


class AsyncCycloneClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawCycloneClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawCycloneClient
        """
        return self._raw_client

    async def query_forecasts(
        self,
        *,
        time: typing.Optional[dt.datetime] = None,
        min_storm_category: typing.Optional[int] = None,
        model: typing.Optional[ModelName] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> typing.List[CycloneForecastResponse]:
        """
        Query the available cyclone forecasts for a particular time

        Parameters
        ----------
        time : typing.Optional[dt.datetime]
            *Default value: (current time) - Default time zone: UTC*

        min_storm_category : typing.Optional[int]

        model : typing.Optional[ModelName]

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

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

        Examples
        --------
        import asyncio

        from silurian import AsyncEarth

        client = AsyncEarth(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.cyclone.query_forecasts()


        asyncio.run(main())
        """
        response = await self._raw_client.query_forecasts(
            time=time, min_storm_category=min_storm_category, model=model, request_options=request_options
        )
        return response.data

    async def get_forecast_track(
        self,
        storm_id: str,
        *,
        time: typing.Optional[dt.datetime] = None,
        model: typing.Optional[ModelName] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> FeatureCollection:
        """
        Get cyclone tracks in GeoJSON (MF-GeoJSON) format

        Parameters
        ----------
        storm_id : str

        time : typing.Optional[dt.datetime]
            *Default value: (current time) - Default time zone: UTC*

        model : typing.Optional[ModelName]

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

        Returns
        -------
        FeatureCollection
            Successful Response

        Examples
        --------
        import asyncio

        from silurian import AsyncEarth

        client = AsyncEarth(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.cyclone.get_forecast_track(
                storm_id="storm_id",
            )


        asyncio.run(main())
        """
        response = await self._raw_client.get_forecast_track(
            storm_id, time=time, model=model, request_options=request_options
        )
        return response.data

    async def get_forecast_cone(
        self,
        storm_id: str,
        *,
        time: typing.Optional[dt.datetime] = None,
        lead_time: typing.Optional[str] = None,
        smooth_cone: typing.Optional[bool] = None,
        model: typing.Optional[ModelName] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> FeatureCollection:
        """
        Get cyclone forecast cone in GeoJSON format

        Parameters
        ----------
        storm_id : str

        time : typing.Optional[dt.datetime]
            *Default value: (current time) - Default time zone: UTC*

        lead_time : typing.Optional[str]

        smooth_cone : typing.Optional[bool]

        model : typing.Optional[ModelName]

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

        Returns
        -------
        FeatureCollection
            Successful Response

        Examples
        --------
        import asyncio

        from silurian import AsyncEarth

        client = AsyncEarth(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.cyclone.get_forecast_cone(
                storm_id="storm_id",
            )


        asyncio.run(main())
        """
        response = await self._raw_client.get_forecast_cone(
            storm_id,
            time=time,
            lead_time=lead_time,
            smooth_cone=smooth_cone,
            model=model,
            request_options=request_options,
        )
        return response.data
