// @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, 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::{Did, AtUri, 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::games_gamesgamesgamesgames::GameSummaryView;
use crate::games_gamesgamesgamesgames::get_claim;

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct ClaimView<S: BosStr = DefaultStr> {
    pub cid: S,
    pub claimant_did: Did<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub contact: Option<S>,
    pub created_at: Datetime,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub games: Option<Vec<GameSummaryView<S>>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub message: Option<S>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub org: Option<AtUri<S>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub review: Option<get_claim::ReviewView<S>>,
    pub r#type: ClaimViewType<S>,
    pub uri: AtUri<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}


#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ClaimViewType<S: BosStr = DefaultStr> {
    Game,
    Org,
    Other(S),
}

impl<S: BosStr> ClaimViewType<S> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::Game => "game",
            Self::Org => "org",
            Self::Other(s) => s.as_ref(),
        }
    }
    /// Construct from a string-like value, matching known values.
    pub fn from_value(s: S) -> Self {
        match s.as_ref() {
            "game" => Self::Game,
            "org" => Self::Org,
            _ => Self::Other(s),
        }
    }
}

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

impl<S: BosStr> AsRef<str> for ClaimViewType<S> {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}

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

impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for ClaimViewType<S> {
    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        let s = S::deserialize(deserializer)?;
        Ok(Self::from_value(s))
    }
}

impl<S: BosStr + Default> Default for ClaimViewType<S> {
    fn default() -> Self {
        Self::Other(Default::default())
    }
}

impl<S: BosStr> jacquard_common::IntoStatic for ClaimViewType<S>
where
    S: BosStr + jacquard_common::IntoStatic,
    S::Output: BosStr,
{
    type Output = ClaimViewType<S::Output>;
    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", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct GetClaim<S: BosStr = DefaultStr> {
    pub uri: AtUri<S>,
}


#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct GetClaimOutput<S: BosStr = DefaultStr> {
    pub claim: get_claim::ClaimView<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 ReviewView<S: BosStr = DefaultStr> {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub approved_games: Option<Vec<AtUri<S>>>,
    pub created_at: Datetime,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub reason: Option<S>,
    pub reviewed_by: Did<S>,
    pub status: ReviewViewStatus<S>,
    pub uri: AtUri<S>,
    #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
    pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}


#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ReviewViewStatus<S: BosStr = DefaultStr> {
    Approved,
    Denied,
    Other(S),
}

impl<S: BosStr> ReviewViewStatus<S> {
    pub fn as_str(&self) -> &str {
        match self {
            Self::Approved => "approved",
            Self::Denied => "denied",
            Self::Other(s) => s.as_ref(),
        }
    }
    /// Construct from a string-like value, matching known values.
    pub fn from_value(s: S) -> Self {
        match s.as_ref() {
            "approved" => Self::Approved,
            "denied" => Self::Denied,
            _ => Self::Other(s),
        }
    }
}

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

impl<S: BosStr> AsRef<str> for ReviewViewStatus<S> {
    fn as_ref(&self) -> &str {
        self.as_str()
    }
}

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

impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for ReviewViewStatus<S> {
    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        let s = S::deserialize(deserializer)?;
        Ok(Self::from_value(s))
    }
}

impl<S: BosStr + Default> Default for ReviewViewStatus<S> {
    fn default() -> Self {
        Self::Other(Default::default())
    }
}

impl<S: BosStr> jacquard_common::IntoStatic for ReviewViewStatus<S>
where
    S: BosStr + jacquard_common::IntoStatic,
    S::Output: BosStr,
{
    type Output = ReviewViewStatus<S::Output>;
    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<S: BosStr> LexiconSchema for ClaimView<S> {
    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 marker for the `games.gamesgamesgamesgames.getClaim` query.

Implements `jacquard_common::xrpc::XrpcResp`; successful bodies decode as `Self::Output<S>`, which is `GetClaimOutput<S>` for this endpoint.*/
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<S: BosStr> = GetClaimOutput<S>;
    type Err = jacquard_common::xrpc::GenericError;
}

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

/** Endpoint marker for the `games.gamesgamesgamesgames.getClaim` query.

Path: `/xrpc/games.gamesgamesgamesgames.getClaim`. The request payload type is `GetClaim<S>`; send that request with `jacquard::Client` or use this marker through lower-level `XrpcEndpoint` APIs.*/
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<S: BosStr> = GetClaim<S>;
    type Response = GetClaimResponse;
}

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

/// Builder for constructing an instance of this type.
pub struct ClaimViewBuilder<St: claim_view_state::State, S: BosStr = DefaultStr> {
    _state: PhantomData<fn() -> St>,
    _fields: (
        Option<S>,
        Option<Did<S>>,
        Option<S>,
        Option<Datetime>,
        Option<Vec<GameSummaryView<S>>>,
        Option<S>,
        Option<AtUri<S>>,
        Option<get_claim::ReviewView<S>>,
        Option<ClaimViewType<S>>,
        Option<AtUri<S>>,
    ),
    _type: PhantomData<fn() -> S>,
}

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

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

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

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

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

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

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

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

impl<St: claim_view_state::State, S: BosStr> ClaimViewBuilder<St, S> {
    /// Set the `games` field (optional)
    pub fn games(mut self, value: impl Into<Option<Vec<GameSummaryView<S>>>>) -> 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<S>>>) -> Self {
        self._fields.4 = value;
        self
    }
}

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

impl<St: claim_view_state::State, S: BosStr> ClaimViewBuilder<St, S> {
    /// Set the `org` field (optional)
    pub fn org(mut self, value: impl Into<Option<AtUri<S>>>) -> 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<S>>) -> Self {
        self._fields.6 = value;
        self
    }
}

impl<St: claim_view_state::State, S: BosStr> ClaimViewBuilder<St, S> {
    /// Set the `review` field (optional)
    pub fn review(mut self, value: impl Into<Option<get_claim::ReviewView<S>>>) -> 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<S>>) -> Self {
        self._fields.7 = value;
        self
    }
}

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

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

impl<St, S: BosStr> ClaimViewBuilder<St, S>
where
    St: claim_view_state::State,
    St::Cid: claim_view_state::IsSet,
    St::ClaimantDid: claim_view_state::IsSet,
    St::CreatedAt: claim_view_state::IsSet,
    St::Type: claim_view_state::IsSet,
    St::Uri: claim_view_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> ClaimView<S> {
        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<SmolStr, Data<S>>,
    ) -> ClaimView<S> {
        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<St: State = Empty>(PhantomData<fn() -> St>);
    impl<St: State> sealed::Sealed for SetUri<St> {}
    impl<St: State> State for SetUri<St> {
        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<St: get_claim_state::State, S: BosStr = DefaultStr> {
    _state: PhantomData<fn() -> St>,
    _fields: (Option<AtUri<S>>,),
    _type: PhantomData<fn() -> S>,
}

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

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

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

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

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

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

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

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

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

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

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

impl<St: review_view_state::State, S: BosStr> ReviewViewBuilder<St, S> {
    /// Set the `approvedGames` field (optional)
    pub fn approved_games(mut self, value: impl Into<Option<Vec<AtUri<S>>>>) -> 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<S>>>) -> Self {
        self._fields.0 = value;
        self
    }
}

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

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

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

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

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

impl<St, S: BosStr> ReviewViewBuilder<St, S>
where
    St: review_view_state::State,
    St::CreatedAt: review_view_state::IsSet,
    St::ReviewedBy: review_view_state::IsSet,
    St::Status: review_view_state::IsSet,
    St::Uri: review_view_state::IsSet,
{
    /// Build the final struct.
    pub fn build(self) -> ReviewView<S> {
        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<SmolStr, Data<S>>,
    ) -> ReviewView<S> {
        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),
        }
    }
}