# 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.recording_info_response import RecordingInfoResponse
from ..types.session_list_response import SessionListResponse
from ..types.session_participants_response import SessionParticipantsResponse
from ..types.session_response import SessionResponse
from ..types.video_metadata_response import VideoMetadataResponse
from ..types.video_quality_config import VideoQualityConfig
from .raw_client import AsyncRawMeetingBuddyClient, RawMeetingBuddyClient

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


class MeetingBuddyClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawMeetingBuddyClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawMeetingBuddyClient
        """
        return self._raw_client

    def list_meeting_buddy_sessions(
        self,
        *,
        status: typing.Optional[str] = None,
        search: typing.Optional[str] = None,
        start_date: typing.Optional[str] = None,
        end_date: typing.Optional[str] = None,
        page: typing.Optional[int] = None,
        page_size: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> SessionListResponse:
        """
        List all Meeting Buddy bot sessions for the authenticated user's organization. Supports filtering by status, date range, and search. Paginated with page/page_size parameters.

        Parameters
        ----------
        status : typing.Optional[str]
            Filter by status

        search : typing.Optional[str]
            Search across meeting link, bot name, session ID, and platform

        start_date : typing.Optional[str]
            Filter by start date (ISO format)

        end_date : typing.Optional[str]
            Filter by end date (ISO format)

        page : typing.Optional[int]
            Page number

        page_size : typing.Optional[int]
            Items per page

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

        Returns
        -------
        SessionListResponse
            Sessions retrieved successfully

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

        client = Aitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )
        client.meeting_buddy.list_meeting_buddy_sessions()
        """
        _response = self._raw_client.list_meeting_buddy_sessions(
            status=status,
            search=search,
            start_date=start_date,
            end_date=end_date,
            page=page,
            page_size=page_size,
            request_options=request_options,
        )
        return _response.data

    def create_meeting_buddy_session(
        self,
        *,
        meeting_link: str,
        bot_name: typing.Optional[str] = OMIT,
        transcription_enabled: typing.Optional[bool] = OMIT,
        transcription_language: typing.Optional[str] = OMIT,
        debug_mode: typing.Optional[bool] = OMIT,
        recording_mode: typing.Optional[str] = OMIT,
        video_quality: typing.Optional[VideoQualityConfig] = OMIT,
        participation_mode: typing.Optional[str] = OMIT,
        voice_profile_id: typing.Optional[str] = OMIT,
        voice_agent_config: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
        visibility: typing.Optional[str] = OMIT,
        shared_department_ids: typing.Optional[typing.Sequence[str]] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> SessionResponse:
        """
        Start a new Meeting Buddy bot to join and record a meeting. The bot joins asynchronously in the background. Status transitions: initializing -> joining -> waiting -> active -> completed.

        Parameters
        ----------
        meeting_link : str
            Meeting URL to join

        bot_name : typing.Optional[str]
            Display name for the bot

        transcription_enabled : typing.Optional[bool]
            Enable real-time transcription

        transcription_language : typing.Optional[str]
            Language code for transcription

        debug_mode : typing.Optional[bool]
            Enable visual debugging (non-headless browser)

        recording_mode : typing.Optional[str]
            Recording mode: audio_only or audio_video

        video_quality : typing.Optional[VideoQualityConfig]
            Video quality settings (only used when recording_mode=audio_video)

        participation_mode : typing.Optional[str]
            How the AI participates: 'listener' (transcribe only) or 'participant' (active voice agent)

        voice_profile_id : typing.Optional[str]
            Voice profile ID (mbvp_ prefix) to use when participation_mode='participant'

        voice_agent_config : typing.Optional[typing.Dict[str, typing.Any]]
            Voice agent config overrides. Only used when participation_mode='participant'.

        visibility : typing.Optional[str]
            Session visibility: private, participants, department, or organization

        shared_department_ids : typing.Optional[typing.Sequence[str]]
            Department IDs for department-level sharing (used when visibility='department')

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

        Returns
        -------
        SessionResponse
            Session created successfully

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

        client = Aitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )
        client.meeting_buddy.create_meeting_buddy_session(
            meeting_link="meeting_link",
        )
        """
        _response = self._raw_client.create_meeting_buddy_session(
            meeting_link=meeting_link,
            bot_name=bot_name,
            transcription_enabled=transcription_enabled,
            transcription_language=transcription_language,
            debug_mode=debug_mode,
            recording_mode=recording_mode,
            video_quality=video_quality,
            participation_mode=participation_mode,
            voice_profile_id=voice_profile_id,
            voice_agent_config=voice_agent_config,
            visibility=visibility,
            shared_department_ids=shared_department_ids,
            request_options=request_options,
        )
        return _response.data

    def get_meeting_buddy_session(
        self, session_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> SessionResponse:
        """
        Get detailed information about a specific Meeting Buddy bot session. Returns full session profile including status, timestamps, and statistics. Session ID must start with 'mbsess_' prefix.

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

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

        Returns
        -------
        SessionResponse
            Session details retrieved

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

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

    def stop_meeting_buddy_session(
        self, session_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> SessionResponse:
        """
        Stop a running Meeting Buddy bot session gracefully. The bot leaves the meeting, saves pending transcriptions, and finalizes recording metadata. This operation is idempotent. Session ID must start with 'mbsess_' prefix.

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

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

        Returns
        -------
        SessionResponse
            Session stopped successfully

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

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

    def stop_meeting_buddy_session_post(
        self, session_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> SessionResponse:
        """
        POST alias for DELETE /sessions/{session_id}. Stops a running session gracefully.

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

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

        Returns
        -------
        SessionResponse
            Session stopped successfully

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

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

    def get_session_participants(
        self, session_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> SessionParticipantsResponse:
        """
        Get participant join/leave timeline for a session.

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

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

        Returns
        -------
        SessionParticipantsResponse
            Successful Response

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

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

    def get_recording_info(
        self, session_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> RecordingInfoResponse:
        """
        Get recording metadata for a session.

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

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

        Returns
        -------
        RecordingInfoResponse
            Successful Response

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

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

    def get_session_video(
        self, session_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> VideoMetadataResponse:
        """
        Get video recording URL and metadata for a session.

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

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

        Returns
        -------
        VideoMetadataResponse
            Successful Response

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

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

    def export_session_transcripts(
        self,
        session_id: str,
        *,
        format: typing.Optional[str] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> typing.Any:
        """
        Export session transcripts as a downloadable file.

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

        format : typing.Optional[str]
            Export format: txt, srt, or json

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

        Returns
        -------
        typing.Any
            Successful Response

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

        client = Aitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )
        client.meeting_buddy.export_session_transcripts(
            session_id="session_id",
        )
        """
        _response = self._raw_client.export_session_transcripts(
            session_id, format=format, request_options=request_options
        )
        return _response.data


class AsyncMeetingBuddyClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawMeetingBuddyClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawMeetingBuddyClient
        """
        return self._raw_client

    async def list_meeting_buddy_sessions(
        self,
        *,
        status: typing.Optional[str] = None,
        search: typing.Optional[str] = None,
        start_date: typing.Optional[str] = None,
        end_date: typing.Optional[str] = None,
        page: typing.Optional[int] = None,
        page_size: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> SessionListResponse:
        """
        List all Meeting Buddy bot sessions for the authenticated user's organization. Supports filtering by status, date range, and search. Paginated with page/page_size parameters.

        Parameters
        ----------
        status : typing.Optional[str]
            Filter by status

        search : typing.Optional[str]
            Search across meeting link, bot name, session ID, and platform

        start_date : typing.Optional[str]
            Filter by start date (ISO format)

        end_date : typing.Optional[str]
            Filter by end date (ISO format)

        page : typing.Optional[int]
            Page number

        page_size : typing.Optional[int]
            Items per page

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

        Returns
        -------
        SessionListResponse
            Sessions 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.list_meeting_buddy_sessions()


        asyncio.run(main())
        """
        _response = await self._raw_client.list_meeting_buddy_sessions(
            status=status,
            search=search,
            start_date=start_date,
            end_date=end_date,
            page=page,
            page_size=page_size,
            request_options=request_options,
        )
        return _response.data

    async def create_meeting_buddy_session(
        self,
        *,
        meeting_link: str,
        bot_name: typing.Optional[str] = OMIT,
        transcription_enabled: typing.Optional[bool] = OMIT,
        transcription_language: typing.Optional[str] = OMIT,
        debug_mode: typing.Optional[bool] = OMIT,
        recording_mode: typing.Optional[str] = OMIT,
        video_quality: typing.Optional[VideoQualityConfig] = OMIT,
        participation_mode: typing.Optional[str] = OMIT,
        voice_profile_id: typing.Optional[str] = OMIT,
        voice_agent_config: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
        visibility: typing.Optional[str] = OMIT,
        shared_department_ids: typing.Optional[typing.Sequence[str]] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> SessionResponse:
        """
        Start a new Meeting Buddy bot to join and record a meeting. The bot joins asynchronously in the background. Status transitions: initializing -> joining -> waiting -> active -> completed.

        Parameters
        ----------
        meeting_link : str
            Meeting URL to join

        bot_name : typing.Optional[str]
            Display name for the bot

        transcription_enabled : typing.Optional[bool]
            Enable real-time transcription

        transcription_language : typing.Optional[str]
            Language code for transcription

        debug_mode : typing.Optional[bool]
            Enable visual debugging (non-headless browser)

        recording_mode : typing.Optional[str]
            Recording mode: audio_only or audio_video

        video_quality : typing.Optional[VideoQualityConfig]
            Video quality settings (only used when recording_mode=audio_video)

        participation_mode : typing.Optional[str]
            How the AI participates: 'listener' (transcribe only) or 'participant' (active voice agent)

        voice_profile_id : typing.Optional[str]
            Voice profile ID (mbvp_ prefix) to use when participation_mode='participant'

        voice_agent_config : typing.Optional[typing.Dict[str, typing.Any]]
            Voice agent config overrides. Only used when participation_mode='participant'.

        visibility : typing.Optional[str]
            Session visibility: private, participants, department, or organization

        shared_department_ids : typing.Optional[typing.Sequence[str]]
            Department IDs for department-level sharing (used when visibility='department')

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

        Returns
        -------
        SessionResponse
            Session created 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.create_meeting_buddy_session(
                meeting_link="meeting_link",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.create_meeting_buddy_session(
            meeting_link=meeting_link,
            bot_name=bot_name,
            transcription_enabled=transcription_enabled,
            transcription_language=transcription_language,
            debug_mode=debug_mode,
            recording_mode=recording_mode,
            video_quality=video_quality,
            participation_mode=participation_mode,
            voice_profile_id=voice_profile_id,
            voice_agent_config=voice_agent_config,
            visibility=visibility,
            shared_department_ids=shared_department_ids,
            request_options=request_options,
        )
        return _response.data

    async def get_meeting_buddy_session(
        self, session_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> SessionResponse:
        """
        Get detailed information about a specific Meeting Buddy bot session. Returns full session profile including status, timestamps, and statistics. Session ID must start with 'mbsess_' prefix.

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

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

        Returns
        -------
        SessionResponse
            Session details retrieved

        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.get_meeting_buddy_session(
                session_id="session_id",
            )


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

    async def stop_meeting_buddy_session(
        self, session_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> SessionResponse:
        """
        Stop a running Meeting Buddy bot session gracefully. The bot leaves the meeting, saves pending transcriptions, and finalizes recording metadata. This operation is idempotent. Session ID must start with 'mbsess_' prefix.

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

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

        Returns
        -------
        SessionResponse
            Session stopped 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.stop_meeting_buddy_session(
                session_id="session_id",
            )


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

    async def stop_meeting_buddy_session_post(
        self, session_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> SessionResponse:
        """
        POST alias for DELETE /sessions/{session_id}. Stops a running session gracefully.

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

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

        Returns
        -------
        SessionResponse
            Session stopped 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.stop_meeting_buddy_session_post(
                session_id="session_id",
            )


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

    async def get_session_participants(
        self, session_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> SessionParticipantsResponse:
        """
        Get participant join/leave timeline for a session.

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

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

        Returns
        -------
        SessionParticipantsResponse
            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.get_session_participants(
                session_id="session_id",
            )


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

    async def get_recording_info(
        self, session_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> RecordingInfoResponse:
        """
        Get recording metadata for a session.

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

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

        Returns
        -------
        RecordingInfoResponse
            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.get_recording_info(
                session_id="session_id",
            )


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

    async def get_session_video(
        self, session_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> VideoMetadataResponse:
        """
        Get video recording URL and metadata for a session.

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

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

        Returns
        -------
        VideoMetadataResponse
            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.get_session_video(
                session_id="session_id",
            )


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

    async def export_session_transcripts(
        self,
        session_id: str,
        *,
        format: typing.Optional[str] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> typing.Any:
        """
        Export session transcripts as a downloadable file.

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

        format : typing.Optional[str]
            Export format: txt, srt, or json

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

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


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