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

pub mod cancel_pipeline;
pub mod status;


#[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::collection::{Collection, RecordError};
use jacquard_common::types::string::{Did, AtUri, Cid};
use jacquard_common::types::uri::{RecordUri, UriError};
use jacquard_common::xrpc::XrpcResp;
use jacquard_derive::{IntoStatic, lexicon};
use jacquard_lexicon::lexicon::LexiconDoc;
use jacquard_lexicon::schema::LexiconSchema;

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

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct CloneOpts<'a> {
    pub depth: i64,
    pub skip: bool,
    pub submodules: bool,
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct Pipeline<'a> {
    #[serde(borrow)]
    pub trigger_metadata: pipeline::TriggerMetadata<'a>,
    #[serde(borrow)]
    pub workflows: Vec<pipeline::Workflow<'a>>,
}

/// Typed wrapper for GetRecord response with this collection's record type.

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct PipelineGetRecordOutput<'a> {
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub cid: Option<Cid<'a>>,
    #[serde(borrow)]
    pub uri: AtUri<'a>,
    #[serde(borrow)]
    pub value: Pipeline<'a>,
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct ManualTriggerData<'a> {
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub inputs: Option<Vec<pipeline::Pair<'a>>>,
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct Pair<'a> {
    #[serde(borrow)]
    pub key: CowStr<'a>,
    #[serde(borrow)]
    pub value: CowStr<'a>,
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct PullRequestTriggerData<'a> {
    #[serde(borrow)]
    pub action: CowStr<'a>,
    #[serde(borrow)]
    pub source_branch: CowStr<'a>,
    #[serde(borrow)]
    pub source_sha: CowStr<'a>,
    #[serde(borrow)]
    pub target_branch: CowStr<'a>,
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct PushTriggerData<'a> {
    #[serde(borrow)]
    pub new_sha: CowStr<'a>,
    #[serde(borrow)]
    pub old_sha: CowStr<'a>,
    #[serde(borrow)]
    pub r#ref: CowStr<'a>,
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct TriggerMetadata<'a> {
    #[serde(borrow)]
    pub kind: CowStr<'a>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub manual: Option<pipeline::ManualTriggerData<'a>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub pull_request: Option<pipeline::PullRequestTriggerData<'a>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub push: Option<pipeline::PushTriggerData<'a>>,
    #[serde(borrow)]
    pub repo: pipeline::TriggerRepo<'a>,
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct TriggerRepo<'a> {
    #[serde(borrow)]
    pub default_branch: CowStr<'a>,
    #[serde(borrow)]
    pub did: Did<'a>,
    #[serde(borrow)]
    pub knot: CowStr<'a>,
    #[serde(borrow)]
    pub repo: CowStr<'a>,
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct Workflow<'a> {
    #[serde(borrow)]
    pub clone: pipeline::CloneOpts<'a>,
    #[serde(borrow)]
    pub engine: CowStr<'a>,
    #[serde(borrow)]
    pub name: CowStr<'a>,
    #[serde(borrow)]
    pub raw: CowStr<'a>,
}

impl<'a> Pipeline<'a> {
    pub fn uri(
        uri: impl Into<CowStr<'a>>,
    ) -> Result<RecordUri<'a, PipelineRecord>, UriError> {
        RecordUri::try_from_uri(AtUri::new_cow(uri.into())?)
    }
}

impl<'a> LexiconSchema for CloneOpts<'a> {
    fn nsid() -> &'static str {
        "sh.tangled.pipeline"
    }
    fn def_name() -> &'static str {
        "cloneOpts"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_sh_tangled_pipeline()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

/// Marker type for deserializing records from this collection.

#[derive(Debug, Serialize, Deserialize)]
pub struct PipelineRecord;
impl XrpcResp for PipelineRecord {
    const NSID: &'static str = "sh.tangled.pipeline";
    const ENCODING: &'static str = "application/json";
    type Output<'de> = PipelineGetRecordOutput<'de>;
    type Err<'de> = RecordError<'de>;
}

impl From<PipelineGetRecordOutput<'_>> for Pipeline<'_> {
    fn from(output: PipelineGetRecordOutput<'_>) -> Self {
        use jacquard_common::IntoStatic;
        output.value.into_static()
    }
}

impl Collection for Pipeline<'_> {
    const NSID: &'static str = "sh.tangled.pipeline";
    type Record = PipelineRecord;
}

impl Collection for PipelineRecord {
    const NSID: &'static str = "sh.tangled.pipeline";
    type Record = PipelineRecord;
}

impl<'a> LexiconSchema for Pipeline<'a> {
    fn nsid() -> &'static str {
        "sh.tangled.pipeline"
    }
    fn def_name() -> &'static str {
        "main"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_sh_tangled_pipeline()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<'a> LexiconSchema for ManualTriggerData<'a> {
    fn nsid() -> &'static str {
        "sh.tangled.pipeline"
    }
    fn def_name() -> &'static str {
        "manualTriggerData"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_sh_tangled_pipeline()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<'a> LexiconSchema for Pair<'a> {
    fn nsid() -> &'static str {
        "sh.tangled.pipeline"
    }
    fn def_name() -> &'static str {
        "pair"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_sh_tangled_pipeline()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<'a> LexiconSchema for PullRequestTriggerData<'a> {
    fn nsid() -> &'static str {
        "sh.tangled.pipeline"
    }
    fn def_name() -> &'static str {
        "pullRequestTriggerData"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_sh_tangled_pipeline()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        {
            let value = &self.source_sha;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 40usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("source_sha"),
                    max: 40usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            let value = &self.source_sha;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) < 40usize {
                return Err(ConstraintError::MinLength {
                    path: ValidationPath::from_field("source_sha"),
                    min: 40usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        Ok(())
    }
}

impl<'a> LexiconSchema for PushTriggerData<'a> {
    fn nsid() -> &'static str {
        "sh.tangled.pipeline"
    }
    fn def_name() -> &'static str {
        "pushTriggerData"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_sh_tangled_pipeline()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        {
            let value = &self.new_sha;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 40usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("new_sha"),
                    max: 40usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            let value = &self.new_sha;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) < 40usize {
                return Err(ConstraintError::MinLength {
                    path: ValidationPath::from_field("new_sha"),
                    min: 40usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            let value = &self.old_sha;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 40usize {
                return Err(ConstraintError::MaxLength {
                    path: ValidationPath::from_field("old_sha"),
                    max: 40usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            let value = &self.old_sha;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) < 40usize {
                return Err(ConstraintError::MinLength {
                    path: ValidationPath::from_field("old_sha"),
                    min: 40usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        Ok(())
    }
}

impl<'a> LexiconSchema for TriggerMetadata<'a> {
    fn nsid() -> &'static str {
        "sh.tangled.pipeline"
    }
    fn def_name() -> &'static str {
        "triggerMetadata"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_sh_tangled_pipeline()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<'a> LexiconSchema for TriggerRepo<'a> {
    fn nsid() -> &'static str {
        "sh.tangled.pipeline"
    }
    fn def_name() -> &'static str {
        "triggerRepo"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_sh_tangled_pipeline()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<'a> LexiconSchema for Workflow<'a> {
    fn nsid() -> &'static str {
        "sh.tangled.pipeline"
    }
    fn def_name() -> &'static str {
        "workflow"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_sh_tangled_pipeline()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

pub mod clone_opts_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 Skip;
        type Depth;
        type Submodules;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Skip = Unset;
        type Depth = Unset;
        type Submodules = Unset;
    }
    ///State transition - sets the `skip` field to Set
    pub struct SetSkip<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetSkip<S> {}
    impl<S: State> State for SetSkip<S> {
        type Skip = Set<members::skip>;
        type Depth = S::Depth;
        type Submodules = S::Submodules;
    }
    ///State transition - sets the `depth` field to Set
    pub struct SetDepth<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetDepth<S> {}
    impl<S: State> State for SetDepth<S> {
        type Skip = S::Skip;
        type Depth = Set<members::depth>;
        type Submodules = S::Submodules;
    }
    ///State transition - sets the `submodules` field to Set
    pub struct SetSubmodules<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetSubmodules<S> {}
    impl<S: State> State for SetSubmodules<S> {
        type Skip = S::Skip;
        type Depth = S::Depth;
        type Submodules = Set<members::submodules>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `skip` field
        pub struct skip(());
        ///Marker type for the `depth` field
        pub struct depth(());
        ///Marker type for the `submodules` field
        pub struct submodules(());
    }
}

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

impl<'a> CloneOpts<'a> {
    /// Create a new builder for this type
    pub fn new() -> CloneOptsBuilder<'a, clone_opts_state::Empty> {
        CloneOptsBuilder::new()
    }
}

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

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

impl<'a, S> CloneOptsBuilder<'a, S>
where
    S: clone_opts_state::State,
    S::Skip: clone_opts_state::IsUnset,
{
    /// Set the `skip` field (required)
    pub fn skip(
        mut self,
        value: impl Into<bool>,
    ) -> CloneOptsBuilder<'a, clone_opts_state::SetSkip<S>> {
        self._fields.1 = Option::Some(value.into());
        CloneOptsBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> CloneOptsBuilder<'a, S>
where
    S: clone_opts_state::State,
    S::Submodules: clone_opts_state::IsUnset,
{
    /// Set the `submodules` field (required)
    pub fn submodules(
        mut self,
        value: impl Into<bool>,
    ) -> CloneOptsBuilder<'a, clone_opts_state::SetSubmodules<S>> {
        self._fields.2 = Option::Some(value.into());
        CloneOptsBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> CloneOptsBuilder<'a, S>
where
    S: clone_opts_state::State,
    S::Skip: clone_opts_state::IsSet,
    S::Depth: clone_opts_state::IsSet,
    S::Submodules: clone_opts_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> CloneOpts<'a> {
        CloneOpts {
            depth: self._fields.0.unwrap(),
            skip: self._fields.1.unwrap(),
            submodules: 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,
            jacquard_common::types::value::Data<'a>,
        >,
    ) -> CloneOpts<'a> {
        CloneOpts {
            depth: self._fields.0.unwrap(),
            skip: self._fields.1.unwrap(),
            submodules: self._fields.2.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

fn lexicon_doc_sh_tangled_pipeline() -> 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("sh.tangled.pipeline"),
        defs: {
            let mut map = BTreeMap::new();
            map.insert(
                SmolStr::new_static("cloneOpts"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![
                            SmolStr::new_static("skip"), SmolStr::new_static("depth"),
                            SmolStr::new_static("submodules")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("depth"),
                            LexObjectProperty::Integer(LexInteger {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("skip"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("submodules"),
                            LexObjectProperty::Boolean(LexBoolean {
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("main"),
                LexUserType::Record(LexRecord {
                    key: Some(CowStr::new_static("tid")),
                    record: LexRecordRecord::Object(LexObject {
                        required: Some(
                            vec![
                                SmolStr::new_static("triggerMetadata"),
                                SmolStr::new_static("workflows")
                            ],
                        ),
                        properties: {
                            #[allow(unused_mut)]
                            let mut map = BTreeMap::new();
                            map.insert(
                                SmolStr::new_static("triggerMetadata"),
                                LexObjectProperty::Ref(LexRef {
                                    r#ref: CowStr::new_static("#triggerMetadata"),
                                    ..Default::default()
                                }),
                            );
                            map.insert(
                                SmolStr::new_static("workflows"),
                                LexObjectProperty::Array(LexArray {
                                    items: LexArrayItem::Ref(LexRef {
                                        r#ref: CowStr::new_static("#workflow"),
                                        ..Default::default()
                                    }),
                                    ..Default::default()
                                }),
                            );
                            map
                        },
                        ..Default::default()
                    }),
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("manualTriggerData"),
                LexUserType::Object(LexObject {
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("inputs"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static("#pair"),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("pair"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![SmolStr::new_static("key"), SmolStr::new_static("value")],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("key"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("value"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("pullRequestTriggerData"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![
                            SmolStr::new_static("sourceBranch"),
                            SmolStr::new_static("targetBranch"),
                            SmolStr::new_static("sourceSha"),
                            SmolStr::new_static("action")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("action"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("sourceBranch"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("sourceSha"),
                            LexObjectProperty::String(LexString {
                                min_length: Some(40usize),
                                max_length: Some(40usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("targetBranch"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("pushTriggerData"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![
                            SmolStr::new_static("ref"), SmolStr::new_static("newSha"),
                            SmolStr::new_static("oldSha")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("newSha"),
                            LexObjectProperty::String(LexString {
                                min_length: Some(40usize),
                                max_length: Some(40usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("oldSha"),
                            LexObjectProperty::String(LexString {
                                min_length: Some(40usize),
                                max_length: Some(40usize),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("ref"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("triggerMetadata"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![SmolStr::new_static("kind"), SmolStr::new_static("repo")],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("kind"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("manual"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#manualTriggerData"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("pullRequest"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#pullRequestTriggerData"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("push"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#pushTriggerData"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("repo"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#triggerRepo"),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("triggerRepo"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![
                            SmolStr::new_static("knot"), SmolStr::new_static("did"),
                            SmolStr::new_static("repo"),
                            SmolStr::new_static("defaultBranch")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("defaultBranch"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("did"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Did),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("knot"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("repo"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("workflow"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![
                            SmolStr::new_static("name"), SmolStr::new_static("engine"),
                            SmolStr::new_static("clone"), SmolStr::new_static("raw")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("clone"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#cloneOpts"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("engine"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("name"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("raw"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map
        },
        ..Default::default()
    }
}

pub mod pipeline_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 Workflows;
        type TriggerMetadata;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Workflows = Unset;
        type TriggerMetadata = Unset;
    }
    ///State transition - sets the `workflows` field to Set
    pub struct SetWorkflows<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetWorkflows<S> {}
    impl<S: State> State for SetWorkflows<S> {
        type Workflows = Set<members::workflows>;
        type TriggerMetadata = S::TriggerMetadata;
    }
    ///State transition - sets the `trigger_metadata` field to Set
    pub struct SetTriggerMetadata<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetTriggerMetadata<S> {}
    impl<S: State> State for SetTriggerMetadata<S> {
        type Workflows = S::Workflows;
        type TriggerMetadata = Set<members::trigger_metadata>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `workflows` field
        pub struct workflows(());
        ///Marker type for the `trigger_metadata` field
        pub struct trigger_metadata(());
    }
}

/// Builder for constructing an instance of this type
pub struct PipelineBuilder<'a, S: pipeline_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (
        Option<pipeline::TriggerMetadata<'a>>,
        Option<Vec<pipeline::Workflow<'a>>>,
    ),
    _lifetime: PhantomData<&'a ()>,
}

impl<'a> Pipeline<'a> {
    /// Create a new builder for this type
    pub fn new() -> PipelineBuilder<'a, pipeline_state::Empty> {
        PipelineBuilder::new()
    }
}

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

impl<'a, S> PipelineBuilder<'a, S>
where
    S: pipeline_state::State,
    S::TriggerMetadata: pipeline_state::IsUnset,
{
    /// Set the `triggerMetadata` field (required)
    pub fn trigger_metadata(
        mut self,
        value: impl Into<pipeline::TriggerMetadata<'a>>,
    ) -> PipelineBuilder<'a, pipeline_state::SetTriggerMetadata<S>> {
        self._fields.0 = Option::Some(value.into());
        PipelineBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> PipelineBuilder<'a, S>
where
    S: pipeline_state::State,
    S::Workflows: pipeline_state::IsUnset,
{
    /// Set the `workflows` field (required)
    pub fn workflows(
        mut self,
        value: impl Into<Vec<pipeline::Workflow<'a>>>,
    ) -> PipelineBuilder<'a, pipeline_state::SetWorkflows<S>> {
        self._fields.1 = Option::Some(value.into());
        PipelineBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> PipelineBuilder<'a, S>
where
    S: pipeline_state::State,
    S::Workflows: pipeline_state::IsSet,
    S::TriggerMetadata: pipeline_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> Pipeline<'a> {
        Pipeline {
            trigger_metadata: self._fields.0.unwrap(),
            workflows: 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,
            jacquard_common::types::value::Data<'a>,
        >,
    ) -> Pipeline<'a> {
        Pipeline {
            trigger_metadata: self._fields.0.unwrap(),
            workflows: self._fields.1.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod trigger_metadata_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 Kind;
        type Repo;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Kind = Unset;
        type Repo = Unset;
    }
    ///State transition - sets the `kind` field to Set
    pub struct SetKind<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetKind<S> {}
    impl<S: State> State for SetKind<S> {
        type Kind = Set<members::kind>;
        type Repo = S::Repo;
    }
    ///State transition - sets the `repo` field to Set
    pub struct SetRepo<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetRepo<S> {}
    impl<S: State> State for SetRepo<S> {
        type Kind = S::Kind;
        type Repo = Set<members::repo>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `kind` field
        pub struct kind(());
        ///Marker type for the `repo` field
        pub struct repo(());
    }
}

/// Builder for constructing an instance of this type
pub struct TriggerMetadataBuilder<'a, S: trigger_metadata_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (
        Option<CowStr<'a>>,
        Option<pipeline::ManualTriggerData<'a>>,
        Option<pipeline::PullRequestTriggerData<'a>>,
        Option<pipeline::PushTriggerData<'a>>,
        Option<pipeline::TriggerRepo<'a>>,
    ),
    _lifetime: PhantomData<&'a ()>,
}

impl<'a> TriggerMetadata<'a> {
    /// Create a new builder for this type
    pub fn new() -> TriggerMetadataBuilder<'a, trigger_metadata_state::Empty> {
        TriggerMetadataBuilder::new()
    }
}

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

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

impl<'a, S: trigger_metadata_state::State> TriggerMetadataBuilder<'a, S> {
    /// Set the `manual` field (optional)
    pub fn manual(
        mut self,
        value: impl Into<Option<pipeline::ManualTriggerData<'a>>>,
    ) -> Self {
        self._fields.1 = value.into();
        self
    }
    /// Set the `manual` field to an Option value (optional)
    pub fn maybe_manual(
        mut self,
        value: Option<pipeline::ManualTriggerData<'a>>,
    ) -> Self {
        self._fields.1 = value;
        self
    }
}

impl<'a, S: trigger_metadata_state::State> TriggerMetadataBuilder<'a, S> {
    /// Set the `pullRequest` field (optional)
    pub fn pull_request(
        mut self,
        value: impl Into<Option<pipeline::PullRequestTriggerData<'a>>>,
    ) -> Self {
        self._fields.2 = value.into();
        self
    }
    /// Set the `pullRequest` field to an Option value (optional)
    pub fn maybe_pull_request(
        mut self,
        value: Option<pipeline::PullRequestTriggerData<'a>>,
    ) -> Self {
        self._fields.2 = value;
        self
    }
}

impl<'a, S: trigger_metadata_state::State> TriggerMetadataBuilder<'a, S> {
    /// Set the `push` field (optional)
    pub fn push(
        mut self,
        value: impl Into<Option<pipeline::PushTriggerData<'a>>>,
    ) -> Self {
        self._fields.3 = value.into();
        self
    }
    /// Set the `push` field to an Option value (optional)
    pub fn maybe_push(mut self, value: Option<pipeline::PushTriggerData<'a>>) -> Self {
        self._fields.3 = value;
        self
    }
}

impl<'a, S> TriggerMetadataBuilder<'a, S>
where
    S: trigger_metadata_state::State,
    S::Repo: trigger_metadata_state::IsUnset,
{
    /// Set the `repo` field (required)
    pub fn repo(
        mut self,
        value: impl Into<pipeline::TriggerRepo<'a>>,
    ) -> TriggerMetadataBuilder<'a, trigger_metadata_state::SetRepo<S>> {
        self._fields.4 = Option::Some(value.into());
        TriggerMetadataBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> TriggerMetadataBuilder<'a, S>
where
    S: trigger_metadata_state::State,
    S::Kind: trigger_metadata_state::IsSet,
    S::Repo: trigger_metadata_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> TriggerMetadata<'a> {
        TriggerMetadata {
            kind: self._fields.0.unwrap(),
            manual: self._fields.1,
            pull_request: self._fields.2,
            push: self._fields.3,
            repo: 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,
            jacquard_common::types::value::Data<'a>,
        >,
    ) -> TriggerMetadata<'a> {
        TriggerMetadata {
            kind: self._fields.0.unwrap(),
            manual: self._fields.1,
            pull_request: self._fields.2,
            push: self._fields.3,
            repo: self._fields.4.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod trigger_repo_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 DefaultBranch;
        type Knot;
        type Repo;
        type Did;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type DefaultBranch = Unset;
        type Knot = Unset;
        type Repo = Unset;
        type Did = Unset;
    }
    ///State transition - sets the `default_branch` field to Set
    pub struct SetDefaultBranch<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetDefaultBranch<S> {}
    impl<S: State> State for SetDefaultBranch<S> {
        type DefaultBranch = Set<members::default_branch>;
        type Knot = S::Knot;
        type Repo = S::Repo;
        type Did = S::Did;
    }
    ///State transition - sets the `knot` field to Set
    pub struct SetKnot<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetKnot<S> {}
    impl<S: State> State for SetKnot<S> {
        type DefaultBranch = S::DefaultBranch;
        type Knot = Set<members::knot>;
        type Repo = S::Repo;
        type Did = S::Did;
    }
    ///State transition - sets the `repo` field to Set
    pub struct SetRepo<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetRepo<S> {}
    impl<S: State> State for SetRepo<S> {
        type DefaultBranch = S::DefaultBranch;
        type Knot = S::Knot;
        type Repo = Set<members::repo>;
        type Did = S::Did;
    }
    ///State transition - sets the `did` field to Set
    pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetDid<S> {}
    impl<S: State> State for SetDid<S> {
        type DefaultBranch = S::DefaultBranch;
        type Knot = S::Knot;
        type Repo = S::Repo;
        type Did = Set<members::did>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `default_branch` field
        pub struct default_branch(());
        ///Marker type for the `knot` field
        pub struct knot(());
        ///Marker type for the `repo` field
        pub struct repo(());
        ///Marker type for the `did` field
        pub struct did(());
    }
}

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

impl<'a> TriggerRepo<'a> {
    /// Create a new builder for this type
    pub fn new() -> TriggerRepoBuilder<'a, trigger_repo_state::Empty> {
        TriggerRepoBuilder::new()
    }
}

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

impl<'a, S> TriggerRepoBuilder<'a, S>
where
    S: trigger_repo_state::State,
    S::DefaultBranch: trigger_repo_state::IsUnset,
{
    /// Set the `defaultBranch` field (required)
    pub fn default_branch(
        mut self,
        value: impl Into<CowStr<'a>>,
    ) -> TriggerRepoBuilder<'a, trigger_repo_state::SetDefaultBranch<S>> {
        self._fields.0 = Option::Some(value.into());
        TriggerRepoBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> TriggerRepoBuilder<'a, S>
where
    S: trigger_repo_state::State,
    S::Did: trigger_repo_state::IsUnset,
{
    /// Set the `did` field (required)
    pub fn did(
        mut self,
        value: impl Into<Did<'a>>,
    ) -> TriggerRepoBuilder<'a, trigger_repo_state::SetDid<S>> {
        self._fields.1 = Option::Some(value.into());
        TriggerRepoBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

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

impl<'a, S> TriggerRepoBuilder<'a, S>
where
    S: trigger_repo_state::State,
    S::Repo: trigger_repo_state::IsUnset,
{
    /// Set the `repo` field (required)
    pub fn repo(
        mut self,
        value: impl Into<CowStr<'a>>,
    ) -> TriggerRepoBuilder<'a, trigger_repo_state::SetRepo<S>> {
        self._fields.3 = Option::Some(value.into());
        TriggerRepoBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> TriggerRepoBuilder<'a, S>
where
    S: trigger_repo_state::State,
    S::DefaultBranch: trigger_repo_state::IsSet,
    S::Knot: trigger_repo_state::IsSet,
    S::Repo: trigger_repo_state::IsSet,
    S::Did: trigger_repo_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> TriggerRepo<'a> {
        TriggerRepo {
            default_branch: self._fields.0.unwrap(),
            did: self._fields.1.unwrap(),
            knot: self._fields.2.unwrap(),
            repo: self._fields.3.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,
            jacquard_common::types::value::Data<'a>,
        >,
    ) -> TriggerRepo<'a> {
        TriggerRepo {
            default_branch: self._fields.0.unwrap(),
            did: self._fields.1.unwrap(),
            knot: self._fields.2.unwrap(),
            repo: self._fields.3.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod workflow_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 Raw;
        type Engine;
        type Clone;
        type Name;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Raw = Unset;
        type Engine = Unset;
        type Clone = Unset;
        type Name = Unset;
    }
    ///State transition - sets the `raw` field to Set
    pub struct SetRaw<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetRaw<S> {}
    impl<S: State> State for SetRaw<S> {
        type Raw = Set<members::raw>;
        type Engine = S::Engine;
        type Clone = S::Clone;
        type Name = S::Name;
    }
    ///State transition - sets the `engine` field to Set
    pub struct SetEngine<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetEngine<S> {}
    impl<S: State> State for SetEngine<S> {
        type Raw = S::Raw;
        type Engine = Set<members::engine>;
        type Clone = S::Clone;
        type Name = S::Name;
    }
    ///State transition - sets the `clone` field to Set
    pub struct SetClone<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetClone<S> {}
    impl<S: State> State for SetClone<S> {
        type Raw = S::Raw;
        type Engine = S::Engine;
        type Clone = Set<members::clone>;
        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 Raw = S::Raw;
        type Engine = S::Engine;
        type Clone = S::Clone;
        type Name = Set<members::name>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `raw` field
        pub struct raw(());
        ///Marker type for the `engine` field
        pub struct engine(());
        ///Marker type for the `clone` field
        pub struct clone(());
        ///Marker type for the `name` field
        pub struct name(());
    }
}

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

impl<'a> Workflow<'a> {
    /// Create a new builder for this type
    pub fn new() -> WorkflowBuilder<'a, workflow_state::Empty> {
        WorkflowBuilder::new()
    }
}

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

impl<'a, S> WorkflowBuilder<'a, S>
where
    S: workflow_state::State,
    S::Clone: workflow_state::IsUnset,
{
    /// Set the `clone` field (required)
    pub fn clone(
        mut self,
        value: impl Into<pipeline::CloneOpts<'a>>,
    ) -> WorkflowBuilder<'a, workflow_state::SetClone<S>> {
        self._fields.0 = Option::Some(value.into());
        WorkflowBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> WorkflowBuilder<'a, S>
where
    S: workflow_state::State,
    S::Engine: workflow_state::IsUnset,
{
    /// Set the `engine` field (required)
    pub fn engine(
        mut self,
        value: impl Into<CowStr<'a>>,
    ) -> WorkflowBuilder<'a, workflow_state::SetEngine<S>> {
        self._fields.1 = Option::Some(value.into());
        WorkflowBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

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

impl<'a, S> WorkflowBuilder<'a, S>
where
    S: workflow_state::State,
    S::Raw: workflow_state::IsUnset,
{
    /// Set the `raw` field (required)
    pub fn raw(
        mut self,
        value: impl Into<CowStr<'a>>,
    ) -> WorkflowBuilder<'a, workflow_state::SetRaw<S>> {
        self._fields.3 = Option::Some(value.into());
        WorkflowBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> WorkflowBuilder<'a, S>
where
    S: workflow_state::State,
    S::Raw: workflow_state::IsSet,
    S::Engine: workflow_state::IsSet,
    S::Clone: workflow_state::IsSet,
    S::Name: workflow_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> Workflow<'a> {
        Workflow {
            clone: self._fields.0.unwrap(),
            engine: self._fields.1.unwrap(),
            name: self._fields.2.unwrap(),
            raw: self._fields.3.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,
            jacquard_common::types::value::Data<'a>,
        >,
    ) -> Workflow<'a> {
        Workflow {
            clone: self._fields.0.unwrap(),
            engine: self._fields.1.unwrap(),
            name: self._fields.2.unwrap(),
            raw: self._fields.3.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}