# 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 AsyncRawMaishivClient, RawMaishivClient
from .types.add_knowledge_base_document_response import AddKnowledgeBaseDocumentResponse
from .types.remove_knowledge_base_document_response import RemoveKnowledgeBaseDocumentResponse

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


class MaishivClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawMaishivClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawMaishivClient
        """
        return self._raw_client

    def add_to_knowledge_base(
        self, *, document_id: str, request_options: typing.Optional[RequestOptions] = None
    ) -> AddKnowledgeBaseDocumentResponse:
        """
        Add a document to the knowledge base.

        Parameters
        ----------
        document_id : str
            ID of the document to add to the knowledge base.

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

        Returns
        -------
        AddKnowledgeBaseDocumentResponse

        Examples
        --------
        from soferai import SoferAI

        client = SoferAI(
            api_key="YOUR_API_KEY",
        )
        client.maishiv.add_to_knowledge_base(
            document_id="document_id",
        )
        """
        _response = self._raw_client.add_to_knowledge_base(document_id=document_id, request_options=request_options)
        return _response.data

    def list_knowledge_base_docs(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.List[str]:
        """
        Get all document IDs currently in the knowledge base.

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

        Returns
        -------
        typing.List[str]

        Examples
        --------
        from soferai import SoferAI

        client = SoferAI(
            api_key="YOUR_API_KEY",
        )
        client.maishiv.list_knowledge_base_docs()
        """
        _response = self._raw_client.list_knowledge_base_docs(request_options=request_options)
        return _response.data

    def remove_from_knowledge_base(
        self, document_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> RemoveKnowledgeBaseDocumentResponse:
        """
        Remove a document from the knowledge base.

        Parameters
        ----------
        document_id : str
            ID of the document to remove from the knowledge base.

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

        Returns
        -------
        RemoveKnowledgeBaseDocumentResponse

        Examples
        --------
        from soferai import SoferAI

        client = SoferAI(
            api_key="YOUR_API_KEY",
        )
        client.maishiv.remove_from_knowledge_base(
            document_id="document_id",
        )
        """
        _response = self._raw_client.remove_from_knowledge_base(document_id, request_options=request_options)
        return _response.data


class AsyncMaishivClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawMaishivClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawMaishivClient
        """
        return self._raw_client

    async def add_to_knowledge_base(
        self, *, document_id: str, request_options: typing.Optional[RequestOptions] = None
    ) -> AddKnowledgeBaseDocumentResponse:
        """
        Add a document to the knowledge base.

        Parameters
        ----------
        document_id : str
            ID of the document to add to the knowledge base.

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

        Returns
        -------
        AddKnowledgeBaseDocumentResponse

        Examples
        --------
        import asyncio

        from soferai import AsyncSoferAI

        client = AsyncSoferAI(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.maishiv.add_to_knowledge_base(
                document_id="document_id",
            )


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

    async def list_knowledge_base_docs(
        self, *, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.List[str]:
        """
        Get all document IDs currently in the knowledge base.

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

        Returns
        -------
        typing.List[str]

        Examples
        --------
        import asyncio

        from soferai import AsyncSoferAI

        client = AsyncSoferAI(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.maishiv.list_knowledge_base_docs()


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

    async def remove_from_knowledge_base(
        self, document_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> RemoveKnowledgeBaseDocumentResponse:
        """
        Remove a document from the knowledge base.

        Parameters
        ----------
        document_id : str
            ID of the document to remove from the knowledge base.

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

        Returns
        -------
        RemoveKnowledgeBaseDocumentResponse

        Examples
        --------
        import asyncio

        from soferai import AsyncSoferAI

        client = AsyncSoferAI(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.maishiv.remove_from_knowledge_base(
                document_id="document_id",
            )


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