# 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.detailed_health_check import DetailedHealthCheck
from ..types.health_check import HealthCheck
from .raw_client import AsyncRawHealthClient, RawHealthClient


class HealthClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawHealthClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawHealthClient
        """
        return self._raw_client

    def liveness_check(self, *, request_options: typing.Optional[RequestOptions] = None) -> HealthCheck:
        """
        Simple liveness check endpoint.

        Returns a basic status indicating the application is running.
        Useful for container orchestration liveness probes.

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

        Returns
        -------
        HealthCheck
            Successful Response

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

        client = Aitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )
        client.health.liveness_check()
        """
        _response = self._raw_client.liveness_check(request_options=request_options)
        return _response.data

    def readiness_check(self, *, request_options: typing.Optional[RequestOptions] = None) -> DetailedHealthCheck:
        """
        Detailed readiness check endpoint.

        Checks the health of all application dependencies including:
        - Database connectivity
        - Cache connectivity
        - Limit enforcement system status
        - Vector store connectivity

        Useful for container orchestration readiness probes.

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

        Returns
        -------
        DetailedHealthCheck
            Successful Response

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

        client = Aitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )
        client.health.readiness_check()
        """
        _response = self._raw_client.readiness_check(request_options=request_options)
        return _response.data

    def metrics(self, *, request_options: typing.Optional[RequestOptions] = None) -> None:
        """
        Expose Prometheus metrics.

        Returns metrics in Prometheus text format including:
        - transcriptions_created_total{model}: Total transcriptions created
        - synapses_consumed_total{model}: Total synapses consumed
        - synapses_consumed_per_second{model}: Current synapse consumption rate
        - pricing_lookup_latency_ms{model, source}: Pricing lookup latency histogram
        - pricing_errors_total{code}: Total pricing lookup errors

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

        Returns
        -------
        None

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

        client = Aitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )
        client.health.metrics()
        """
        _response = self._raw_client.metrics(request_options=request_options)
        return _response.data


class AsyncHealthClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawHealthClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawHealthClient
        """
        return self._raw_client

    async def liveness_check(self, *, request_options: typing.Optional[RequestOptions] = None) -> HealthCheck:
        """
        Simple liveness check endpoint.

        Returns a basic status indicating the application is running.
        Useful for container orchestration liveness probes.

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

        Returns
        -------
        HealthCheck
            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.health.liveness_check()


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

    async def readiness_check(self, *, request_options: typing.Optional[RequestOptions] = None) -> DetailedHealthCheck:
        """
        Detailed readiness check endpoint.

        Checks the health of all application dependencies including:
        - Database connectivity
        - Cache connectivity
        - Limit enforcement system status
        - Vector store connectivity

        Useful for container orchestration readiness probes.

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

        Returns
        -------
        DetailedHealthCheck
            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.health.readiness_check()


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

    async def metrics(self, *, request_options: typing.Optional[RequestOptions] = None) -> None:
        """
        Expose Prometheus metrics.

        Returns metrics in Prometheus text format including:
        - transcriptions_created_total{model}: Total transcriptions created
        - synapses_consumed_total{model}: Total synapses consumed
        - synapses_consumed_per_second{model}: Current synapse consumption rate
        - pricing_lookup_latency_ms{model, source}: Pricing lookup latency histogram
        - pricing_errors_total{code}: Total pricing lookup errors

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

        Returns
        -------
        None

        Examples
        --------
        import asyncio

        from aitronos import AsyncAitronos

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


        async def main() -> None:
            await client.health.metrics()


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