# 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 .raw_client import AsyncRawCampaignsClient, RawCampaignsClient
from .types.delete_campaign_id_response import DeleteCampaignIdResponse
from .types.get_campaign_id_response import GetCampaignIdResponse
from .types.get_campaign_response import GetCampaignResponse
from .types.post_campaign_id_pause_response import PostCampaignIdPauseResponse
from .types.post_campaign_id_start_response import PostCampaignIdStartResponse
from .types.post_campaign_response import PostCampaignResponse

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


class CampaignsClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawCampaignsClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawCampaignsClient
        """
        return self._raw_client

    def retrieve_all_campaigns(self, *, request_options: typing.Optional[RequestOptions] = None) -> GetCampaignResponse:
        """
        Get all campaigns

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

        Returns
        -------
        GetCampaignResponse
            A list of campaigns

        Examples
        --------
        from smallestai import SmallestAI

        client = SmallestAI(
            token="YOUR_TOKEN",
        )
        client.atoms.campaigns.retrieve_all_campaigns()
        """
        _response = self._raw_client.retrieve_all_campaigns(request_options=request_options)
        return _response.data

    def create_a_campaign(
        self,
        *,
        name: str,
        audience_id: str,
        agent_id: str,
        description: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> PostCampaignResponse:
        """
        Create a campaign

        Parameters
        ----------
        name : str
            The name of the campaign

        audience_id : str
            The ID of the audience

        agent_id : str
            The ID of the agent

        description : typing.Optional[str]
            The description of the campaign

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

        Returns
        -------
        PostCampaignResponse
            Campaign created successfully

        Examples
        --------
        from smallestai import SmallestAI

        client = SmallestAI(
            token="YOUR_TOKEN",
        )
        client.atoms.campaigns.create_a_campaign(
            name="My Campaign",
            audience_id="60d0fe4f5311236168a109ca",
            agent_id="60d0fe4f5311236168a109ca",
        )
        """
        _response = self._raw_client.create_a_campaign(
            name=name,
            audience_id=audience_id,
            agent_id=agent_id,
            description=description,
            request_options=request_options,
        )
        return _response.data

    def get_a_campaign(
        self, id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> GetCampaignIdResponse:
        """
        Get a campaign with detailed metrics

        Parameters
        ----------
        id : str
            The ID of the campaign

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

        Returns
        -------
        GetCampaignIdResponse
            Campaign details with metrics

        Examples
        --------
        from smallestai import SmallestAI

        client = SmallestAI(
            token="YOUR_TOKEN",
        )
        client.atoms.campaigns.get_a_campaign(
            id="id",
        )
        """
        _response = self._raw_client.get_a_campaign(id, request_options=request_options)
        return _response.data

    def delete_a_campaign(
        self, id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> DeleteCampaignIdResponse:
        """
        Delete a campaign

        Parameters
        ----------
        id : str
            The ID of the campaign

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

        Returns
        -------
        DeleteCampaignIdResponse
            Campaign deleted successfully

        Examples
        --------
        from smallestai import SmallestAI

        client = SmallestAI(
            token="YOUR_TOKEN",
        )
        client.atoms.campaigns.delete_a_campaign(
            id="id",
        )
        """
        _response = self._raw_client.delete_a_campaign(id, request_options=request_options)
        return _response.data

    def start_a_campaign(
        self, id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> PostCampaignIdStartResponse:
        """
        Start a campaign

        Parameters
        ----------
        id : str
            The ID of the campaign

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

        Returns
        -------
        PostCampaignIdStartResponse
            Campaign started successfully

        Examples
        --------
        from smallestai import SmallestAI

        client = SmallestAI(
            token="YOUR_TOKEN",
        )
        client.atoms.campaigns.start_a_campaign(
            id="id",
        )
        """
        _response = self._raw_client.start_a_campaign(id, request_options=request_options)
        return _response.data

    def pause_a_campaign(
        self, id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> PostCampaignIdPauseResponse:
        """
        Pause a campaign

        Parameters
        ----------
        id : str
            The ID of the campaign

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

        Returns
        -------
        PostCampaignIdPauseResponse
            Campaign paused successfully

        Examples
        --------
        from smallestai import SmallestAI

        client = SmallestAI(
            token="YOUR_TOKEN",
        )
        client.atoms.campaigns.pause_a_campaign(
            id="id",
        )
        """
        _response = self._raw_client.pause_a_campaign(id, request_options=request_options)
        return _response.data


class AsyncCampaignsClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawCampaignsClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawCampaignsClient
        """
        return self._raw_client

    async def retrieve_all_campaigns(
        self, *, request_options: typing.Optional[RequestOptions] = None
    ) -> GetCampaignResponse:
        """
        Get all campaigns

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

        Returns
        -------
        GetCampaignResponse
            A list of campaigns

        Examples
        --------
        import asyncio

        from smallestai import AsyncSmallestAI

        client = AsyncSmallestAI(
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.atoms.campaigns.retrieve_all_campaigns()


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

    async def create_a_campaign(
        self,
        *,
        name: str,
        audience_id: str,
        agent_id: str,
        description: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> PostCampaignResponse:
        """
        Create a campaign

        Parameters
        ----------
        name : str
            The name of the campaign

        audience_id : str
            The ID of the audience

        agent_id : str
            The ID of the agent

        description : typing.Optional[str]
            The description of the campaign

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

        Returns
        -------
        PostCampaignResponse
            Campaign created successfully

        Examples
        --------
        import asyncio

        from smallestai import AsyncSmallestAI

        client = AsyncSmallestAI(
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.atoms.campaigns.create_a_campaign(
                name="My Campaign",
                audience_id="60d0fe4f5311236168a109ca",
                agent_id="60d0fe4f5311236168a109ca",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.create_a_campaign(
            name=name,
            audience_id=audience_id,
            agent_id=agent_id,
            description=description,
            request_options=request_options,
        )
        return _response.data

    async def get_a_campaign(
        self, id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> GetCampaignIdResponse:
        """
        Get a campaign with detailed metrics

        Parameters
        ----------
        id : str
            The ID of the campaign

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

        Returns
        -------
        GetCampaignIdResponse
            Campaign details with metrics

        Examples
        --------
        import asyncio

        from smallestai import AsyncSmallestAI

        client = AsyncSmallestAI(
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.atoms.campaigns.get_a_campaign(
                id="id",
            )


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

    async def delete_a_campaign(
        self, id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> DeleteCampaignIdResponse:
        """
        Delete a campaign

        Parameters
        ----------
        id : str
            The ID of the campaign

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

        Returns
        -------
        DeleteCampaignIdResponse
            Campaign deleted successfully

        Examples
        --------
        import asyncio

        from smallestai import AsyncSmallestAI

        client = AsyncSmallestAI(
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.atoms.campaigns.delete_a_campaign(
                id="id",
            )


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

    async def start_a_campaign(
        self, id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> PostCampaignIdStartResponse:
        """
        Start a campaign

        Parameters
        ----------
        id : str
            The ID of the campaign

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

        Returns
        -------
        PostCampaignIdStartResponse
            Campaign started successfully

        Examples
        --------
        import asyncio

        from smallestai import AsyncSmallestAI

        client = AsyncSmallestAI(
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.atoms.campaigns.start_a_campaign(
                id="id",
            )


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

    async def pause_a_campaign(
        self, id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> PostCampaignIdPauseResponse:
        """
        Pause a campaign

        Parameters
        ----------
        id : str
            The ID of the campaign

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

        Returns
        -------
        PostCampaignIdPauseResponse
            Campaign paused successfully

        Examples
        --------
        import asyncio

        from smallestai import AsyncSmallestAI

        client = AsyncSmallestAI(
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.atoms.campaigns.pause_a_campaign(
                id="id",
            )


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