#[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(())
}
}
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;
}
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 {}
}
pub trait State: sealed::Sealed {
type ClaimantDid;
type CreatedAt;
type Cid;
type Uri;
type Type;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct claimant_did(());
pub struct created_at(());
pub struct cid(());
pub struct uri(());
pub struct r#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> {
pub fn new() -> ClaimViewBuilder<'a, claim_view_state::Empty> {
ClaimViewBuilder::new()
}
}
impl<'a> ClaimViewBuilder<'a, claim_view_state::Empty> {
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,
{
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,
{
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> {
pub fn contact(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
self._fields.2 = value.into();
self
}
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,
{
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> {
pub fn games(mut self, value: impl Into<Option<Vec<GameSummaryView<'a>>>>) -> Self {
self._fields.4 = value.into();
self
}
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> {
pub fn message(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
self._fields.5 = value.into();
self
}
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> {
pub fn org(mut self, value: impl Into<Option<AtUri<'a>>>) -> Self {
self._fields.6 = value.into();
self
}
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> {
pub fn review(
mut self,
value: impl Into<Option<get_claim::ReviewView<'a>>>,
) -> Self {
self._fields.7 = value.into();
self
}
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,
{
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,
{
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,
{
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(),
}
}
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 {}
}
pub trait State: sealed::Sealed {
type Uri;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Uri = Unset;
}
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>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct uri(());
}
}
pub struct GetClaimBuilder<'a, S: get_claim_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<AtUri<'a>>,),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> GetClaim<'a> {
pub fn new() -> GetClaimBuilder<'a, get_claim_state::Empty> {
GetClaimBuilder::new()
}
}
impl<'a> GetClaimBuilder<'a, get_claim_state::Empty> {
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,
{
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,
{
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 {}
}
pub trait State: sealed::Sealed {
type Status;
type Uri;
type CreatedAt;
type ReviewedBy;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Status = Unset;
type Uri = Unset;
type CreatedAt = Unset;
type ReviewedBy = Unset;
}
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;
}
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;
}
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;
}
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>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct status(());
pub struct uri(());
pub struct created_at(());
pub struct reviewed_by(());
}
}
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> {
pub fn new() -> ReviewViewBuilder<'a, review_view_state::Empty> {
ReviewViewBuilder::new()
}
}
impl<'a> ReviewViewBuilder<'a, review_view_state::Empty> {
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> {
pub fn approved_games(mut self, value: impl Into<Option<Vec<AtUri<'a>>>>) -> Self {
self._fields.0 = value.into();
self
}
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,
{
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> {
pub fn reason(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
self._fields.2 = value.into();
self
}
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,
{
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,
{
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,
{
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,
{
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(),
}
}
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),
}
}
}