"""
Python SDK for OpenFGA

API version: 1.x
Website: https://openfga.dev
Documentation: https://openfga.dev/docs
Support: https://openfga.dev/community
License: [Apache-2.0](https://github.com/openfga/python-sdk/blob/main/LICENSE)

NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT.
"""

from typing import NamedTuple


class TelemetryHistogram(NamedTuple):
    name: str
    description: str
    unit: str = "milliseconds"


class TelemetryHistograms:
    fga_client_request_duration: TelemetryHistogram = TelemetryHistogram(
        name="fga-client.request.duration",
        description="Total request time for FGA requests, in milliseconds.",
    )
    fga_client_query_duration: TelemetryHistogram = TelemetryHistogram(
        name="fga-client.query.duration",
        description="Time taken by the FGA server to process and evaluate the request, in milliseconds.",
    )

    _histograms: list[TelemetryHistogram] = [
        fga_client_request_duration,
        fga_client_query_duration,
    ]

    @staticmethod
    def getAll() -> list[TelemetryHistogram]:
        return TelemetryHistograms._histograms

    @staticmethod
    def get(
        name: str | None = None,
    ) -> TelemetryHistogram | None:
        for histogram in TelemetryHistograms._histograms:
            if histogram.name == name:
                return histogram

        return None
