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

//! Generated bindings for the `sh.tangled.git.temp` Lexicon namespace/module.
pub mod analyze_merge;
pub mod get_archive;
pub mod get_blob;
pub mod get_branch;
pub mod get_commit;
pub mod get_diff;
pub mod get_entity;
pub mod get_entry;
pub mod get_head;
pub mod get_tag;
pub mod get_tree;
pub mod list_branches;
pub mod list_commits;
pub mod list_languages;
pub mod list_tags;


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

#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr};

#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::deps::smol_str::SmolStr;
use jacquard_common::types::string::Datetime;
use jacquard_common::types::value::Data;
use jacquard_derive::IntoStatic;
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::git::temp;

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct Branch<S: BosStr = DefaultStr> {
    ///hydrated commit object
    pub commit: temp::Commit<S>,
    ///branch name
    pub name: S,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}


#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct Commit<S: BosStr = DefaultStr> {
    pub author: temp::Signature<S>,
    pub committer: temp::Signature<S>,
    pub hash: temp::Hash<S>,
    pub message: S,
    pub tree: temp::Hash<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

pub type Hash<S = DefaultStr> = S;

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct Signature<S: BosStr = DefaultStr> {
    ///Person email
    pub email: S,
    ///Person name
    pub name: S,
    ///Timestamp of the signature
    pub when: Datetime,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}


#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct Submodule<S: BosStr = DefaultStr> {
    ///Branch to track in the submodule
    #[serde(skip_serializing_if = "Option::is_none")]
    pub branch: Option<S>,
    ///Submodule name
    pub name: S,
    ///Submodule repository URL
    pub url: S,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}


#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct Tag<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub message: Option<S>,
    ///tag name
    pub name: S,
    pub tagger: temp::Signature<S>,
    pub target: Data<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}

impl<S: BosStr> LexiconSchema for Branch<S> {
    fn nsid() -> &'static str {
        "sh.tangled.git.temp.defs"
    }
    fn def_name() -> &'static str {
        "branch"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_sh_tangled_git_temp_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for Commit<S> {
    fn nsid() -> &'static str {
        "sh.tangled.git.temp.defs"
    }
    fn def_name() -> &'static str {
        "commit"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_sh_tangled_git_temp_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for Signature<S> {
    fn nsid() -> &'static str {
        "sh.tangled.git.temp.defs"
    }
    fn def_name() -> &'static str {
        "signature"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_sh_tangled_git_temp_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for Submodule<S> {
    fn nsid() -> &'static str {
        "sh.tangled.git.temp.defs"
    }
    fn def_name() -> &'static str {
        "submodule"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_sh_tangled_git_temp_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

impl<S: BosStr> LexiconSchema for Tag<S> {
    fn nsid() -> &'static str {
        "sh.tangled.git.temp.defs"
    }
    fn def_name() -> &'static str {
        "tag"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_sh_tangled_git_temp_defs()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

pub mod branch_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 Commit;
        type Name;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Commit = Unset;
        type Name = Unset;
    }
    ///State transition - sets the `commit` field to Set
    pub struct SetCommit<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetCommit<St> {}
    impl<St: State> State for SetCommit<St> {
        type Commit = Set<members::commit>;
        type Name = St::Name;
    }
    ///State transition - sets the `name` field to Set
    pub struct SetName<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetName<St> {}
    impl<St: State> State for SetName<St> {
        type Commit = St::Commit;
        type Name = Set<members::name>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `commit` field
        pub struct commit(());
        ///Marker type for the `name` field
        pub struct name(());
    }
}

/// Builder for constructing an instance of this type.
pub struct BranchBuilder<St: branch_state::State, S: BosStr = DefaultStr> {
    _state: PhantomData<fn() -> St>,
    _fields: (Option<temp::Commit<S>>, Option<S>),
    _type: PhantomData<fn() -> S>,
}

impl Branch<DefaultStr> {
    /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed
    pub fn new() -> BranchBuilder<branch_state::Empty, DefaultStr> {
        BranchBuilder::new()
    }
}

impl<S: BosStr> Branch<S> {
    /// Create a new builder for this type
    pub fn builder() -> BranchBuilder<branch_state::Empty, S> {
        BranchBuilder::builder()
    }
}

impl BranchBuilder<branch_state::Empty, DefaultStr> {
    /// Create a new builder with all fields unset, using the default string type, if needed
    pub fn new() -> Self {
        BranchBuilder {
            _state: PhantomData,
            _fields: (None, None),
            _type: PhantomData,
        }
    }
}

impl<S: BosStr> BranchBuilder<branch_state::Empty, S> {
    /// Create a new builder with all fields unset
    pub fn builder() -> Self {
        BranchBuilder {
            _state: PhantomData,
            _fields: (None, None),
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> BranchBuilder<St, S>
where
    St: branch_state::State,
    St::Commit: branch_state::IsUnset,
{
    /// Set the `commit` field (required)
    pub fn commit(
        mut self,
        value: impl Into<temp::Commit<S>>,
    ) -> BranchBuilder<branch_state::SetCommit<St>, S> {
        self._fields.0 = Option::Some(value.into());
        BranchBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> BranchBuilder<St, S>
where
    St: branch_state::State,
    St::Name: branch_state::IsUnset,
{
    /// Set the `name` field (required)
    pub fn name(
        mut self,
        value: impl Into<S>,
    ) -> BranchBuilder<branch_state::SetName<St>, S> {
        self._fields.1 = Option::Some(value.into());
        BranchBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> BranchBuilder<St, S>
where
    St: branch_state::State,
    St::Commit: branch_state::IsSet,
    St::Name: branch_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> Branch<S> {
        Branch {
            commit: self._fields.0.unwrap(),
            name: 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<SmolStr, Data<S>>) -> Branch<S> {
        Branch {
            commit: self._fields.0.unwrap(),
            name: self._fields.1.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

fn lexicon_doc_sh_tangled_git_temp_defs() -> 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.git.temp.defs"),
        defs: {
            let mut map = BTreeMap::new();
            map.insert(
                SmolStr::new_static("branch"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![SmolStr::new_static("name"), SmolStr::new_static("commit")],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("commit"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#commit"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("name"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("branch name")),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("commit"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![
                            SmolStr::new_static("hash"), SmolStr::new_static("author"),
                            SmolStr::new_static("committer"),
                            SmolStr::new_static("message"), SmolStr::new_static("tree")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("author"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#signature"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("committer"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#signature"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("hash"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#hash"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("message"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("tree"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#hash"),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("hash"),
                LexUserType::String(LexString { ..Default::default() }),
            );
            map.insert(
                SmolStr::new_static("signature"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![
                            SmolStr::new_static("name"), SmolStr::new_static("email"),
                            SmolStr::new_static("when")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("email"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("Person email")),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("name"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("Person name")),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("when"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Timestamp of the signature"),
                                ),
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("submodule"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![SmolStr::new_static("name"), SmolStr::new_static("url")],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("branch"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Branch to track in the submodule"),
                                ),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("name"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("Submodule name")),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("url"),
                            LexObjectProperty::String(LexString {
                                description: Some(
                                    CowStr::new_static("Submodule repository URL"),
                                ),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("tag"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![
                            SmolStr::new_static("name"), SmolStr::new_static("tagger"),
                            SmolStr::new_static("target")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("message"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("name"),
                            LexObjectProperty::String(LexString {
                                description: Some(CowStr::new_static("tag name")),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("tagger"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#signature"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("target"),
                            LexObjectProperty::Unknown(LexUnknown {
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map
        },
        ..Default::default()
    }
}

pub mod commit_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 Author;
        type Committer;
        type Hash;
        type Message;
        type Tree;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Author = Unset;
        type Committer = Unset;
        type Hash = Unset;
        type Message = Unset;
        type Tree = Unset;
    }
    ///State transition - sets the `author` field to Set
    pub struct SetAuthor<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetAuthor<St> {}
    impl<St: State> State for SetAuthor<St> {
        type Author = Set<members::author>;
        type Committer = St::Committer;
        type Hash = St::Hash;
        type Message = St::Message;
        type Tree = St::Tree;
    }
    ///State transition - sets the `committer` field to Set
    pub struct SetCommitter<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetCommitter<St> {}
    impl<St: State> State for SetCommitter<St> {
        type Author = St::Author;
        type Committer = Set<members::committer>;
        type Hash = St::Hash;
        type Message = St::Message;
        type Tree = St::Tree;
    }
    ///State transition - sets the `hash` field to Set
    pub struct SetHash<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetHash<St> {}
    impl<St: State> State for SetHash<St> {
        type Author = St::Author;
        type Committer = St::Committer;
        type Hash = Set<members::hash>;
        type Message = St::Message;
        type Tree = St::Tree;
    }
    ///State transition - sets the `message` field to Set
    pub struct SetMessage<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetMessage<St> {}
    impl<St: State> State for SetMessage<St> {
        type Author = St::Author;
        type Committer = St::Committer;
        type Hash = St::Hash;
        type Message = Set<members::message>;
        type Tree = St::Tree;
    }
    ///State transition - sets the `tree` field to Set
    pub struct SetTree<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetTree<St> {}
    impl<St: State> State for SetTree<St> {
        type Author = St::Author;
        type Committer = St::Committer;
        type Hash = St::Hash;
        type Message = St::Message;
        type Tree = Set<members::tree>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `author` field
        pub struct author(());
        ///Marker type for the `committer` field
        pub struct committer(());
        ///Marker type for the `hash` field
        pub struct hash(());
        ///Marker type for the `message` field
        pub struct message(());
        ///Marker type for the `tree` field
        pub struct tree(());
    }
}

/// Builder for constructing an instance of this type.
pub struct CommitBuilder<St: commit_state::State, S: BosStr = DefaultStr> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<temp::Signature<S>>,
        Option<temp::Signature<S>>,
        Option<temp::Hash<S>>,
        Option<S>,
        Option<temp::Hash<S>>,
    ),
    _type: PhantomData<fn() -> S>,
}

impl Commit<DefaultStr> {
    /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed
    pub fn new() -> CommitBuilder<commit_state::Empty, DefaultStr> {
        CommitBuilder::new()
    }
}

impl<S: BosStr> Commit<S> {
    /// Create a new builder for this type
    pub fn builder() -> CommitBuilder<commit_state::Empty, S> {
        CommitBuilder::builder()
    }
}

impl CommitBuilder<commit_state::Empty, DefaultStr> {
    /// Create a new builder with all fields unset, using the default string type, if needed
    pub fn new() -> Self {
        CommitBuilder {
            _state: PhantomData,
            _fields: (None, None, None, None, None),
            _type: PhantomData,
        }
    }
}

impl<S: BosStr> CommitBuilder<commit_state::Empty, S> {
    /// Create a new builder with all fields unset
    pub fn builder() -> Self {
        CommitBuilder {
            _state: PhantomData,
            _fields: (None, None, None, None, None),
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> CommitBuilder<St, S>
where
    St: commit_state::State,
    St::Author: commit_state::IsUnset,
{
    /// Set the `author` field (required)
    pub fn author(
        mut self,
        value: impl Into<temp::Signature<S>>,
    ) -> CommitBuilder<commit_state::SetAuthor<St>, S> {
        self._fields.0 = Option::Some(value.into());
        CommitBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> CommitBuilder<St, S>
where
    St: commit_state::State,
    St::Committer: commit_state::IsUnset,
{
    /// Set the `committer` field (required)
    pub fn committer(
        mut self,
        value: impl Into<temp::Signature<S>>,
    ) -> CommitBuilder<commit_state::SetCommitter<St>, S> {
        self._fields.1 = Option::Some(value.into());
        CommitBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> CommitBuilder<St, S>
where
    St: commit_state::State,
    St::Hash: commit_state::IsUnset,
{
    /// Set the `hash` field (required)
    pub fn hash(
        mut self,
        value: impl Into<temp::Hash<S>>,
    ) -> CommitBuilder<commit_state::SetHash<St>, S> {
        self._fields.2 = Option::Some(value.into());
        CommitBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> CommitBuilder<St, S>
where
    St: commit_state::State,
    St::Message: commit_state::IsUnset,
{
    /// Set the `message` field (required)
    pub fn message(
        mut self,
        value: impl Into<S>,
    ) -> CommitBuilder<commit_state::SetMessage<St>, S> {
        self._fields.3 = Option::Some(value.into());
        CommitBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> CommitBuilder<St, S>
where
    St: commit_state::State,
    St::Tree: commit_state::IsUnset,
{
    /// Set the `tree` field (required)
    pub fn tree(
        mut self,
        value: impl Into<temp::Hash<S>>,
    ) -> CommitBuilder<commit_state::SetTree<St>, S> {
        self._fields.4 = Option::Some(value.into());
        CommitBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> CommitBuilder<St, S>
where
    St: commit_state::State,
    St::Author: commit_state::IsSet,
    St::Committer: commit_state::IsSet,
    St::Hash: commit_state::IsSet,
    St::Message: commit_state::IsSet,
    St::Tree: commit_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> Commit<S> {
        Commit {
            author: self._fields.0.unwrap(),
            committer: self._fields.1.unwrap(),
            hash: self._fields.2.unwrap(),
            message: self._fields.3.unwrap(),
            tree: 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<SmolStr, Data<S>>) -> Commit<S> {
        Commit {
            author: self._fields.0.unwrap(),
            committer: self._fields.1.unwrap(),
            hash: self._fields.2.unwrap(),
            message: self._fields.3.unwrap(),
            tree: self._fields.4.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod signature_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 Email;
        type Name;
        type When;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Email = Unset;
        type Name = Unset;
        type When = Unset;
    }
    ///State transition - sets the `email` field to Set
    pub struct SetEmail<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetEmail<St> {}
    impl<St: State> State for SetEmail<St> {
        type Email = Set<members::email>;
        type Name = St::Name;
        type When = St::When;
    }
    ///State transition - sets the `name` field to Set
    pub struct SetName<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetName<St> {}
    impl<St: State> State for SetName<St> {
        type Email = St::Email;
        type Name = Set<members::name>;
        type When = St::When;
    }
    ///State transition - sets the `when` field to Set
    pub struct SetWhen<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetWhen<St> {}
    impl<St: State> State for SetWhen<St> {
        type Email = St::Email;
        type Name = St::Name;
        type When = Set<members::when>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `email` field
        pub struct email(());
        ///Marker type for the `name` field
        pub struct name(());
        ///Marker type for the `when` field
        pub struct when(());
    }
}

/// Builder for constructing an instance of this type.
pub struct SignatureBuilder<St: signature_state::State, S: BosStr = DefaultStr> {
    _state: PhantomData<fn() -> St>,
    _fields: (Option<S>, Option<S>, Option<Datetime>),
    _type: PhantomData<fn() -> S>,
}

impl Signature<DefaultStr> {
    /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed
    pub fn new() -> SignatureBuilder<signature_state::Empty, DefaultStr> {
        SignatureBuilder::new()
    }
}

impl<S: BosStr> Signature<S> {
    /// Create a new builder for this type
    pub fn builder() -> SignatureBuilder<signature_state::Empty, S> {
        SignatureBuilder::builder()
    }
}

impl SignatureBuilder<signature_state::Empty, DefaultStr> {
    /// Create a new builder with all fields unset, using the default string type, if needed
    pub fn new() -> Self {
        SignatureBuilder {
            _state: PhantomData,
            _fields: (None, None, None),
            _type: PhantomData,
        }
    }
}

impl<S: BosStr> SignatureBuilder<signature_state::Empty, S> {
    /// Create a new builder with all fields unset
    pub fn builder() -> Self {
        SignatureBuilder {
            _state: PhantomData,
            _fields: (None, None, None),
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> SignatureBuilder<St, S>
where
    St: signature_state::State,
    St::Email: signature_state::IsUnset,
{
    /// Set the `email` field (required)
    pub fn email(
        mut self,
        value: impl Into<S>,
    ) -> SignatureBuilder<signature_state::SetEmail<St>, S> {
        self._fields.0 = Option::Some(value.into());
        SignatureBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> SignatureBuilder<St, S>
where
    St: signature_state::State,
    St::Name: signature_state::IsUnset,
{
    /// Set the `name` field (required)
    pub fn name(
        mut self,
        value: impl Into<S>,
    ) -> SignatureBuilder<signature_state::SetName<St>, S> {
        self._fields.1 = Option::Some(value.into());
        SignatureBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> SignatureBuilder<St, S>
where
    St: signature_state::State,
    St::When: signature_state::IsUnset,
{
    /// Set the `when` field (required)
    pub fn when(
        mut self,
        value: impl Into<Datetime>,
    ) -> SignatureBuilder<signature_state::SetWhen<St>, S> {
        self._fields.2 = Option::Some(value.into());
        SignatureBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> SignatureBuilder<St, S>
where
    St: signature_state::State,
    St::Email: signature_state::IsSet,
    St::Name: signature_state::IsSet,
    St::When: signature_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> Signature<S> {
        Signature {
            email: self._fields.0.unwrap(),
            name: self._fields.1.unwrap(),
            when: 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<SmolStr, Data<S>>,
    ) -> Signature<S> {
        Signature {
            email: self._fields.0.unwrap(),
            name: self._fields.1.unwrap(),
            when: self._fields.2.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

pub mod tag_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 Tagger;
        type Target;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Name = Unset;
        type Tagger = Unset;
        type Target = Unset;
    }
    ///State transition - sets the `name` field to Set
    pub struct SetName<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetName<St> {}
    impl<St: State> State for SetName<St> {
        type Name = Set<members::name>;
        type Tagger = St::Tagger;
        type Target = St::Target;
    }
    ///State transition - sets the `tagger` field to Set
    pub struct SetTagger<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetTagger<St> {}
    impl<St: State> State for SetTagger<St> {
        type Name = St::Name;
        type Tagger = Set<members::tagger>;
        type Target = St::Target;
    }
    ///State transition - sets the `target` field to Set
    pub struct SetTarget<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetTarget<St> {}
    impl<St: State> State for SetTarget<St> {
        type Name = St::Name;
        type Tagger = St::Tagger;
        type Target = Set<members::target>;
    }
    /// 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 `tagger` field
        pub struct tagger(());
        ///Marker type for the `target` field
        pub struct target(());
    }
}

/// Builder for constructing an instance of this type.
pub struct TagBuilder<St: tag_state::State, S: BosStr = DefaultStr> {
    _state: PhantomData<fn() -> St>,
    _fields: (Option<S>, Option<S>, Option<temp::Signature<S>>, Option<Data<S>>),
    _type: PhantomData<fn() -> S>,
}

impl Tag<DefaultStr> {
    /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed
    pub fn new() -> TagBuilder<tag_state::Empty, DefaultStr> {
        TagBuilder::new()
    }
}

impl<S: BosStr> Tag<S> {
    /// Create a new builder for this type
    pub fn builder() -> TagBuilder<tag_state::Empty, S> {
        TagBuilder::builder()
    }
}

impl TagBuilder<tag_state::Empty, DefaultStr> {
    /// Create a new builder with all fields unset, using the default string type, if needed
    pub fn new() -> Self {
        TagBuilder {
            _state: PhantomData,
            _fields: (None, None, None, None),
            _type: PhantomData,
        }
    }
}

impl<S: BosStr> TagBuilder<tag_state::Empty, S> {
    /// Create a new builder with all fields unset
    pub fn builder() -> Self {
        TagBuilder {
            _state: PhantomData,
            _fields: (None, None, None, None),
            _type: PhantomData,
        }
    }
}

impl<St: tag_state::State, S: BosStr> TagBuilder<St, S> {
    /// Set the `message` field (optional)
    pub fn message(mut self, value: impl Into<Option<S>>) -> Self {
        self._fields.0 = value.into();
        self
    }
    /// Set the `message` field to an Option value (optional)
    pub fn maybe_message(mut self, value: Option<S>) -> Self {
        self._fields.0 = value;
        self
    }
}

impl<St, S: BosStr> TagBuilder<St, S>
where
    St: tag_state::State,
    St::Name: tag_state::IsUnset,
{
    /// Set the `name` field (required)
    pub fn name(mut self, value: impl Into<S>) -> TagBuilder<tag_state::SetName<St>, S> {
        self._fields.1 = Option::Some(value.into());
        TagBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> TagBuilder<St, S>
where
    St: tag_state::State,
    St::Tagger: tag_state::IsUnset,
{
    /// Set the `tagger` field (required)
    pub fn tagger(
        mut self,
        value: impl Into<temp::Signature<S>>,
    ) -> TagBuilder<tag_state::SetTagger<St>, S> {
        self._fields.2 = Option::Some(value.into());
        TagBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> TagBuilder<St, S>
where
    St: tag_state::State,
    St::Target: tag_state::IsUnset,
{
    /// Set the `target` field (required)
    pub fn target(
        mut self,
        value: impl Into<Data<S>>,
    ) -> TagBuilder<tag_state::SetTarget<St>, S> {
        self._fields.3 = Option::Some(value.into());
        TagBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _type: PhantomData,
        }
    }
}

impl<St, S: BosStr> TagBuilder<St, S>
where
    St: tag_state::State,
    St::Name: tag_state::IsSet,
    St::Tagger: tag_state::IsSet,
    St::Target: tag_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> Tag<S> {
        Tag {
            message: self._fields.0,
            name: self._fields.1.unwrap(),
            tagger: self._fields.2.unwrap(),
            target: 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<SmolStr, Data<S>>) -> Tag<S> {
        Tag {
            message: self._fields.0,
            name: self._fields.1.unwrap(),
            tagger: self._fields.2.unwrap(),
            target: self._fields.3.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}