# Generated by the protocol buffer compiler.  DO NOT EDIT!
# sources: events.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 datetime import datetime
from typing import (
    Dict,
    List,
    Optional,
)

import betterproto
import betterproto.lib.pydantic.google.protobuf as betterproto_lib_pydantic_google_protobuf
from pydantic import model_validator
from pydantic.dataclasses import rebuild_dataclass


@dataclass(eq=False, repr=False)
class CloudEvent(betterproto.Message):
    id: str = betterproto.string_field(1)
    """Required Attributes"""

    source: str = betterproto.string_field(2)
    spec_version: str = betterproto.string_field(3)
    type: str = betterproto.string_field(4)
    attributes: Dict[str, "CloudEventCloudEventAttributeValue"] = betterproto.map_field(
        5, betterproto.TYPE_STRING, betterproto.TYPE_MESSAGE
    )
    """Optional & Extension Attributes"""

    binary_data: Optional[bytes] = betterproto.bytes_field(
        6, optional=True, group="data"
    )
    text_data: Optional[str] = betterproto.string_field(7, optional=True, group="data")
    proto_data: Optional["betterproto_lib_pydantic_google_protobuf.Any"] = (
        betterproto.message_field(8, optional=True, group="data")
    )

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


@dataclass(eq=False, repr=False)
class CloudEventCloudEventAttributeValue(betterproto.Message):
    ce_boolean: Optional[bool] = betterproto.bool_field(1, optional=True, group="attr")
    ce_integer: Optional[int] = betterproto.int32_field(2, optional=True, group="attr")
    ce_string: Optional[str] = betterproto.string_field(3, optional=True, group="attr")
    ce_bytes: Optional[bytes] = betterproto.bytes_field(4, optional=True, group="attr")
    ce_uri: Optional[str] = betterproto.string_field(5, optional=True, group="attr")
    ce_uri_ref: Optional[str] = betterproto.string_field(6, optional=True, group="attr")
    ce_timestamp: Optional[datetime] = betterproto.message_field(
        7, optional=True, group="attr"
    )

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


@dataclass(eq=False, repr=False)
class CloudEventBatch(betterproto.Message):
    events: List["CloudEvent"] = betterproto.message_field(1)


rebuild_dataclass(CloudEvent)  # type: ignore
rebuild_dataclass(CloudEventCloudEventAttributeValue)  # type: ignore
rebuild_dataclass(CloudEventBatch)  # type: ignore
