# 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.collection_service_handlers_create_collection_response import (
    CollectionServiceHandlersCreateCollectionResponse,
)
from ..types.collection_service_handlers_delete_collection_response import (
    CollectionServiceHandlersDeleteCollectionResponse,
)
from ..types.collection_service_handlers_get_collection_response import CollectionServiceHandlersGetCollectionResponse
from ..types.collection_service_handlers_get_collections_response import CollectionServiceHandlersGetCollectionsResponse
from ..types.collection_service_handlers_update_collection_response import (
    CollectionServiceHandlersUpdateCollectionResponse,
)
from .raw_client import AsyncRawCollectionsClient, RawCollectionsClient

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


class CollectionsClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawCollectionsClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawCollectionsClient
        """
        return self._raw_client

    def list(
        self,
        *,
        start_at: typing.Optional[str] = None,
        limit: typing.Optional[int] = None,
        query: typing.Optional[str] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> CollectionServiceHandlersGetCollectionsResponse:
        """
        Parameters
        ----------
        start_at : typing.Optional[str]
            created_at to start at

        limit : typing.Optional[int]
            Limit of records to return

        query : typing.Optional[str]
            Search query

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

        Returns
        -------
        CollectionServiceHandlersGetCollectionsResponse
            Successful Response

        Examples
        --------
        from scoutos import Scout

        client = Scout(
            api_key="YOUR_API_KEY",
        )
        client.collections.list()
        """
        _response = self._raw_client.list(start_at=start_at, limit=limit, query=query, request_options=request_options)
        return _response.data

    def create(
        self,
        *,
        collection_display_name: typing.Optional[str] = OMIT,
        collection_img_url: typing.Optional[str] = OMIT,
        collection_description: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> CollectionServiceHandlersCreateCollectionResponse:
        """
        Parameters
        ----------
        collection_display_name : typing.Optional[str]

        collection_img_url : typing.Optional[str]

        collection_description : typing.Optional[str]

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

        Returns
        -------
        CollectionServiceHandlersCreateCollectionResponse
            Successful Response

        Examples
        --------
        from scoutos import Scout

        client = Scout(
            api_key="YOUR_API_KEY",
        )
        client.collections.create()
        """
        _response = self._raw_client.create(
            collection_display_name=collection_display_name,
            collection_img_url=collection_img_url,
            collection_description=collection_description,
            request_options=request_options,
        )
        return _response.data

    def get(
        self, collection_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> CollectionServiceHandlersGetCollectionResponse:
        """
        Parameters
        ----------
        collection_id : str

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

        Returns
        -------
        CollectionServiceHandlersGetCollectionResponse
            Successful Response

        Examples
        --------
        from scoutos import Scout

        client = Scout(
            api_key="YOUR_API_KEY",
        )
        client.collections.get(
            collection_id="collection_id",
        )
        """
        _response = self._raw_client.get(collection_id, request_options=request_options)
        return _response.data

    def update(
        self,
        collection_id: str,
        *,
        collection_display_name: typing.Optional[str] = OMIT,
        collection_img_url: typing.Optional[str] = OMIT,
        collection_description: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> CollectionServiceHandlersUpdateCollectionResponse:
        """
        Parameters
        ----------
        collection_id : str

        collection_display_name : typing.Optional[str]

        collection_img_url : typing.Optional[str]

        collection_description : typing.Optional[str]

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

        Returns
        -------
        CollectionServiceHandlersUpdateCollectionResponse
            Successful Response

        Examples
        --------
        from scoutos import Scout

        client = Scout(
            api_key="YOUR_API_KEY",
        )
        client.collections.update(
            collection_id="collection_id",
        )
        """
        _response = self._raw_client.update(
            collection_id,
            collection_display_name=collection_display_name,
            collection_img_url=collection_img_url,
            collection_description=collection_description,
            request_options=request_options,
        )
        return _response.data

    def delete(
        self, collection_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> CollectionServiceHandlersDeleteCollectionResponse:
        """
        Delete a collection given a collection_id.

        Parameters
        ----------
        collection_id : str

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

        Returns
        -------
        CollectionServiceHandlersDeleteCollectionResponse
            Successful Response

        Examples
        --------
        from scoutos import Scout

        client = Scout(
            api_key="YOUR_API_KEY",
        )
        client.collections.delete(
            collection_id="collection_id",
        )
        """
        _response = self._raw_client.delete(collection_id, request_options=request_options)
        return _response.data


class AsyncCollectionsClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawCollectionsClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawCollectionsClient
        """
        return self._raw_client

    async def list(
        self,
        *,
        start_at: typing.Optional[str] = None,
        limit: typing.Optional[int] = None,
        query: typing.Optional[str] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> CollectionServiceHandlersGetCollectionsResponse:
        """
        Parameters
        ----------
        start_at : typing.Optional[str]
            created_at to start at

        limit : typing.Optional[int]
            Limit of records to return

        query : typing.Optional[str]
            Search query

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

        Returns
        -------
        CollectionServiceHandlersGetCollectionsResponse
            Successful Response

        Examples
        --------
        import asyncio

        from scoutos import AsyncScout

        client = AsyncScout(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.collections.list()


        asyncio.run(main())
        """
        _response = await self._raw_client.list(
            start_at=start_at, limit=limit, query=query, request_options=request_options
        )
        return _response.data

    async def create(
        self,
        *,
        collection_display_name: typing.Optional[str] = OMIT,
        collection_img_url: typing.Optional[str] = OMIT,
        collection_description: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> CollectionServiceHandlersCreateCollectionResponse:
        """
        Parameters
        ----------
        collection_display_name : typing.Optional[str]

        collection_img_url : typing.Optional[str]

        collection_description : typing.Optional[str]

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

        Returns
        -------
        CollectionServiceHandlersCreateCollectionResponse
            Successful Response

        Examples
        --------
        import asyncio

        from scoutos import AsyncScout

        client = AsyncScout(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.collections.create()


        asyncio.run(main())
        """
        _response = await self._raw_client.create(
            collection_display_name=collection_display_name,
            collection_img_url=collection_img_url,
            collection_description=collection_description,
            request_options=request_options,
        )
        return _response.data

    async def get(
        self, collection_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> CollectionServiceHandlersGetCollectionResponse:
        """
        Parameters
        ----------
        collection_id : str

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

        Returns
        -------
        CollectionServiceHandlersGetCollectionResponse
            Successful Response

        Examples
        --------
        import asyncio

        from scoutos import AsyncScout

        client = AsyncScout(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.collections.get(
                collection_id="collection_id",
            )


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

    async def update(
        self,
        collection_id: str,
        *,
        collection_display_name: typing.Optional[str] = OMIT,
        collection_img_url: typing.Optional[str] = OMIT,
        collection_description: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> CollectionServiceHandlersUpdateCollectionResponse:
        """
        Parameters
        ----------
        collection_id : str

        collection_display_name : typing.Optional[str]

        collection_img_url : typing.Optional[str]

        collection_description : typing.Optional[str]

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

        Returns
        -------
        CollectionServiceHandlersUpdateCollectionResponse
            Successful Response

        Examples
        --------
        import asyncio

        from scoutos import AsyncScout

        client = AsyncScout(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.collections.update(
                collection_id="collection_id",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.update(
            collection_id,
            collection_display_name=collection_display_name,
            collection_img_url=collection_img_url,
            collection_description=collection_description,
            request_options=request_options,
        )
        return _response.data

    async def delete(
        self, collection_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> CollectionServiceHandlersDeleteCollectionResponse:
        """
        Delete a collection given a collection_id.

        Parameters
        ----------
        collection_id : str

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

        Returns
        -------
        CollectionServiceHandlersDeleteCollectionResponse
            Successful Response

        Examples
        --------
        import asyncio

        from scoutos import AsyncScout

        client = AsyncScout(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.collections.delete(
                collection_id="collection_id",
            )


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