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

__all__ = (
    "Test",
    "InnerNested",
    "Nested",
    "WithOptional",
)


from typing import (
    Optional,
)

from pydantic import model_validator
from pydantic.dataclasses import dataclass

import betterproto


@dataclass(eq=False, repr=False, config={"extra": "forbid"})
class Test(betterproto.Message):
    """ """

    nested: Optional["Nested"] = betterproto.message_field(
        1, optional=True, group="kind"
    )
    """
    
    """

    with_optional: Optional["WithOptional"] = betterproto.message_field(
        2, optional=True, group="kind"
    )
    """
    
    """

    @model_validator(mode="after")
    def check_oneof(cls, values):
        return cls._validate_field_groups(values)


@dataclass(eq=False, repr=False, config={"extra": "forbid"})
class InnerNested(betterproto.Message):
    """ """

    a: Optional[bool] = betterproto.bool_field(1, optional=True)
    """
    
    """


@dataclass(eq=False, repr=False, config={"extra": "forbid"})
class Nested(betterproto.Message):
    """ """

    inner: "InnerNested" = betterproto.message_field(1)
    """
    
    """


@dataclass(eq=False, repr=False, config={"extra": "forbid"})
class WithOptional(betterproto.Message):
    """ """

    b: Optional[bool] = betterproto.bool_field(2, optional=True)
    """
    
    """
