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


class Signal(betterproto.Enum):
    PASS = 0
    RESIGN = 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):
    signal: Optional["Signal"] = betterproto.enum_field(
        1, optional=True, group="action"
    )
    move: Optional["Move"] = betterproto.message_field(2, optional=True, group="action")

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


@dataclass(eq=False, repr=False)
class Move(betterproto.Message):
    x: int = betterproto.int32_field(1)
    y: int = betterproto.int32_field(2)


rebuild_dataclass(Test)  # type: ignore
