"""
This file is generated by generator/run.py based on the Chrome DevTools Protocol.


https://chromedevtools.github.io/devtools-protocol/tot/Performance/

***************************************************
                    Methods
***************************************************
"""
from __future__ import annotations

from typing import Literal

from cdpkit.protocol._types import (
    Performance,
)
from cdpkit.protocol.base import CDPMethod, InputModel, OutputModel


class Disable(CDPMethod[None]):
    """ Disable collecting and reporting metrics. """

    INPUT_VALIDATOR = None
    OUTPUT_VALIDATOR = None


class EnableInput(InputModel):

    timeDomain: Literal['timeTicks', 'threadTicks'] | None = None


class Enable(CDPMethod[None]):
    """ Enable collecting and reporting metrics. """

    INPUT_VALIDATOR = EnableInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        time_domain: Literal['timeTicks', 'threadTicks'] | None = None
    ):
        super().__init__(
            timeDomain=time_domain
        )


class SetTimeDomainInput(InputModel):

    timeDomain: Literal['timeTicks', 'threadTicks']


class SetTimeDomain(CDPMethod[None]):  # experimental deprecated
    """ Sets time domain to use for collecting and reporting duration metrics.
    Note that this must be called before enabling metrics collection. Calling
    this method while metrics collection is enabled returns an error. """

    INPUT_VALIDATOR = SetTimeDomainInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        time_domain: Literal['timeTicks', 'threadTicks']
    ):
        super().__init__(
            timeDomain=time_domain
        )


class GetMetricsOutput(OutputModel):

    metrics: list[Performance.Metric]


class GetMetrics(CDPMethod[GetMetricsOutput]):
    """ Retrieve current values of run-time metrics. """

    INPUT_VALIDATOR = None
    OUTPUT_VALIDATOR = GetMetricsOutput
