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

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

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

#[allow(unused_imports)]
use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
use jacquard_common::types::string::{Did, AtUri, Datetime};
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::games_gamesgamesgamesgames::GameSummaryView;
use crate::games_gamesgamesgamesgames::get_claim;

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ClaimView<'a> {
    #[serde(borrow)]
    pub cid: CowStr<'a>,
    #[serde(borrow)]
    pub claimant_did: Did<'a>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub contact: Option<CowStr<'a>>,
    pub created_at: Datetime,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub games: Option<Vec<GameSummaryView<'a>>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub message: Option<CowStr<'a>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub org: Option<AtUri<'a>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub review: Option<get_claim::ReviewView<'a>>,
    #[serde(borrow)]
    pub r#type: ClaimViewType<'a>,
    #[serde(borrow)]
    pub uri: AtUri<'a>,
}


#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ClaimViewType<'a> {
    Game,
    Org,
    Other(CowStr<'a>),
}

impl<'a> ClaimViewType<'a> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::Game => "game",
            Self::Org => "org",
            Self::Other(s) => s.as_ref(),
        }
    }
}

impl<'a> From<&'a str> for ClaimViewType<'a> {
    fn from(s: &'a str) -> Self {
        match s {
            "game" => Self::Game,
            "org" => Self::Org,
            _ => Self::Other(CowStr::from(s)),
        }
    }
}

impl<'a> From<String> for ClaimViewType<'a> {
    fn from(s: String) -> Self {
        match s.as_str() {
            "game" => Self::Game,
            "org" => Self::Org,
            _ => Self::Other(CowStr::from(s)),
        }
    }
}

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

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

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

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

impl<'a> Default for ClaimViewType<'a> {
    fn default() -> Self {
        Self::Other(Default::default())
    }
}

impl jacquard_common::IntoStatic for ClaimViewType<'_> {
    type Output = ClaimViewType<'static>;
    fn into_static(self) -> Self::Output {
        match self {
            ClaimViewType::Game => ClaimViewType::Game,
            ClaimViewType::Org => ClaimViewType::Org,
            ClaimViewType::Other(v) => ClaimViewType::Other(v.into_static()),
        }
    }
}


#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct GetClaim<'a> {
    #[serde(borrow)]
    pub uri: AtUri<'a>,
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct GetClaimOutput<'a> {
    #[serde(borrow)]
    pub claim: get_claim::ClaimView<'a>,
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct ReviewView<'a> {
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub approved_games: Option<Vec<AtUri<'a>>>,
    pub created_at: Datetime,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub reason: Option<CowStr<'a>>,
    #[serde(borrow)]
    pub reviewed_by: Did<'a>,
    #[serde(borrow)]
    pub status: ReviewViewStatus<'a>,
    #[serde(borrow)]
    pub uri: AtUri<'a>,
}


#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ReviewViewStatus<'a> {
    Approved,
    Denied,
    Other(CowStr<'a>),
}

impl<'a> ReviewViewStatus<'a> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::Approved => "approved",
            Self::Denied => "denied",
            Self::Other(s) => s.as_ref(),
        }
    }
}

impl<'a> From<&'a str> for ReviewViewStatus<'a> {
    fn from(s: &'a str) -> Self {
        match s {
            "approved" => Self::Approved,
            "denied" => Self::Denied,
            _ => Self::Other(CowStr::from(s)),
        }
    }
}

impl<'a> From<String> for ReviewViewStatus<'a> {
    fn from(s: String) -> Self {
        match s.as_str() {
            "approved" => Self::Approved,
            "denied" => Self::Denied,
            _ => Self::Other(CowStr::from(s)),
        }
    }
}

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

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

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

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

impl<'a> Default for ReviewViewStatus<'a> {
    fn default() -> Self {
        Self::Other(Default::default())
    }
}

impl jacquard_common::IntoStatic for ReviewViewStatus<'_> {
    type Output = ReviewViewStatus<'static>;
    fn into_static(self) -> Self::Output {
        match self {
            ReviewViewStatus::Approved => ReviewViewStatus::Approved,
            ReviewViewStatus::Denied => ReviewViewStatus::Denied,
            ReviewViewStatus::Other(v) => ReviewViewStatus::Other(v.into_static()),
        }
    }
}

impl<'a> LexiconSchema for ClaimView<'a> {
    fn nsid() -> &'static str {
        "games.gamesgamesgamesgames.getClaim"
    }
    fn def_name() -> &'static str {
        "claimView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_games_gamesgamesgamesgames_getClaim()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

/// Response type for games.gamesgamesgamesgames.getClaim
pub struct GetClaimResponse;
impl jacquard_common::xrpc::XrpcResp for GetClaimResponse {
    const NSID: &'static str = "games.gamesgamesgamesgames.getClaim";
    const ENCODING: &'static str = "application/json";
    type Output<'de> = GetClaimOutput<'de>;
    type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
}

impl<'a> jacquard_common::xrpc::XrpcRequest for GetClaim<'a> {
    const NSID: &'static str = "games.gamesgamesgamesgames.getClaim";
    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
    type Response = GetClaimResponse;
}

/// Endpoint type for games.gamesgamesgamesgames.getClaim
pub struct GetClaimRequest;
impl jacquard_common::xrpc::XrpcEndpoint for GetClaimRequest {
    const PATH: &'static str = "/xrpc/games.gamesgamesgamesgames.getClaim";
    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
    type Request<'de> = GetClaim<'de>;
    type Response = GetClaimResponse;
}

impl<'a> LexiconSchema for ReviewView<'a> {
    fn nsid() -> &'static str {
        "games.gamesgamesgamesgames.getClaim"
    }
    fn def_name() -> &'static str {
        "reviewView"
    }
    fn lexicon_doc() -> LexiconDoc<'static> {
        lexicon_doc_games_gamesgamesgamesgames_getClaim()
    }
    fn validate(&self) -> Result<(), ConstraintError> {
        Ok(())
    }
}

pub mod claim_view_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 ClaimantDid;
        type CreatedAt;
        type Cid;
        type Uri;
        type Type;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type ClaimantDid = Unset;
        type CreatedAt = Unset;
        type Cid = Unset;
        type Uri = Unset;
        type Type = Unset;
    }
    ///State transition - sets the `claimant_did` field to Set
    pub struct SetClaimantDid<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetClaimantDid<S> {}
    impl<S: State> State for SetClaimantDid<S> {
        type ClaimantDid = Set<members::claimant_did>;
        type CreatedAt = S::CreatedAt;
        type Cid = S::Cid;
        type Uri = S::Uri;
        type Type = S::Type;
    }
    ///State transition - sets the `created_at` field to Set
    pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetCreatedAt<S> {}
    impl<S: State> State for SetCreatedAt<S> {
        type ClaimantDid = S::ClaimantDid;
        type CreatedAt = Set<members::created_at>;
        type Cid = S::Cid;
        type Uri = S::Uri;
        type Type = S::Type;
    }
    ///State transition - sets the `cid` field to Set
    pub struct SetCid<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetCid<S> {}
    impl<S: State> State for SetCid<S> {
        type ClaimantDid = S::ClaimantDid;
        type CreatedAt = S::CreatedAt;
        type Cid = Set<members::cid>;
        type Uri = S::Uri;
        type Type = S::Type;
    }
    ///State transition - sets the `uri` field to Set
    pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetUri<S> {}
    impl<S: State> State for SetUri<S> {
        type ClaimantDid = S::ClaimantDid;
        type CreatedAt = S::CreatedAt;
        type Cid = S::Cid;
        type Uri = Set<members::uri>;
        type Type = S::Type;
    }
    ///State transition - sets the `type` field to Set
    pub struct SetType<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetType<S> {}
    impl<S: State> State for SetType<S> {
        type ClaimantDid = S::ClaimantDid;
        type CreatedAt = S::CreatedAt;
        type Cid = S::Cid;
        type Uri = S::Uri;
        type Type = Set<members::r#type>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `claimant_did` field
        pub struct claimant_did(());
        ///Marker type for the `created_at` field
        pub struct created_at(());
        ///Marker type for the `cid` field
        pub struct cid(());
        ///Marker type for the `uri` field
        pub struct uri(());
        ///Marker type for the `type` field
        pub struct r#type(());
    }
}

/// Builder for constructing an instance of this type
pub struct ClaimViewBuilder<'a, S: claim_view_state::State> {
    _state: PhantomData<fn() -> S>,
    _fields: (
        Option<CowStr<'a>>,
        Option<Did<'a>>,
        Option<CowStr<'a>>,
        Option<Datetime>,
        Option<Vec<GameSummaryView<'a>>>,
        Option<CowStr<'a>>,
        Option<AtUri<'a>>,
        Option<get_claim::ReviewView<'a>>,
        Option<ClaimViewType<'a>>,
        Option<AtUri<'a>>,
    ),
    _lifetime: PhantomData<&'a ()>,
}

impl<'a> ClaimView<'a> {
    /// Create a new builder for this type
    pub fn new() -> ClaimViewBuilder<'a, claim_view_state::Empty> {
        ClaimViewBuilder::new()
    }
}

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

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

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

impl<'a, S: claim_view_state::State> ClaimViewBuilder<'a, S> {
    /// Set the `contact` field (optional)
    pub fn contact(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
        self._fields.2 = value.into();
        self
    }
    /// Set the `contact` field to an Option value (optional)
    pub fn maybe_contact(mut self, value: Option<CowStr<'a>>) -> Self {
        self._fields.2 = value;
        self
    }
}

impl<'a, S> ClaimViewBuilder<'a, S>
where
    S: claim_view_state::State,
    S::CreatedAt: claim_view_state::IsUnset,
{
    /// Set the `createdAt` field (required)
    pub fn created_at(
        mut self,
        value: impl Into<Datetime>,
    ) -> ClaimViewBuilder<'a, claim_view_state::SetCreatedAt<S>> {
        self._fields.3 = Option::Some(value.into());
        ClaimViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S: claim_view_state::State> ClaimViewBuilder<'a, S> {
    /// Set the `games` field (optional)
    pub fn games(mut self, value: impl Into<Option<Vec<GameSummaryView<'a>>>>) -> Self {
        self._fields.4 = value.into();
        self
    }
    /// Set the `games` field to an Option value (optional)
    pub fn maybe_games(mut self, value: Option<Vec<GameSummaryView<'a>>>) -> Self {
        self._fields.4 = value;
        self
    }
}

impl<'a, S: claim_view_state::State> ClaimViewBuilder<'a, S> {
    /// Set the `message` field (optional)
    pub fn message(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
        self._fields.5 = value.into();
        self
    }
    /// Set the `message` field to an Option value (optional)
    pub fn maybe_message(mut self, value: Option<CowStr<'a>>) -> Self {
        self._fields.5 = value;
        self
    }
}

impl<'a, S: claim_view_state::State> ClaimViewBuilder<'a, S> {
    /// Set the `org` field (optional)
    pub fn org(mut self, value: impl Into<Option<AtUri<'a>>>) -> Self {
        self._fields.6 = value.into();
        self
    }
    /// Set the `org` field to an Option value (optional)
    pub fn maybe_org(mut self, value: Option<AtUri<'a>>) -> Self {
        self._fields.6 = value;
        self
    }
}

impl<'a, S: claim_view_state::State> ClaimViewBuilder<'a, S> {
    /// Set the `review` field (optional)
    pub fn review(
        mut self,
        value: impl Into<Option<get_claim::ReviewView<'a>>>,
    ) -> Self {
        self._fields.7 = value.into();
        self
    }
    /// Set the `review` field to an Option value (optional)
    pub fn maybe_review(mut self, value: Option<get_claim::ReviewView<'a>>) -> Self {
        self._fields.7 = value;
        self
    }
}

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

impl<'a, S> ClaimViewBuilder<'a, S>
where
    S: claim_view_state::State,
    S::Uri: claim_view_state::IsUnset,
{
    /// Set the `uri` field (required)
    pub fn uri(
        mut self,
        value: impl Into<AtUri<'a>>,
    ) -> ClaimViewBuilder<'a, claim_view_state::SetUri<S>> {
        self._fields.9 = Option::Some(value.into());
        ClaimViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> ClaimViewBuilder<'a, S>
where
    S: claim_view_state::State,
    S::ClaimantDid: claim_view_state::IsSet,
    S::CreatedAt: claim_view_state::IsSet,
    S::Cid: claim_view_state::IsSet,
    S::Uri: claim_view_state::IsSet,
    S::Type: claim_view_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> ClaimView<'a> {
        ClaimView {
            cid: self._fields.0.unwrap(),
            claimant_did: self._fields.1.unwrap(),
            contact: self._fields.2,
            created_at: self._fields.3.unwrap(),
            games: self._fields.4,
            message: self._fields.5,
            org: self._fields.6,
            review: self._fields.7,
            r#type: self._fields.8.unwrap(),
            uri: self._fields.9.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>,
        >,
    ) -> ClaimView<'a> {
        ClaimView {
            cid: self._fields.0.unwrap(),
            claimant_did: self._fields.1.unwrap(),
            contact: self._fields.2,
            created_at: self._fields.3.unwrap(),
            games: self._fields.4,
            message: self._fields.5,
            org: self._fields.6,
            review: self._fields.7,
            r#type: self._fields.8.unwrap(),
            uri: self._fields.9.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}

fn lexicon_doc_games_gamesgamesgamesgames_getClaim() -> 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("games.gamesgamesgamesgames.getClaim"),
        defs: {
            let mut map = BTreeMap::new();
            map.insert(
                SmolStr::new_static("claimView"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![
                            SmolStr::new_static("uri"), SmolStr::new_static("cid"),
                            SmolStr::new_static("type"),
                            SmolStr::new_static("claimantDid"),
                            SmolStr::new_static("createdAt")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("cid"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("claimantDid"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Did),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("contact"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("createdAt"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("games"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::Ref(LexRef {
                                    r#ref: CowStr::new_static(
                                        "games.gamesgamesgamesgames.defs#gameSummaryView",
                                    ),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("message"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("org"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("review"),
                            LexObjectProperty::Ref(LexRef {
                                r#ref: CowStr::new_static("#reviewView"),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("type"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("uri"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("main"),
                LexUserType::XrpcQuery(LexXrpcQuery {
                    parameters: Some(
                        LexXrpcQueryParameter::Params(LexXrpcParameters {
                            required: Some(vec![SmolStr::new_static("uri")]),
                            properties: {
                                #[allow(unused_mut)]
                                let mut map = BTreeMap::new();
                                map.insert(
                                    SmolStr::new_static("uri"),
                                    LexXrpcParametersProperty::String(LexString {
                                        format: Some(LexStringFormat::AtUri),
                                        ..Default::default()
                                    }),
                                );
                                map
                            },
                            ..Default::default()
                        }),
                    ),
                    ..Default::default()
                }),
            );
            map.insert(
                SmolStr::new_static("reviewView"),
                LexUserType::Object(LexObject {
                    required: Some(
                        vec![
                            SmolStr::new_static("uri"), SmolStr::new_static("status"),
                            SmolStr::new_static("reviewedBy"),
                            SmolStr::new_static("createdAt")
                        ],
                    ),
                    properties: {
                        #[allow(unused_mut)]
                        let mut map = BTreeMap::new();
                        map.insert(
                            SmolStr::new_static("approvedGames"),
                            LexObjectProperty::Array(LexArray {
                                items: LexArrayItem::String(LexString {
                                    format: Some(LexStringFormat::AtUri),
                                    ..Default::default()
                                }),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("createdAt"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Datetime),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("reason"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("reviewedBy"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::Did),
                                ..Default::default()
                            }),
                        );
                        map.insert(
                            SmolStr::new_static("status"),
                            LexObjectProperty::String(LexString { ..Default::default() }),
                        );
                        map.insert(
                            SmolStr::new_static("uri"),
                            LexObjectProperty::String(LexString {
                                format: Some(LexStringFormat::AtUri),
                                ..Default::default()
                            }),
                        );
                        map
                    },
                    ..Default::default()
                }),
            );
            map
        },
        ..Default::default()
    }
}

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

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

impl<'a> GetClaim<'a> {
    /// Create a new builder for this type
    pub fn new() -> GetClaimBuilder<'a, get_claim_state::Empty> {
        GetClaimBuilder::new()
    }
}

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

impl<'a, S> GetClaimBuilder<'a, S>
where
    S: get_claim_state::State,
    S::Uri: get_claim_state::IsUnset,
{
    /// Set the `uri` field (required)
    pub fn uri(
        mut self,
        value: impl Into<AtUri<'a>>,
    ) -> GetClaimBuilder<'a, get_claim_state::SetUri<S>> {
        self._fields.0 = Option::Some(value.into());
        GetClaimBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> GetClaimBuilder<'a, S>
where
    S: get_claim_state::State,
    S::Uri: get_claim_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> GetClaim<'a> {
        GetClaim {
            uri: self._fields.0.unwrap(),
        }
    }
}

pub mod review_view_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 Status;
        type Uri;
        type CreatedAt;
        type ReviewedBy;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Status = Unset;
        type Uri = Unset;
        type CreatedAt = Unset;
        type ReviewedBy = Unset;
    }
    ///State transition - sets the `status` field to Set
    pub struct SetStatus<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetStatus<S> {}
    impl<S: State> State for SetStatus<S> {
        type Status = Set<members::status>;
        type Uri = S::Uri;
        type CreatedAt = S::CreatedAt;
        type ReviewedBy = S::ReviewedBy;
    }
    ///State transition - sets the `uri` field to Set
    pub struct SetUri<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetUri<S> {}
    impl<S: State> State for SetUri<S> {
        type Status = S::Status;
        type Uri = Set<members::uri>;
        type CreatedAt = S::CreatedAt;
        type ReviewedBy = S::ReviewedBy;
    }
    ///State transition - sets the `created_at` field to Set
    pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetCreatedAt<S> {}
    impl<S: State> State for SetCreatedAt<S> {
        type Status = S::Status;
        type Uri = S::Uri;
        type CreatedAt = Set<members::created_at>;
        type ReviewedBy = S::ReviewedBy;
    }
    ///State transition - sets the `reviewed_by` field to Set
    pub struct SetReviewedBy<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetReviewedBy<S> {}
    impl<S: State> State for SetReviewedBy<S> {
        type Status = S::Status;
        type Uri = S::Uri;
        type CreatedAt = S::CreatedAt;
        type ReviewedBy = Set<members::reviewed_by>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `status` field
        pub struct status(());
        ///Marker type for the `uri` field
        pub struct uri(());
        ///Marker type for the `created_at` field
        pub struct created_at(());
        ///Marker type for the `reviewed_by` field
        pub struct reviewed_by(());
    }
}

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

impl<'a> ReviewView<'a> {
    /// Create a new builder for this type
    pub fn new() -> ReviewViewBuilder<'a, review_view_state::Empty> {
        ReviewViewBuilder::new()
    }
}

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

impl<'a, S: review_view_state::State> ReviewViewBuilder<'a, S> {
    /// Set the `approvedGames` field (optional)
    pub fn approved_games(mut self, value: impl Into<Option<Vec<AtUri<'a>>>>) -> Self {
        self._fields.0 = value.into();
        self
    }
    /// Set the `approvedGames` field to an Option value (optional)
    pub fn maybe_approved_games(mut self, value: Option<Vec<AtUri<'a>>>) -> Self {
        self._fields.0 = value;
        self
    }
}

impl<'a, S> ReviewViewBuilder<'a, S>
where
    S: review_view_state::State,
    S::CreatedAt: review_view_state::IsUnset,
{
    /// Set the `createdAt` field (required)
    pub fn created_at(
        mut self,
        value: impl Into<Datetime>,
    ) -> ReviewViewBuilder<'a, review_view_state::SetCreatedAt<S>> {
        self._fields.1 = Option::Some(value.into());
        ReviewViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S: review_view_state::State> ReviewViewBuilder<'a, S> {
    /// Set the `reason` field (optional)
    pub fn reason(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
        self._fields.2 = value.into();
        self
    }
    /// Set the `reason` field to an Option value (optional)
    pub fn maybe_reason(mut self, value: Option<CowStr<'a>>) -> Self {
        self._fields.2 = value;
        self
    }
}

impl<'a, S> ReviewViewBuilder<'a, S>
where
    S: review_view_state::State,
    S::ReviewedBy: review_view_state::IsUnset,
{
    /// Set the `reviewedBy` field (required)
    pub fn reviewed_by(
        mut self,
        value: impl Into<Did<'a>>,
    ) -> ReviewViewBuilder<'a, review_view_state::SetReviewedBy<S>> {
        self._fields.3 = Option::Some(value.into());
        ReviewViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> ReviewViewBuilder<'a, S>
where
    S: review_view_state::State,
    S::Status: review_view_state::IsUnset,
{
    /// Set the `status` field (required)
    pub fn status(
        mut self,
        value: impl Into<ReviewViewStatus<'a>>,
    ) -> ReviewViewBuilder<'a, review_view_state::SetStatus<S>> {
        self._fields.4 = Option::Some(value.into());
        ReviewViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> ReviewViewBuilder<'a, S>
where
    S: review_view_state::State,
    S::Uri: review_view_state::IsUnset,
{
    /// Set the `uri` field (required)
    pub fn uri(
        mut self,
        value: impl Into<AtUri<'a>>,
    ) -> ReviewViewBuilder<'a, review_view_state::SetUri<S>> {
        self._fields.5 = Option::Some(value.into());
        ReviewViewBuilder {
            _state: PhantomData,
            _fields: self._fields,
            _lifetime: PhantomData,
        }
    }
}

impl<'a, S> ReviewViewBuilder<'a, S>
where
    S: review_view_state::State,
    S::Status: review_view_state::IsSet,
    S::Uri: review_view_state::IsSet,
    S::CreatedAt: review_view_state::IsSet,
    S::ReviewedBy: review_view_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> ReviewView<'a> {
        ReviewView {
            approved_games: self._fields.0,
            created_at: self._fields.1.unwrap(),
            reason: self._fields.2,
            reviewed_by: self._fields.3.unwrap(),
            status: self._fields.4.unwrap(),
            uri: self._fields.5.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>,
        >,
    ) -> ReviewView<'a> {
        ReviewView {
            approved_games: self._fields.0,
            created_at: self._fields.1.unwrap(),
            reason: self._fields.2,
            reviewed_by: self._fields.3.unwrap(),
            status: self._fields.4.unwrap(),
            uri: self._fields.5.unwrap(),
            extra_data: Some(extra_data),
        }
    }
}