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

__all__ = (
    "Config",
    "Policy",
    "PolicyBuffer",
    "PolicyStats",
    "PolicyTimeout",
    "Second",
    "SystemPolicy",
    "SystemPolicyStats",
)

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):
    level: "dict[int, Policy]" = betterproto2.field(
        1,
        betterproto2.TYPE_MAP,
        map_meta=betterproto2.map_meta(
            betterproto2.TYPE_UINT32, betterproto2.TYPE_MESSAGE
        ),
    )

    system: "SystemPolicy | None" = betterproto2.field(
        2, betterproto2.TYPE_MESSAGE, optional=True
    )


default_message_pool.register_message("xray.app.policy", "Config", Config)


@dataclass(eq=False, repr=False)
class Policy(betterproto2.Message):
    timeout: "PolicyTimeout | None" = betterproto2.field(
        1, betterproto2.TYPE_MESSAGE, optional=True
    )

    stats: "PolicyStats | None" = betterproto2.field(
        2, betterproto2.TYPE_MESSAGE, optional=True
    )

    buffer: "PolicyBuffer | None" = betterproto2.field(
        3, betterproto2.TYPE_MESSAGE, optional=True
    )


default_message_pool.register_message("xray.app.policy", "Policy", Policy)


@dataclass(eq=False, repr=False)
class PolicyBuffer(betterproto2.Message):
    connection: "int" = betterproto2.field(1, betterproto2.TYPE_INT32)
    """
    Buffer size per connection, in bytes. -1 for unlimited buffer.
    """


default_message_pool.register_message("xray.app.policy", "Policy.Buffer", PolicyBuffer)


@dataclass(eq=False, repr=False)
class PolicyStats(betterproto2.Message):
    user_uplink: "bool" = betterproto2.field(1, betterproto2.TYPE_BOOL)

    user_downlink: "bool" = betterproto2.field(2, betterproto2.TYPE_BOOL)

    user_online: "bool" = betterproto2.field(3, betterproto2.TYPE_BOOL)


default_message_pool.register_message("xray.app.policy", "Policy.Stats", PolicyStats)


@dataclass(eq=False, repr=False)
class PolicyTimeout(betterproto2.Message):
    """
    Timeout is a message for timeout settings in various stages, in seconds.
    """

    handshake: "Second | None" = betterproto2.field(
        1, betterproto2.TYPE_MESSAGE, optional=True
    )

    connection_idle: "Second | None" = betterproto2.field(
        2, betterproto2.TYPE_MESSAGE, optional=True
    )

    uplink_only: "Second | None" = betterproto2.field(
        3, betterproto2.TYPE_MESSAGE, optional=True
    )

    downlink_only: "Second | None" = betterproto2.field(
        4, betterproto2.TYPE_MESSAGE, optional=True
    )


default_message_pool.register_message(
    "xray.app.policy", "Policy.Timeout", PolicyTimeout
)


@dataclass(eq=False, repr=False)
class Second(betterproto2.Message):
    value: "int" = betterproto2.field(1, betterproto2.TYPE_UINT32)


default_message_pool.register_message("xray.app.policy", "Second", Second)


@dataclass(eq=False, repr=False)
class SystemPolicy(betterproto2.Message):
    stats: "SystemPolicyStats | None" = betterproto2.field(
        1, betterproto2.TYPE_MESSAGE, optional=True
    )


default_message_pool.register_message("xray.app.policy", "SystemPolicy", SystemPolicy)


@dataclass(eq=False, repr=False)
class SystemPolicyStats(betterproto2.Message):
    inbound_uplink: "bool" = betterproto2.field(1, betterproto2.TYPE_BOOL)

    inbound_downlink: "bool" = betterproto2.field(2, betterproto2.TYPE_BOOL)

    outbound_uplink: "bool" = betterproto2.field(3, betterproto2.TYPE_BOOL)

    outbound_downlink: "bool" = betterproto2.field(4, betterproto2.TYPE_BOOL)


default_message_pool.register_message(
    "xray.app.policy", "SystemPolicy.Stats", SystemPolicyStats
)
