// @generated by jacquard-lexicon. DO NOT EDIT.
//
// Lexicon: directory.evnt.event
//
// This file was automatically generated from Lexicon schemas.
// Any manual changes will be overwritten on the next regeneration.

#[allow(unused_imports)]
use alloc::collections::BTreeMap;

#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::CowStr;

#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::types::value::Data;
use jacquard_derive::{IntoStatic, lexicon, open_union};
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;

#[allow(unused_imports)]
use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
use serde::{Serialize, Deserialize};

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct Address<'a> {
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub addr: Option<CowStr<'a>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub country_code: Option<CowStr<'a>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub postal_code: Option<CowStr<'a>>,
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct Coordinates<'a> {
    pub lat: i64,
    pub lng: i64,
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct EventComponent<'a> {
    #[serde(borrow)]
    pub data: Data<'a>,
    #[serde(borrow)]
    pub r#type: CowStr<'a>,
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct EventInstance<'a> {
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub end: Option<CowStr<'a>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub start: Option<CowStr<'a>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub status: Option<Data<'a>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub venue_ids: Option<Vec<CowStr<'a>>>,
}


#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum EventStatus<'a> {
    Planned,
    Uncertain,
    Postponed,
    Cancelled,
    Suspended,
    Other(CowStr<'a>),
}

impl<'a> EventStatus<'a> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::Planned => "planned",
            Self::Uncertain => "uncertain",
            Self::Postponed => "postponed",
            Self::Cancelled => "cancelled",
            Self::Suspended => "suspended",
            Self::Other(s) => s.as_ref(),
        }
    }
}

impl<'a> From<&'a str> for EventStatus<'a> {
    fn from(s: &'a str) -> Self {
        match s {
            "planned" => Self::Planned,
            "uncertain" => Self::Uncertain,
            "postponed" => Self::Postponed,
            "cancelled" => Self::Cancelled,
            "suspended" => Self::Suspended,
            _ => Self::Other(CowStr::from(s)),
        }
    }
}

impl<'a> From<String> for EventStatus<'a> {
    fn from(s: String) -> Self {
        match s.as_str() {
            "planned" => Self::Planned,
            "uncertain" => Self::Uncertain,
            "postponed" => Self::Postponed,
            "cancelled" => Self::Cancelled,
            "suspended" => Self::Suspended,
            _ => Self::Other(CowStr::from(s)),
        }
    }
}

impl<'a> AsRef<str> for EventStatus<'a> {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}

impl<'a> core::fmt::Display for EventStatus<'a> {
    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
        write!(f, "{}", self.as_str())
    }
}

impl<'a> serde::Serialize for EventStatus<'a> {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        serializer.serialize_str(self.as_str())
    }
}

impl<'de, 'a> serde::Deserialize<'de> for EventStatus<'a>
where
    'de: 'a,
{
    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        let s = <&'de str>::deserialize(deserializer)?;
        Ok(Self::from(s))
    }
}

impl jacquard_common::IntoStatic for EventStatus<'_> {
    type Output = EventStatus<'static>;
    fn into_static(self) -> Self::Output {
        match self {
            EventStatus::Planned => EventStatus::Planned,
            EventStatus::Uncertain => EventStatus::Uncertain,
            EventStatus::Postponed => EventStatus::Postponed,
            EventStatus::Cancelled => EventStatus::Cancelled,
            EventStatus::Suspended => EventStatus::Suspended,
            EventStatus::Other(v) => EventStatus::Other(v.into_static()),
        }
    }
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct OnlineVenue<'a> {
    #[serde(borrow)]
    pub id: CowStr<'a>,
    #[serde(borrow)]
    pub name: Data<'a>,
    #[serde(borrow)]
    pub r#type: CowStr<'a>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub url: Option<CowStr<'a>>,
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct PhysicalVenue<'a> {
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub address: Option<Data<'a>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub coordinates: Option<Data<'a>>,
    #[serde(borrow)]
    pub id: CowStr<'a>,
    #[serde(borrow)]
    pub name: Data<'a>,
    #[serde(borrow)]
    pub r#type: CowStr<'a>,
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct UnknownVenue<'a> {
    #[serde(borrow)]
    pub id: CowStr<'a>,
    #[serde(borrow)]
    pub name: Data<'a>,
    #[serde(borrow)]
    pub r#type: CowStr<'a>,
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct Event<'a> {
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub components: Option<Vec<Data<'a>>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub instances: Option<Vec<Data<'a>>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub label: Option<Data<'a>>,
    #[serde(borrow)]
    pub name: Data<'a>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub status: Option<Data<'a>>,
    pub v: i64,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub venues: Option<Vec<EventVenuesItem<'a>>>,
}


#[open_union]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(tag = "$type")]
#[serde(bound(deserialize = "'de: 'a"))]
pub enum EventVenuesItem<'a> {}
impl<'a> LexiconSchema for Address<'a> {
    fn nsid() -> &'static str {
        "directory.evnt.event"
    }
    fn def_name() -> &'static str {
        "Address"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_directory_evnt_event()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<'a> LexiconSchema for Coordinates<'a> {
    fn nsid() -> &'static str {
        "directory.evnt.event"
    }
    fn def_name() -> &'static str {
        "Coordinates"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_directory_evnt_event()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<'a> LexiconSchema for EventComponent<'a> {
    fn nsid() -> &'static str {
        "directory.evnt.event"
    }
    fn def_name() -> &'static str {
        "EventComponent"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_directory_evnt_event()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<'a> LexiconSchema for EventInstance<'a> {
    fn nsid() -> &'static str {
        "directory.evnt.event"
    }
    fn def_name() -> &'static str {
        "EventInstance"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_directory_evnt_event()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<'a> LexiconSchema for OnlineVenue<'a> {
    fn nsid() -> &'static str {
        "directory.evnt.event"
    }
    fn def_name() -> &'static str {
        "OnlineVenue"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_directory_evnt_event()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<'a> LexiconSchema for PhysicalVenue<'a> {
    fn nsid() -> &'static str {
        "directory.evnt.event"
    }
    fn def_name() -> &'static str {
        "PhysicalVenue"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_directory_evnt_event()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<'a> LexiconSchema for UnknownVenue<'a> {
    fn nsid() -> &'static str {
        "directory.evnt.event"
    }
    fn def_name() -> &'static str {
        "UnknownVenue"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_directory_evnt_event()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<'a> LexiconSchema for Event<'a> {
    fn nsid() -> &'static str {
        "directory.evnt.event"
    }
    fn def_name() -> &'static str {
        "main"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_directory_evnt_event()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

fn lexicon_doc_directory_evnt_event() -> LexiconDoc<'static> {
    #[allow(unused_imports)]
    use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
    use jacquard_lexicon::lexicon::*;
    use alloc::collections::BTreeMap;
    LexiconDoc {
        lexicon: Lexicon::Lexicon1,
        id: CowStr::new_static("directory.evnt.event"),
        defs: {
            let mut map = BTreeMap::new();
            map.insert(
                SmolStr::new_static("Address"),
                LexUserType::Object(LexObject {
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("addr"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("countryCode"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("postalCode"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("Coordinates"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![SmolStr::new_static("lat"), SmolStr::new_static("lng")],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("lat"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("lng"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("EventComponent"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![SmolStr::new_static("type"), SmolStr::new_static("data")],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("data"),
                            LexObjectProperty::Unknown(LexUnknown {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("type"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("EventInstance"),
                LexUserType::Object(LexObject {
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("end"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("start"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("status"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#eventStatus"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("venueIds"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::String(LexString {
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("EventStatus"),
                LexUserType::String(LexString { ..Default::default() }),
            );
            map.insert(
                SmolStr::new_static("OnlineVenue"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![
                            SmolStr::new_static("id"), SmolStr::new_static("type"),
                            SmolStr::new_static("name")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("id"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("name"),
                            LexObjectProperty::Unknown(LexUnknown {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("type"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("url"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("PhysicalVenue"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![
                            SmolStr::new_static("id"), SmolStr::new_static("type"),
                            SmolStr::new_static("name")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("address"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#address"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("coordinates"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#coordinates"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("id"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("name"),
                            LexObjectProperty::Unknown(LexUnknown {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("type"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("UnknownVenue"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![
                            SmolStr::new_static("id"), SmolStr::new_static("type"),
                            SmolStr::new_static("name")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("id"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("name"),
                            LexObjectProperty::Unknown(LexUnknown {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("type"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("main"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![SmolStr::new_static("v"), SmolStr::new_static("name")],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("components"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("#eventComponent"),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("instances"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("#eventInstance"),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("label"),
                            LexObjectProperty::Unknown(LexUnknown {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("name"),
                            LexObjectProperty::Unknown(LexUnknown {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("status"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#eventStatus"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("v"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("venues"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::Union(LexRefUnion {
                                    refs: vec![
                                        CowStr::new_static("#physicalVenue"),
                                        CowStr::new_static("#onlineVenue"),
                                        CowStr::new_static("#unknownVenue")
                                    ],
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map
        },
        ..Default::default()
    }
}

pub mod coordinates_state {

    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
    #[allow(unused)]
    use ::core::marker::PhantomData;
    mod sealed {
        pub trait Sealed {}
    }
    /// State trait tracking which required fields have been set
    pub trait State: sealed::Sealed {
        type Lng;
        type Lat;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Lng = Unset;
        type Lat = Unset;
    }
    ///State transition - sets the `lng` field to Set
    pub struct SetLng<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetLng<S> {}
    impl<S: State> State for SetLng<S> {
        type Lng = Set<members::lng>;
        type Lat = S::Lat;
    }
    ///State transition - sets the `lat` field to Set
    pub struct SetLat<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetLat<S> {}
    impl<S: State> State for SetLat<S> {
        type Lng = S::Lng;
        type Lat = Set<members::lat>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `lng` field
        pub struct lng(());
        ///Marker type for the `lat` field
        pub struct lat(());
    }
}

/// Builder for constructing an instance of this type
pub struct CoordinatesBuilder<'a, S: coordinates_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (Option<i64>, Option<i64>),
    _lifetime: PhantomData<&'a ()>,
}

impl<'a> Coordinates<'a> {
    /// Create a new builder for this type
    pub fn new() -> CoordinatesBuilder<'a, coordinates_state::Empty> {
        CoordinatesBuilder::new()
    }
}

impl<'a> CoordinatesBuilder<'a, coordinates_state::Empty> {
    /// Create a new builder with all fields unset
    pub fn new() -> Self {
        CoordinatesBuilder {
            _state: PhantomData,
            _fields: (None, None),
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> CoordinatesBuilder<'a, S>
where
    S: coordinates_state::State,
    S::Lat: coordinates_state::IsUnset,
{
    /// Set the `lat` field (required)
    pub fn lat(
        mut self,
        value: impl Into<i64>,
    ) -> CoordinatesBuilder<'a, coordinates_state::SetLat<S>> {
        self._fields.0 = Option::Some(value.into());
        CoordinatesBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> CoordinatesBuilder<'a, S>
where
    S: coordinates_state::State,
    S::Lng: coordinates_state::IsUnset,
{
    /// Set the `lng` field (required)
    pub fn lng(
        mut self,
        value: impl Into<i64>,
    ) -> CoordinatesBuilder<'a, coordinates_state::SetLng<S>> {
        self._fields.1 = Option::Some(value.into());
        CoordinatesBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> CoordinatesBuilder<'a, S>
where
    S: coordinates_state::State,
    S::Lng: coordinates_state::IsSet,
    S::Lat: coordinates_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> Coordinates<'a> {
        Coordinates {
            lat: self._fields.0.unwrap(),
            lng: self._fields.1.unwrap(),
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
    ) -> Coordinates<'a> {
        Coordinates {
            lat: self._fields.0.unwrap(),
            lng: self._fields.1.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod event_component_state {

    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
    #[allow(unused)]
    use ::core::marker::PhantomData;
    mod sealed {
        pub trait Sealed {}
    }
    /// State trait tracking which required fields have been set
    pub trait State: sealed::Sealed {
        type Data;
        type Type;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Data = Unset;
        type Type = Unset;
    }
    ///State transition - sets the `data` field to Set
    pub struct SetData<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetData<S> {}
    impl<S: State> State for SetData<S> {
        type Data = Set<members::data>;
        type Type = S::Type;
    }
    ///State transition - sets the `type` field to Set
    pub struct SetType<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetType<S> {}
    impl<S: State> State for SetType<S> {
        type Data = S::Data;
        type Type = Set<members::r#type>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `data` field
        pub struct data(());
        ///Marker type for the `type` field
        pub struct r#type(());
    }
}

/// Builder for constructing an instance of this type
pub struct EventComponentBuilder<'a, S: event_component_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (Option<Data<'a>>, Option<CowStr<'a>>),
    _lifetime: PhantomData<&'a ()>,
}

impl<'a> EventComponent<'a> {
    /// Create a new builder for this type
    pub fn new() -> EventComponentBuilder<'a, event_component_state::Empty> {
        EventComponentBuilder::new()
    }
}

impl<'a> EventComponentBuilder<'a, event_component_state::Empty> {
    /// Create a new builder with all fields unset
    pub fn new() -> Self {
        EventComponentBuilder {
            _state: PhantomData,
            _fields: (None, None),
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> EventComponentBuilder<'a, S>
where
    S: event_component_state::State,
    S::Data: event_component_state::IsUnset,
{
    /// Set the `data` field (required)
    pub fn data(
        mut self,
        value: impl Into<Data<'a>>,
    ) -> EventComponentBuilder<'a, event_component_state::SetData<S>> {
        self._fields.0 = Option::Some(value.into());
        EventComponentBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> EventComponentBuilder<'a, S>
where
    S: event_component_state::State,
    S::Type: event_component_state::IsUnset,
{
    /// Set the `type` field (required)
    pub fn r#type(
        mut self,
        value: impl Into<CowStr<'a>>,
    ) -> EventComponentBuilder<'a, event_component_state::SetType<S>> {
        self._fields.1 = Option::Some(value.into());
        EventComponentBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> EventComponentBuilder<'a, S>
where
    S: event_component_state::State,
    S::Data: event_component_state::IsSet,
    S::Type: event_component_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> EventComponent<'a> {
        EventComponent {
            data: self._fields.0.unwrap(),
            r#type: self._fields.1.unwrap(),
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
    ) -> EventComponent<'a> {
        EventComponent {
            data: self._fields.0.unwrap(),
            r#type: self._fields.1.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod online_venue_state {

    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
    #[allow(unused)]
    use ::core::marker::PhantomData;
    mod sealed {
        pub trait Sealed {}
    }
    /// State trait tracking which required fields have been set
    pub trait State: sealed::Sealed {
        type Type;
        type Name;
        type Id;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Type = Unset;
        type Name = Unset;
        type Id = Unset;
    }
    ///State transition - sets the `type` field to Set
    pub struct SetType<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetType<S> {}
    impl<S: State> State for SetType<S> {
        type Type = Set<members::r#type>;
        type Name = S::Name;
        type Id = S::Id;
    }
    ///State transition - sets the `name` field to Set
    pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetName<S> {}
    impl<S: State> State for SetName<S> {
        type Type = S::Type;
        type Name = Set<members::name>;
        type Id = S::Id;
    }
    ///State transition - sets the `id` field to Set
    pub struct SetId<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetId<S> {}
    impl<S: State> State for SetId<S> {
        type Type = S::Type;
        type Name = S::Name;
        type Id = Set<members::id>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `type` field
        pub struct r#type(());
        ///Marker type for the `name` field
        pub struct name(());
        ///Marker type for the `id` field
        pub struct id(());
    }
}

/// Builder for constructing an instance of this type
pub struct OnlineVenueBuilder<'a, S: online_venue_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (
        Option<CowStr<'a>>,
        Option<Data<'a>>,
        Option<CowStr<'a>>,
        Option<CowStr<'a>>,
    ),
    _lifetime: PhantomData<&'a ()>,
}

impl<'a> OnlineVenue<'a> {
    /// Create a new builder for this type
    pub fn new() -> OnlineVenueBuilder<'a, online_venue_state::Empty> {
        OnlineVenueBuilder::new()
    }
}

impl<'a> OnlineVenueBuilder<'a, online_venue_state::Empty> {
    /// Create a new builder with all fields unset
    pub fn new() -> Self {
        OnlineVenueBuilder {
            _state: PhantomData,
            _fields: (None, None, None, None),
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> OnlineVenueBuilder<'a, S>
where
    S: online_venue_state::State,
    S::Id: online_venue_state::IsUnset,
{
    /// Set the `id` field (required)
    pub fn id(
        mut self,
        value: impl Into<CowStr<'a>>,
    ) -> OnlineVenueBuilder<'a, online_venue_state::SetId<S>> {
        self._fields.0 = Option::Some(value.into());
        OnlineVenueBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> OnlineVenueBuilder<'a, S>
where
    S: online_venue_state::State,
    S::Name: online_venue_state::IsUnset,
{
    /// Set the `name` field (required)
    pub fn name(
        mut self,
        value: impl Into<Data<'a>>,
    ) -> OnlineVenueBuilder<'a, online_venue_state::SetName<S>> {
        self._fields.1 = Option::Some(value.into());
        OnlineVenueBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> OnlineVenueBuilder<'a, S>
where
    S: online_venue_state::State,
    S::Type: online_venue_state::IsUnset,
{
    /// Set the `type` field (required)
    pub fn r#type(
        mut self,
        value: impl Into<CowStr<'a>>,
    ) -> OnlineVenueBuilder<'a, online_venue_state::SetType<S>> {
        self._fields.2 = Option::Some(value.into());
        OnlineVenueBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S: online_venue_state::State> OnlineVenueBuilder<'a, S> {
    /// Set the `url` field (optional)
    pub fn url(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
        self._fields.3 = value.into();
        self
    }
    /// Set the `url` field to an Option value (optional)
    pub fn maybe_url(mut self, value: Option<CowStr<'a>>) -> Self {
        self._fields.3 = value;
        self
    }
}

impl<'a, S> OnlineVenueBuilder<'a, S>
where
    S: online_venue_state::State,
    S::Type: online_venue_state::IsSet,
    S::Name: online_venue_state::IsSet,
    S::Id: online_venue_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> OnlineVenue<'a> {
        OnlineVenue {
            id: self._fields.0.unwrap(),
            name: self._fields.1.unwrap(),
            r#type: self._fields.2.unwrap(),
            url: self._fields.3,
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
    ) -> OnlineVenue<'a> {
        OnlineVenue {
            id: self._fields.0.unwrap(),
            name: self._fields.1.unwrap(),
            r#type: self._fields.2.unwrap(),
            url: self._fields.3,
            extra_data: Some(extra_data),
        }
    }
}

pub mod physical_venue_state {

    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
    #[allow(unused)]
    use ::core::marker::PhantomData;
    mod sealed {
        pub trait Sealed {}
    }
    /// State trait tracking which required fields have been set
    pub trait State: sealed::Sealed {
        type Id;
        type Type;
        type Name;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Id = Unset;
        type Type = Unset;
        type Name = Unset;
    }
    ///State transition - sets the `id` field to Set
    pub struct SetId<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetId<S> {}
    impl<S: State> State for SetId<S> {
        type Id = Set<members::id>;
        type Type = S::Type;
        type Name = S::Name;
    }
    ///State transition - sets the `type` field to Set
    pub struct SetType<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetType<S> {}
    impl<S: State> State for SetType<S> {
        type Id = S::Id;
        type Type = Set<members::r#type>;
        type Name = S::Name;
    }
    ///State transition - sets the `name` field to Set
    pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetName<S> {}
    impl<S: State> State for SetName<S> {
        type Id = S::Id;
        type Type = S::Type;
        type Name = Set<members::name>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `id` field
        pub struct id(());
        ///Marker type for the `type` field
        pub struct r#type(());
        ///Marker type for the `name` field
        pub struct name(());
    }
}

/// Builder for constructing an instance of this type
pub struct PhysicalVenueBuilder<'a, S: physical_venue_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (
        Option<Data<'a>>,
        Option<Data<'a>>,
        Option<CowStr<'a>>,
        Option<Data<'a>>,
        Option<CowStr<'a>>,
    ),
    _lifetime: PhantomData<&'a ()>,
}

impl<'a> PhysicalVenue<'a> {
    /// Create a new builder for this type
    pub fn new() -> PhysicalVenueBuilder<'a, physical_venue_state::Empty> {
        PhysicalVenueBuilder::new()
    }
}

impl<'a> PhysicalVenueBuilder<'a, physical_venue_state::Empty> {
    /// Create a new builder with all fields unset
    pub fn new() -> Self {
        PhysicalVenueBuilder {
            _state: PhantomData,
            _fields: (None, None, None, None, None),
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S: physical_venue_state::State> PhysicalVenueBuilder<'a, S> {
    /// Set the `address` field (optional)
    pub fn address(mut self, value: impl Into<Option<Data<'a>>>) -> Self {
        self._fields.0 = value.into();
        self
    }
    /// Set the `address` field to an Option value (optional)
    pub fn maybe_address(mut self, value: Option<Data<'a>>) -> Self {
        self._fields.0 = value;
        self
    }
}

impl<'a, S: physical_venue_state::State> PhysicalVenueBuilder<'a, S> {
    /// Set the `coordinates` field (optional)
    pub fn coordinates(mut self, value: impl Into<Option<Data<'a>>>) -> Self {
        self._fields.1 = value.into();
        self
    }
    /// Set the `coordinates` field to an Option value (optional)
    pub fn maybe_coordinates(mut self, value: Option<Data<'a>>) -> Self {
        self._fields.1 = value;
        self
    }
}

impl<'a, S> PhysicalVenueBuilder<'a, S>
where
    S: physical_venue_state::State,
    S::Id: physical_venue_state::IsUnset,
{
    /// Set the `id` field (required)
    pub fn id(
        mut self,
        value: impl Into<CowStr<'a>>,
    ) -> PhysicalVenueBuilder<'a, physical_venue_state::SetId<S>> {
        self._fields.2 = Option::Some(value.into());
        PhysicalVenueBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> PhysicalVenueBuilder<'a, S>
where
    S: physical_venue_state::State,
    S::Name: physical_venue_state::IsUnset,
{
    /// Set the `name` field (required)
    pub fn name(
        mut self,
        value: impl Into<Data<'a>>,
    ) -> PhysicalVenueBuilder<'a, physical_venue_state::SetName<S>> {
        self._fields.3 = Option::Some(value.into());
        PhysicalVenueBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> PhysicalVenueBuilder<'a, S>
where
    S: physical_venue_state::State,
    S::Type: physical_venue_state::IsUnset,
{
    /// Set the `type` field (required)
    pub fn r#type(
        mut self,
        value: impl Into<CowStr<'a>>,
    ) -> PhysicalVenueBuilder<'a, physical_venue_state::SetType<S>> {
        self._fields.4 = Option::Some(value.into());
        PhysicalVenueBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> PhysicalVenueBuilder<'a, S>
where
    S: physical_venue_state::State,
    S::Id: physical_venue_state::IsSet,
    S::Type: physical_venue_state::IsSet,
    S::Name: physical_venue_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> PhysicalVenue<'a> {
        PhysicalVenue {
            address: self._fields.0,
            coordinates: self._fields.1,
            id: self._fields.2.unwrap(),
            name: self._fields.3.unwrap(),
            r#type: self._fields.4.unwrap(),
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
    ) -> PhysicalVenue<'a> {
        PhysicalVenue {
            address: self._fields.0,
            coordinates: self._fields.1,
            id: self._fields.2.unwrap(),
            name: self._fields.3.unwrap(),
            r#type: self._fields.4.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod unknown_venue_state {

    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
    #[allow(unused)]
    use ::core::marker::PhantomData;
    mod sealed {
        pub trait Sealed {}
    }
    /// State trait tracking which required fields have been set
    pub trait State: sealed::Sealed {
        type Type;
        type Name;
        type Id;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Type = Unset;
        type Name = Unset;
        type Id = Unset;
    }
    ///State transition - sets the `type` field to Set
    pub struct SetType<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetType<S> {}
    impl<S: State> State for SetType<S> {
        type Type = Set<members::r#type>;
        type Name = S::Name;
        type Id = S::Id;
    }
    ///State transition - sets the `name` field to Set
    pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetName<S> {}
    impl<S: State> State for SetName<S> {
        type Type = S::Type;
        type Name = Set<members::name>;
        type Id = S::Id;
    }
    ///State transition - sets the `id` field to Set
    pub struct SetId<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetId<S> {}
    impl<S: State> State for SetId<S> {
        type Type = S::Type;
        type Name = S::Name;
        type Id = Set<members::id>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `type` field
        pub struct r#type(());
        ///Marker type for the `name` field
        pub struct name(());
        ///Marker type for the `id` field
        pub struct id(());
    }
}

/// Builder for constructing an instance of this type
pub struct UnknownVenueBuilder<'a, S: unknown_venue_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (Option<CowStr<'a>>, Option<Data<'a>>, Option<CowStr<'a>>),
    _lifetime: PhantomData<&'a ()>,
}

impl<'a> UnknownVenue<'a> {
    /// Create a new builder for this type
    pub fn new() -> UnknownVenueBuilder<'a, unknown_venue_state::Empty> {
        UnknownVenueBuilder::new()
    }
}

impl<'a> UnknownVenueBuilder<'a, unknown_venue_state::Empty> {
    /// Create a new builder with all fields unset
    pub fn new() -> Self {
        UnknownVenueBuilder {
            _state: PhantomData,
            _fields: (None, None, None),
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> UnknownVenueBuilder<'a, S>
where
    S: unknown_venue_state::State,
    S::Id: unknown_venue_state::IsUnset,
{
    /// Set the `id` field (required)
    pub fn id(
        mut self,
        value: impl Into<CowStr<'a>>,
    ) -> UnknownVenueBuilder<'a, unknown_venue_state::SetId<S>> {
        self._fields.0 = Option::Some(value.into());
        UnknownVenueBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> UnknownVenueBuilder<'a, S>
where
    S: unknown_venue_state::State,
    S::Name: unknown_venue_state::IsUnset,
{
    /// Set the `name` field (required)
    pub fn name(
        mut self,
        value: impl Into<Data<'a>>,
    ) -> UnknownVenueBuilder<'a, unknown_venue_state::SetName<S>> {
        self._fields.1 = Option::Some(value.into());
        UnknownVenueBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> UnknownVenueBuilder<'a, S>
where
    S: unknown_venue_state::State,
    S::Type: unknown_venue_state::IsUnset,
{
    /// Set the `type` field (required)
    pub fn r#type(
        mut self,
        value: impl Into<CowStr<'a>>,
    ) -> UnknownVenueBuilder<'a, unknown_venue_state::SetType<S>> {
        self._fields.2 = Option::Some(value.into());
        UnknownVenueBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> UnknownVenueBuilder<'a, S>
where
    S: unknown_venue_state::State,
    S::Type: unknown_venue_state::IsSet,
    S::Name: unknown_venue_state::IsSet,
    S::Id: unknown_venue_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> UnknownVenue<'a> {
        UnknownVenue {
            id: self._fields.0.unwrap(),
            name: self._fields.1.unwrap(),
            r#type: self._fields.2.unwrap(),
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
    ) -> UnknownVenue<'a> {
        UnknownVenue {
            id: self._fields.0.unwrap(),
            name: self._fields.1.unwrap(),
            r#type: self._fields.2.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod event_state {

    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
    #[allow(unused)]
    use ::core::marker::PhantomData;
    mod sealed {
        pub trait Sealed {}
    }
    /// State trait tracking which required fields have been set
    pub trait State: sealed::Sealed {
        type Name;
        type V;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Name = Unset;
        type V = Unset;
    }
    ///State transition - sets the `name` field to Set
    pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetName<S> {}
    impl<S: State> State for SetName<S> {
        type Name = Set<members::name>;
        type V = S::V;
    }
    ///State transition - sets the `v` field to Set
    pub struct SetV<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetV<S> {}
    impl<S: State> State for SetV<S> {
        type Name = S::Name;
        type V = Set<members::v>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `name` field
        pub struct name(());
        ///Marker type for the `v` field
        pub struct v(());
    }
}

/// Builder for constructing an instance of this type
pub struct EventBuilder<'a, S: event_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (
        Option<Vec<Data<'a>>>,
        Option<Vec<Data<'a>>>,
        Option<Data<'a>>,
        Option<Data<'a>>,
        Option<Data<'a>>,
        Option<i64>,
        Option<Vec<EventVenuesItem<'a>>>,
    ),
    _lifetime: PhantomData<&'a ()>,
}

impl<'a> Event<'a> {
    /// Create a new builder for this type
    pub fn new() -> EventBuilder<'a, event_state::Empty> {
        EventBuilder::new()
    }
}

impl<'a> EventBuilder<'a, event_state::Empty> {
    /// Create a new builder with all fields unset
    pub fn new() -> Self {
        EventBuilder {
            _state: PhantomData,
            _fields: (None, None, None, None, None, None, None),
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S: event_state::State> EventBuilder<'a, S> {
    /// Set the `components` field (optional)
    pub fn components(mut self, value: impl Into<Option<Vec<Data<'a>>>>) -> Self {
        self._fields.0 = value.into();
        self
    }
    /// Set the `components` field to an Option value (optional)
    pub fn maybe_components(mut self, value: Option<Vec<Data<'a>>>) -> Self {
        self._fields.0 = value;
        self
    }
}

impl<'a, S: event_state::State> EventBuilder<'a, S> {
    /// Set the `instances` field (optional)
    pub fn instances(mut self, value: impl Into<Option<Vec<Data<'a>>>>) -> Self {
        self._fields.1 = value.into();
        self
    }
    /// Set the `instances` field to an Option value (optional)
    pub fn maybe_instances(mut self, value: Option<Vec<Data<'a>>>) -> Self {
        self._fields.1 = value;
        self
    }
}

impl<'a, S: event_state::State> EventBuilder<'a, S> {
    /// Set the `label` field (optional)
    pub fn label(mut self, value: impl Into<Option<Data<'a>>>) -> Self {
        self._fields.2 = value.into();
        self
    }
    /// Set the `label` field to an Option value (optional)
    pub fn maybe_label(mut self, value: Option<Data<'a>>) -> Self {
        self._fields.2 = value;
        self
    }
}

impl<'a, S> EventBuilder<'a, S>
where
    S: event_state::State,
    S::Name: event_state::IsUnset,
{
    /// Set the `name` field (required)
    pub fn name(
        mut self,
        value: impl Into<Data<'a>>,
    ) -> EventBuilder<'a, event_state::SetName<S>> {
        self._fields.3 = Option::Some(value.into());
        EventBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S: event_state::State> EventBuilder<'a, S> {
    /// Set the `status` field (optional)
    pub fn status(mut self, value: impl Into<Option<Data<'a>>>) -> Self {
        self._fields.4 = value.into();
        self
    }
    /// Set the `status` field to an Option value (optional)
    pub fn maybe_status(mut self, value: Option<Data<'a>>) -> Self {
        self._fields.4 = value;
        self
    }
}

impl<'a, S> EventBuilder<'a, S>
where
    S: event_state::State,
    S::V: event_state::IsUnset,
{
    /// Set the `v` field (required)
    pub fn v(mut self, value: impl Into<i64>) -> EventBuilder<'a, event_state::SetV<S>> {
        self._fields.5 = Option::Some(value.into());
        EventBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S: event_state::State> EventBuilder<'a, S> {
    /// Set the `venues` field (optional)
    pub fn venues(mut self, value: impl Into<Option<Vec<EventVenuesItem<'a>>>>) -> Self {
        self._fields.6 = value.into();
        self
    }
    /// Set the `venues` field to an Option value (optional)
    pub fn maybe_venues(mut self, value: Option<Vec<EventVenuesItem<'a>>>) -> Self {
        self._fields.6 = value;
        self
    }
}

impl<'a, S> EventBuilder<'a, S>
where
    S: event_state::State,
    S::Name: event_state::IsSet,
    S::V: event_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> Event<'a> {
        Event {
            components: self._fields.0,
            instances: self._fields.1,
            label: self._fields.2,
            name: self._fields.3.unwrap(),
            status: self._fields.4,
            v: self._fields.5.unwrap(),
            venues: self._fields.6,
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data
    pub fn build_with_data(
        self,
        extra_data: BTreeMap<jacquard_common::deps::smol_str::SmolStr, Data<'a>>,
    ) -> Event<'a> {
        Event {
            components: self._fields.0,
            instances: self._fields.1,
            label: self._fields.2,
            name: self._fields.3.unwrap(),
            status: self._fields.4,
            v: self._fields.5.unwrap(),
            venues: self._fields.6,
            extra_data: Some(extra_data),
        }
    }
}