# 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.session_response import SessionResponse
from ..types.speakers_response import SpeakersResponse
from ..types.transcript_segment import TranscriptSegment
from .raw_client import AsyncRawMeetingBuddyTranscriptsClient, RawMeetingBuddyTranscriptsClient

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


class MeetingBuddyTranscriptsClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawMeetingBuddyTranscriptsClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawMeetingBuddyTranscriptsClient
        """
        return self._raw_client

    def get_meeting_buddy_transcripts(
        self, session_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.List[TranscriptSegment]:
        """
        Get transcription segments for a Meeting Buddy session.

            **Returns:**
            - All transcript segments ordered by start_time
            - Empty list if transcription is disabled
            - Empty list if no transcripts available yet (session still initializing)
            - Partial results if session is still active

            **Transcript Segments Include:**
            - Text content
            - Confidence score (0.0 to 1.0)
            - Start and end timestamps (seconds from session start)
            - Speaker identification (if available)
            - Language code

            **Authentication:** Requires valid JWT token. User must have access to the session's organization.

            **Session ID Format:** Must start with `mbsess_` prefix.

        Parameters
        ----------
        session_id : str

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

        Returns
        -------
        typing.List[TranscriptSegment]
            Transcripts retrieved successfully

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

        client = Aitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )
        client.meeting_buddy_transcripts.get_meeting_buddy_transcripts(
            session_id="session_id",
        )
        """
        _response = self._raw_client.get_meeting_buddy_transcripts(session_id, request_options=request_options)
        return _response.data

    def put_speaker_labels(
        self, session_id: str, *, labels: typing.Dict[str, str], request_options: typing.Optional[RequestOptions] = None
    ) -> SessionResponse:
        """
        Assign or update display names for numbered speakers in a session.

        Parameters
        ----------
        session_id : str

        labels : typing.Dict[str, str]
            Map speaker keys to names: {"0": "Phillip"}

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

        Returns
        -------
        SessionResponse
            Successful Response

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

        client = Aitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )
        client.meeting_buddy_transcripts.put_speaker_labels(
            session_id="session_id",
            labels={"key": "value"},
        )
        """
        _response = self._raw_client.put_speaker_labels(session_id, labels=labels, request_options=request_options)
        return _response.data

    def get_session_speakers(
        self, session_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> SpeakersResponse:
        """
        List distinct speakers in a session with segment counts and sample text.

        Parameters
        ----------
        session_id : str

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

        Returns
        -------
        SpeakersResponse
            Successful Response

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

        client = Aitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )
        client.meeting_buddy_transcripts.get_session_speakers(
            session_id="session_id",
        )
        """
        _response = self._raw_client.get_session_speakers(session_id, request_options=request_options)
        return _response.data

    def retry_session_transcription(
        self, session_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.Dict[str, typing.Any]:
        """
        Re-transcribe a session's saved recording using the batch API. Returns immediately; poll the session detail to track progress via transcription_status.

        Parameters
        ----------
        session_id : str

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

        Returns
        -------
        typing.Dict[str, typing.Any]
            Successful Response

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

        client = Aitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )
        client.meeting_buddy_transcripts.retry_session_transcription(
            session_id="session_id",
        )
        """
        _response = self._raw_client.retry_session_transcription(session_id, request_options=request_options)
        return _response.data


class AsyncMeetingBuddyTranscriptsClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawMeetingBuddyTranscriptsClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawMeetingBuddyTranscriptsClient
        """
        return self._raw_client

    async def get_meeting_buddy_transcripts(
        self, session_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.List[TranscriptSegment]:
        """
        Get transcription segments for a Meeting Buddy session.

            **Returns:**
            - All transcript segments ordered by start_time
            - Empty list if transcription is disabled
            - Empty list if no transcripts available yet (session still initializing)
            - Partial results if session is still active

            **Transcript Segments Include:**
            - Text content
            - Confidence score (0.0 to 1.0)
            - Start and end timestamps (seconds from session start)
            - Speaker identification (if available)
            - Language code

            **Authentication:** Requires valid JWT token. User must have access to the session's organization.

            **Session ID Format:** Must start with `mbsess_` prefix.

        Parameters
        ----------
        session_id : str

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

        Returns
        -------
        typing.List[TranscriptSegment]
            Transcripts retrieved successfully

        Examples
        --------
        import asyncio

        from aitronos import AsyncAitronos

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


        async def main() -> None:
            await client.meeting_buddy_transcripts.get_meeting_buddy_transcripts(
                session_id="session_id",
            )


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

    async def put_speaker_labels(
        self, session_id: str, *, labels: typing.Dict[str, str], request_options: typing.Optional[RequestOptions] = None
    ) -> SessionResponse:
        """
        Assign or update display names for numbered speakers in a session.

        Parameters
        ----------
        session_id : str

        labels : typing.Dict[str, str]
            Map speaker keys to names: {"0": "Phillip"}

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

        Returns
        -------
        SessionResponse
            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.meeting_buddy_transcripts.put_speaker_labels(
                session_id="session_id",
                labels={"key": "value"},
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.put_speaker_labels(
            session_id, labels=labels, request_options=request_options
        )
        return _response.data

    async def get_session_speakers(
        self, session_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> SpeakersResponse:
        """
        List distinct speakers in a session with segment counts and sample text.

        Parameters
        ----------
        session_id : str

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

        Returns
        -------
        SpeakersResponse
            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.meeting_buddy_transcripts.get_session_speakers(
                session_id="session_id",
            )


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

    async def retry_session_transcription(
        self, session_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.Dict[str, typing.Any]:
        """
        Re-transcribe a session's saved recording using the batch API. Returns immediately; poll the session detail to track progress via transcription_status.

        Parameters
        ----------
        session_id : str

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

        Returns
        -------
        typing.Dict[str, typing.Any]
            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.meeting_buddy_transcripts.retry_session_transcription(
                session_id="session_id",
            )


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