# Generated by the protocol buffer compiler.  DO NOT EDIT!
# sources: nestedtwice.proto
# plugin: python-betterproto
# This file has been @generated

from typing import TYPE_CHECKING


if TYPE_CHECKING:
    from dataclasses import dataclass
else:
    from pydantic.dataclasses import dataclass

from typing import List

import betterproto
from pydantic.dataclasses import rebuild_dataclass


class TestTopMiddleEnumBottom(betterproto.Enum):
    """EnumBottom doc."""

    A = 0
    """EnumBottom.A doc."""

    B = 1

    @classmethod
    def __get_pydantic_core_schema__(cls, _source_type, _handler):
        from pydantic_core import core_schema

        return core_schema.int_schema(ge=0)


@dataclass(eq=False, repr=False)
class Test(betterproto.Message):
    """Test doc."""

    top: "TestTop" = betterproto.message_field(1)
    """Test.top doc."""


@dataclass(eq=False, repr=False)
class TestTop(betterproto.Message):
    """Top doc."""

    name: str = betterproto.string_field(1)
    """Top.name doc."""

    middle: "TestTopMiddle" = betterproto.message_field(2)


@dataclass(eq=False, repr=False)
class TestTopMiddle(betterproto.Message):
    """Middle doc."""

    bottom: List["TestTopMiddleBottom"] = betterproto.message_field(2)
    """Middle.bottom doc."""

    enum_bottom: List["TestTopMiddleEnumBottom"] = betterproto.enum_field(3)
    top_middle_bottom: List["TestTopMiddleTopMiddleBottom"] = betterproto.message_field(
        4
    )
    bar: bool = betterproto.bool_field(5)


@dataclass(eq=False, repr=False)
class TestTopMiddleTopMiddleBottom(betterproto.Message):
    """TopMiddleBottom doc."""

    a: str = betterproto.string_field(1)
    """TopMiddleBottom.a doc."""


@dataclass(eq=False, repr=False)
class TestTopMiddleBottom(betterproto.Message):
    """Bottom doc."""

    foo: str = betterproto.string_field(1)
    """Bottom.foo doc."""


rebuild_dataclass(Test)  # type: ignore
rebuild_dataclass(TestTop)  # type: ignore
rebuild_dataclass(TestTopMiddle)  # type: ignore
