# Generated by the protocol buffer compiler.  DO NOT EDIT!
# sources: oneof.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 Optional

import betterproto
from pydantic import model_validator
from pydantic.dataclasses import rebuild_dataclass


@dataclass(eq=False, repr=False)
class MixedDrink(betterproto.Message):
    shots: int = betterproto.int32_field(1)


@dataclass(eq=False, repr=False)
class Test(betterproto.Message):
    pitied: Optional[int] = betterproto.int32_field(1, optional=True, group="foo")
    pitier: Optional[str] = betterproto.string_field(2, optional=True, group="foo")
    just_a_regular_field: int = betterproto.int32_field(3)
    drinks: Optional[int] = betterproto.int32_field(11, optional=True, group="bar")
    bar_name: Optional[str] = betterproto.string_field(12, optional=True, group="bar")
    mixed_drink: Optional["MixedDrink"] = betterproto.message_field(
        13, optional=True, group="bar"
    )

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


rebuild_dataclass(Test)  # type: ignore
