# 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.pricing_tier_response import PricingTierResponse
from .raw_client import AsyncRawPricingTiersClient, RawPricingTiersClient

# this is used as the default value for optional parameters
OMIT = typing.cast(typing.Any, ...)


class PricingTiersClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawPricingTiersClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawPricingTiersClient
        """
        return self._raw_client

    def list_pricing_tiers(
        self, *, active_only: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.List[PricingTierResponse]:
        """
        List all pricing tiers.

        Args:
            active_only: If True, only return active tiers

        Parameters
        ----------
        active_only : typing.Optional[bool]

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

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

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

        client = Aitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )
        client.pricing_tiers.list_pricing_tiers()
        """
        _response = self._raw_client.list_pricing_tiers(active_only=active_only, request_options=request_options)
        return _response.data

    def create_pricing_tier(
        self,
        *,
        id: str,
        name: str,
        discount_percentage: float,
        description: typing.Optional[str] = OMIT,
        is_active: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> PricingTierResponse:
        """
        Create a new pricing tier.

        **Admin only** - Requires admin privileges.

        Parameters
        ----------
        id : str
            Tier ID (e.g., tier_custom)

        name : str
            Tier name

        discount_percentage : float
            Discount percentage (0-100)

        description : typing.Optional[str]
            Tier description

        is_active : typing.Optional[bool]
            Whether tier is active

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

        Returns
        -------
        PricingTierResponse
            Successful Response

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

        client = Aitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )
        client.pricing_tiers.create_pricing_tier(
            id="id",
            name="name",
            discount_percentage=1.1,
        )
        """
        _response = self._raw_client.create_pricing_tier(
            id=id,
            name=name,
            discount_percentage=discount_percentage,
            description=description,
            is_active=is_active,
            request_options=request_options,
        )
        return _response.data

    def get_pricing_tier(
        self, tier_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> PricingTierResponse:
        """
        Get a specific pricing tier by ID.

        Parameters
        ----------
        tier_id : str

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

        Returns
        -------
        PricingTierResponse
            Successful Response

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

        client = Aitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )
        client.pricing_tiers.get_pricing_tier(
            tier_id="tier_id",
        )
        """
        _response = self._raw_client.get_pricing_tier(tier_id, request_options=request_options)
        return _response.data

    def delete_pricing_tier(self, tier_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
        """
        Delete (soft delete) a pricing tier.

        **Admin only** - Requires admin privileges.

        Parameters
        ----------
        tier_id : str

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

        Returns
        -------
        None

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

        client = Aitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )
        client.pricing_tiers.delete_pricing_tier(
            tier_id="tier_id",
        )
        """
        _response = self._raw_client.delete_pricing_tier(tier_id, request_options=request_options)
        return _response.data

    def update_pricing_tier(
        self,
        tier_id: str,
        *,
        name: typing.Optional[str] = OMIT,
        description: typing.Optional[str] = OMIT,
        discount_percentage: typing.Optional[float] = OMIT,
        is_active: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> PricingTierResponse:
        """
        Update a pricing tier.

        **Admin only** - Requires admin privileges.

        Parameters
        ----------
        tier_id : str

        name : typing.Optional[str]

        description : typing.Optional[str]

        discount_percentage : typing.Optional[float]

        is_active : typing.Optional[bool]

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

        Returns
        -------
        PricingTierResponse
            Successful Response

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

        client = Aitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )
        client.pricing_tiers.update_pricing_tier(
            tier_id="tier_id",
        )
        """
        _response = self._raw_client.update_pricing_tier(
            tier_id,
            name=name,
            description=description,
            discount_percentage=discount_percentage,
            is_active=is_active,
            request_options=request_options,
        )
        return _response.data


class AsyncPricingTiersClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawPricingTiersClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawPricingTiersClient
        """
        return self._raw_client

    async def list_pricing_tiers(
        self, *, active_only: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.List[PricingTierResponse]:
        """
        List all pricing tiers.

        Args:
            active_only: If True, only return active tiers

        Parameters
        ----------
        active_only : typing.Optional[bool]

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

        Returns
        -------
        typing.List[PricingTierResponse]
            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.pricing_tiers.list_pricing_tiers()


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

    async def create_pricing_tier(
        self,
        *,
        id: str,
        name: str,
        discount_percentage: float,
        description: typing.Optional[str] = OMIT,
        is_active: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> PricingTierResponse:
        """
        Create a new pricing tier.

        **Admin only** - Requires admin privileges.

        Parameters
        ----------
        id : str
            Tier ID (e.g., tier_custom)

        name : str
            Tier name

        discount_percentage : float
            Discount percentage (0-100)

        description : typing.Optional[str]
            Tier description

        is_active : typing.Optional[bool]
            Whether tier is active

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

        Returns
        -------
        PricingTierResponse
            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.pricing_tiers.create_pricing_tier(
                id="id",
                name="name",
                discount_percentage=1.1,
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.create_pricing_tier(
            id=id,
            name=name,
            discount_percentage=discount_percentage,
            description=description,
            is_active=is_active,
            request_options=request_options,
        )
        return _response.data

    async def get_pricing_tier(
        self, tier_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> PricingTierResponse:
        """
        Get a specific pricing tier by ID.

        Parameters
        ----------
        tier_id : str

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

        Returns
        -------
        PricingTierResponse
            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.pricing_tiers.get_pricing_tier(
                tier_id="tier_id",
            )


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

    async def delete_pricing_tier(
        self, tier_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> None:
        """
        Delete (soft delete) a pricing tier.

        **Admin only** - Requires admin privileges.

        Parameters
        ----------
        tier_id : str

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

        Returns
        -------
        None

        Examples
        --------
        import asyncio

        from aitronos import AsyncAitronos

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


        async def main() -> None:
            await client.pricing_tiers.delete_pricing_tier(
                tier_id="tier_id",
            )


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

    async def update_pricing_tier(
        self,
        tier_id: str,
        *,
        name: typing.Optional[str] = OMIT,
        description: typing.Optional[str] = OMIT,
        discount_percentage: typing.Optional[float] = OMIT,
        is_active: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> PricingTierResponse:
        """
        Update a pricing tier.

        **Admin only** - Requires admin privileges.

        Parameters
        ----------
        tier_id : str

        name : typing.Optional[str]

        description : typing.Optional[str]

        discount_percentage : typing.Optional[float]

        is_active : typing.Optional[bool]

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

        Returns
        -------
        PricingTierResponse
            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.pricing_tiers.update_pricing_tier(
                tier_id="tier_id",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.update_pricing_tier(
            tier_id,
            name=name,
            description=description,
            discount_percentage=discount_percentage,
            is_active=is_active,
            request_options=request_options,
        )
        return _response.data
