"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
# @generated-id: 7a8ed2e90d61

from .basesdk import BaseSDK
from .sdkconfiguration import SDKConfiguration
from mistralai.client.speech import Speech
from mistralai.client.transcriptions import Transcriptions
from mistralai.client.voices import Voices
from typing import Optional

# region imports
from typing import TYPE_CHECKING

if TYPE_CHECKING:
    from mistralai.extra.realtime import RealtimeTranscription
# endregion imports


class Audio(BaseSDK):
    speech: Speech
    transcriptions: Transcriptions
    r"""API for audio transcription."""
    voices: Voices

    def __init__(
        self, sdk_config: SDKConfiguration, parent_ref: Optional[object] = None
    ) -> None:
        BaseSDK.__init__(self, sdk_config, parent_ref=parent_ref)
        self.sdk_configuration = sdk_config
        self._init_sdks()

    def _init_sdks(self):
        self.speech = Speech(self.sdk_configuration, parent_ref=self.parent_ref)
        self.transcriptions = Transcriptions(
            self.sdk_configuration, parent_ref=self.parent_ref
        )
        self.voices = Voices(self.sdk_configuration, parent_ref=self.parent_ref)

    # region sdk-class-body
    @property
    def realtime(self) -> "RealtimeTranscription":
        """Returns a client for real-time audio transcription via WebSocket."""
        if not hasattr(self, "_realtime"):
            from mistralai.extra.realtime import RealtimeTranscription  # pylint: disable=import-outside-toplevel

            self._realtime = RealtimeTranscription(self.sdk_configuration)  # pylint: disable=attribute-defined-outside-init

        return self._realtime

    # endregion sdk-class-body
