# Generated by the protocol buffer compiler.  DO NOT EDIT!
# sources: app/observatory/config.proto
# plugin: python-betterproto2
# This file has been @generated

__all__ = (
    "Config",
    "HealthPingMeasurementResult",
    "Intensity",
    "ObservationResult",
    "OutboundStatus",
    "ProbeResult",
)

from dataclasses import dataclass

import betterproto2

from .....message_pool import default_message_pool

betterproto2.check_compiler_version("0.5.1")


@dataclass(eq=False, repr=False)
class Config(betterproto2.Message):
    subject_selector: "list[str]" = betterproto2.field(
        2, betterproto2.TYPE_STRING, repeated=True
    )
    """
    @Document The selectors for outbound under observation
    """

    probe_url: "str" = betterproto2.field(3, betterproto2.TYPE_STRING)

    probe_interval: "int" = betterproto2.field(4, betterproto2.TYPE_INT64)

    enable_concurrency: "bool" = betterproto2.field(5, betterproto2.TYPE_BOOL)


default_message_pool.register_message("xray.core.app.observatory", "Config", Config)


@dataclass(eq=False, repr=False)
class HealthPingMeasurementResult(betterproto2.Message):
    all: "int" = betterproto2.field(1, betterproto2.TYPE_INT64)

    fail: "int" = betterproto2.field(2, betterproto2.TYPE_INT64)

    deviation: "int" = betterproto2.field(3, betterproto2.TYPE_INT64)

    average: "int" = betterproto2.field(4, betterproto2.TYPE_INT64)

    max: "int" = betterproto2.field(5, betterproto2.TYPE_INT64)

    min: "int" = betterproto2.field(6, betterproto2.TYPE_INT64)


default_message_pool.register_message(
    "xray.core.app.observatory",
    "HealthPingMeasurementResult",
    HealthPingMeasurementResult,
)


@dataclass(eq=False, repr=False)
class Intensity(betterproto2.Message):
    probe_interval: "int" = betterproto2.field(1, betterproto2.TYPE_UINT32)
    """
    @Document The time interval for a probe request in ms.
    @Type time.ms
    """


default_message_pool.register_message(
    "xray.core.app.observatory", "Intensity", Intensity
)


@dataclass(eq=False, repr=False)
class ObservationResult(betterproto2.Message):
    status: "list[OutboundStatus]" = betterproto2.field(
        1, betterproto2.TYPE_MESSAGE, repeated=True
    )


default_message_pool.register_message(
    "xray.core.app.observatory", "ObservationResult", ObservationResult
)


@dataclass(eq=False, repr=False)
class OutboundStatus(betterproto2.Message):
    alive: "bool" = betterproto2.field(1, betterproto2.TYPE_BOOL)
    """
    @Document Whether this outbound is usable
    @Restriction ReadOnlyForUser
    """

    delay: "int" = betterproto2.field(2, betterproto2.TYPE_INT64)
    """
    @Document The time for probe request to finish.
    @Type time.ms
    @Restriction ReadOnlyForUser
    """

    last_error_reason: "str" = betterproto2.field(3, betterproto2.TYPE_STRING)
    """
    @Document The last error caused this outbound failed to relay probe request
    @Restriction NotMachineReadable
    """

    outbound_tag: "str" = betterproto2.field(4, betterproto2.TYPE_STRING)
    """
    @Document The outbound tag for this Server
    @Type id.outboundTag
    """

    last_seen_time: "int" = betterproto2.field(5, betterproto2.TYPE_INT64)
    """
    @Document The time this outbound is known to be alive
    @Type id.outboundTag
    """

    last_try_time: "int" = betterproto2.field(6, betterproto2.TYPE_INT64)
    """
    @Document The time this outbound is tried
    @Type id.outboundTag
    """

    health_ping: "HealthPingMeasurementResult | None" = betterproto2.field(
        7, betterproto2.TYPE_MESSAGE, optional=True
    )


default_message_pool.register_message(
    "xray.core.app.observatory", "OutboundStatus", OutboundStatus
)


@dataclass(eq=False, repr=False)
class ProbeResult(betterproto2.Message):
    alive: "bool" = betterproto2.field(1, betterproto2.TYPE_BOOL)
    """
    @Document Whether this outbound is usable
    @Restriction ReadOnlyForUser
    """

    delay: "int" = betterproto2.field(2, betterproto2.TYPE_INT64)
    """
    @Document The time for probe request to finish.
    @Type time.ms
    @Restriction ReadOnlyForUser
    """

    last_error_reason: "str" = betterproto2.field(3, betterproto2.TYPE_STRING)
    """
    @Document The error caused this outbound failed to relay probe request
    @Restriction NotMachineReadable
    """


default_message_pool.register_message(
    "xray.core.app.observatory", "ProbeResult", ProbeResult
)
