#[jacquard_derive::lexicon]
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct Platform<'a> {
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub abbreviation: std::option::Option<jacquard_common::CowStr<'a>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub alternative_name: std::option::Option<jacquard_common::CowStr<'a>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub category: std::option::Option<
crate::games_gamesgamesgamesgames::PlatformCategory<'a>,
>,
pub created_at: jacquard_common::types::string::Datetime,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub description: std::option::Option<jacquard_common::CowStr<'a>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub family: std::option::Option<jacquard_common::types::string::AtUri<'a>>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
pub generation: std::option::Option<i64>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub media: std::option::Option<
Vec<crate::games_gamesgamesgamesgames::MediaItem<'a>>,
>,
#[serde(borrow)]
pub name: jacquard_common::CowStr<'a>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub versions: std::option::Option<
Vec<crate::games_gamesgamesgamesgames::PlatformVersion<'a>>,
>,
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub websites: std::option::Option<
Vec<crate::games_gamesgamesgamesgames::Website<'a>>,
>,
}
pub mod platform_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 Name;
type CreatedAt;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Name = Unset;
type CreatedAt = Unset;
}
pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetName<S> {}
impl<S: State> State for SetName<S> {
type Name = Set<members::name>;
type CreatedAt = S::CreatedAt;
}
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 Name = S::Name;
type CreatedAt = Set<members::created_at>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct name(());
pub struct created_at(());
}
}
pub struct PlatformBuilder<'a, S: platform_state::State> {
_phantom_state: ::core::marker::PhantomData<fn() -> S>,
__unsafe_private_named: (
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<crate::games_gamesgamesgamesgames::PlatformCategory<'a>>,
::core::option::Option<jacquard_common::types::string::Datetime>,
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<jacquard_common::types::string::AtUri<'a>>,
::core::option::Option<i64>,
::core::option::Option<Vec<crate::games_gamesgamesgamesgames::MediaItem<'a>>>,
::core::option::Option<jacquard_common::CowStr<'a>>,
::core::option::Option<
Vec<crate::games_gamesgamesgamesgames::PlatformVersion<'a>>,
>,
::core::option::Option<Vec<crate::games_gamesgamesgamesgames::Website<'a>>>,
),
_phantom: ::core::marker::PhantomData<&'a ()>,
}
impl<'a> Platform<'a> {
pub fn new() -> PlatformBuilder<'a, platform_state::Empty> {
PlatformBuilder::new()
}
}
impl<'a> PlatformBuilder<'a, platform_state::Empty> {
pub fn new() -> Self {
PlatformBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: (
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
),
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: platform_state::State> PlatformBuilder<'a, S> {
pub fn abbreviation(
mut self,
value: impl Into<Option<jacquard_common::CowStr<'a>>>,
) -> Self {
self.__unsafe_private_named.0 = value.into();
self
}
pub fn maybe_abbreviation(
mut self,
value: Option<jacquard_common::CowStr<'a>>,
) -> Self {
self.__unsafe_private_named.0 = value;
self
}
}
impl<'a, S: platform_state::State> PlatformBuilder<'a, S> {
pub fn alternative_name(
mut self,
value: impl Into<Option<jacquard_common::CowStr<'a>>>,
) -> Self {
self.__unsafe_private_named.1 = value.into();
self
}
pub fn maybe_alternative_name(
mut self,
value: Option<jacquard_common::CowStr<'a>>,
) -> Self {
self.__unsafe_private_named.1 = value;
self
}
}
impl<'a, S: platform_state::State> PlatformBuilder<'a, S> {
pub fn category(
mut self,
value: impl Into<Option<crate::games_gamesgamesgamesgames::PlatformCategory<'a>>>,
) -> Self {
self.__unsafe_private_named.2 = value.into();
self
}
pub fn maybe_category(
mut self,
value: Option<crate::games_gamesgamesgamesgames::PlatformCategory<'a>>,
) -> Self {
self.__unsafe_private_named.2 = value;
self
}
}
impl<'a, S> PlatformBuilder<'a, S>
where
S: platform_state::State,
S::CreatedAt: platform_state::IsUnset,
{
pub fn created_at(
mut self,
value: impl Into<jacquard_common::types::string::Datetime>,
) -> PlatformBuilder<'a, platform_state::SetCreatedAt<S>> {
self.__unsafe_private_named.3 = ::core::option::Option::Some(value.into());
PlatformBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: platform_state::State> PlatformBuilder<'a, S> {
pub fn description(
mut self,
value: impl Into<Option<jacquard_common::CowStr<'a>>>,
) -> Self {
self.__unsafe_private_named.4 = value.into();
self
}
pub fn maybe_description(
mut self,
value: Option<jacquard_common::CowStr<'a>>,
) -> Self {
self.__unsafe_private_named.4 = value;
self
}
}
impl<'a, S: platform_state::State> PlatformBuilder<'a, S> {
pub fn family(
mut self,
value: impl Into<Option<jacquard_common::types::string::AtUri<'a>>>,
) -> Self {
self.__unsafe_private_named.5 = value.into();
self
}
pub fn maybe_family(
mut self,
value: Option<jacquard_common::types::string::AtUri<'a>>,
) -> Self {
self.__unsafe_private_named.5 = value;
self
}
}
impl<'a, S: platform_state::State> PlatformBuilder<'a, S> {
pub fn generation(mut self, value: impl Into<Option<i64>>) -> Self {
self.__unsafe_private_named.6 = value.into();
self
}
pub fn maybe_generation(mut self, value: Option<i64>) -> Self {
self.__unsafe_private_named.6 = value;
self
}
}
impl<'a, S: platform_state::State> PlatformBuilder<'a, S> {
pub fn media(
mut self,
value: impl Into<Option<Vec<crate::games_gamesgamesgamesgames::MediaItem<'a>>>>,
) -> Self {
self.__unsafe_private_named.7 = value.into();
self
}
pub fn maybe_media(
mut self,
value: Option<Vec<crate::games_gamesgamesgamesgames::MediaItem<'a>>>,
) -> Self {
self.__unsafe_private_named.7 = value;
self
}
}
impl<'a, S> PlatformBuilder<'a, S>
where
S: platform_state::State,
S::Name: platform_state::IsUnset,
{
pub fn name(
mut self,
value: impl Into<jacquard_common::CowStr<'a>>,
) -> PlatformBuilder<'a, platform_state::SetName<S>> {
self.__unsafe_private_named.8 = ::core::option::Option::Some(value.into());
PlatformBuilder {
_phantom_state: ::core::marker::PhantomData,
__unsafe_private_named: self.__unsafe_private_named,
_phantom: ::core::marker::PhantomData,
}
}
}
impl<'a, S: platform_state::State> PlatformBuilder<'a, S> {
pub fn versions(
mut self,
value: impl Into<
Option<Vec<crate::games_gamesgamesgamesgames::PlatformVersion<'a>>>,
>,
) -> Self {
self.__unsafe_private_named.9 = value.into();
self
}
pub fn maybe_versions(
mut self,
value: Option<Vec<crate::games_gamesgamesgamesgames::PlatformVersion<'a>>>,
) -> Self {
self.__unsafe_private_named.9 = value;
self
}
}
impl<'a, S: platform_state::State> PlatformBuilder<'a, S> {
pub fn websites(
mut self,
value: impl Into<Option<Vec<crate::games_gamesgamesgamesgames::Website<'a>>>>,
) -> Self {
self.__unsafe_private_named.10 = value.into();
self
}
pub fn maybe_websites(
mut self,
value: Option<Vec<crate::games_gamesgamesgamesgames::Website<'a>>>,
) -> Self {
self.__unsafe_private_named.10 = value;
self
}
}
impl<'a, S> PlatformBuilder<'a, S>
where
S: platform_state::State,
S::Name: platform_state::IsSet,
S::CreatedAt: platform_state::IsSet,
{
pub fn build(self) -> Platform<'a> {
Platform {
abbreviation: self.__unsafe_private_named.0,
alternative_name: self.__unsafe_private_named.1,
category: self.__unsafe_private_named.2,
created_at: self.__unsafe_private_named.3.unwrap(),
description: self.__unsafe_private_named.4,
family: self.__unsafe_private_named.5,
generation: self.__unsafe_private_named.6,
media: self.__unsafe_private_named.7,
name: self.__unsafe_private_named.8.unwrap(),
versions: self.__unsafe_private_named.9,
websites: self.__unsafe_private_named.10,
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: std::collections::BTreeMap<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> Platform<'a> {
Platform {
abbreviation: self.__unsafe_private_named.0,
alternative_name: self.__unsafe_private_named.1,
category: self.__unsafe_private_named.2,
created_at: self.__unsafe_private_named.3.unwrap(),
description: self.__unsafe_private_named.4,
family: self.__unsafe_private_named.5,
generation: self.__unsafe_private_named.6,
media: self.__unsafe_private_named.7,
name: self.__unsafe_private_named.8.unwrap(),
versions: self.__unsafe_private_named.9,
websites: self.__unsafe_private_named.10,
extra_data: Some(extra_data),
}
}
}
impl<'a> Platform<'a> {
pub fn uri(
uri: impl Into<jacquard_common::CowStr<'a>>,
) -> Result<
jacquard_common::types::uri::RecordUri<'a, PlatformRecord>,
jacquard_common::types::uri::UriError,
> {
jacquard_common::types::uri::RecordUri::try_from_uri(
jacquard_common::types::string::AtUri::new_cow(uri.into())?,
)
}
}
#[derive(
serde::Serialize,
serde::Deserialize,
Debug,
Clone,
PartialEq,
Eq,
jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct PlatformGetRecordOutput<'a> {
#[serde(skip_serializing_if = "std::option::Option::is_none")]
#[serde(borrow)]
pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>,
#[serde(borrow)]
pub uri: jacquard_common::types::string::AtUri<'a>,
#[serde(borrow)]
pub value: Platform<'a>,
}
impl From<PlatformGetRecordOutput<'_>> for Platform<'_> {
fn from(output: PlatformGetRecordOutput<'_>) -> Self {
use jacquard_common::IntoStatic;
output.value.into_static()
}
}
impl jacquard_common::types::collection::Collection for Platform<'_> {
const NSID: &'static str = "games.gamesgamesgamesgames.platform";
type Record = PlatformRecord;
}
#[derive(Debug, serde::Serialize, serde::Deserialize)]
pub struct PlatformRecord;
impl jacquard_common::xrpc::XrpcResp for PlatformRecord {
const NSID: &'static str = "games.gamesgamesgamesgames.platform";
const ENCODING: &'static str = "application/json";
type Output<'de> = PlatformGetRecordOutput<'de>;
type Err<'de> = jacquard_common::types::collection::RecordError<'de>;
}
impl jacquard_common::types::collection::Collection for PlatformRecord {
const NSID: &'static str = "games.gamesgamesgamesgames.platform";
type Record = PlatformRecord;
}
impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Platform<'a> {
fn nsid() -> &'static str {
"games.gamesgamesgamesgames.platform"
}
fn def_name() -> &'static str {
"main"
}
fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
lexicon_doc_games_gamesgamesgamesgames_platform()
}
fn validate(
&self,
) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
Ok(())
}
}
fn lexicon_doc_games_gamesgamesgamesgames_platform() -> ::jacquard_lexicon::lexicon::LexiconDoc<
'static,
> {
::jacquard_lexicon::lexicon::LexiconDoc {
lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1,
id: ::jacquard_common::CowStr::new_static("games.gamesgamesgamesgames.platform"),
revision: None,
description: None,
defs: {
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static("main"),
::jacquard_lexicon::lexicon::LexUserType::Record(::jacquard_lexicon::lexicon::LexRecord {
description: Some(
::jacquard_common::CowStr::new_static(
"A platform for playing video games.",
),
),
key: Some(::jacquard_common::CowStr::new_static("tid")),
record: ::jacquard_lexicon::lexicon::LexRecordRecord::Object(::jacquard_lexicon::lexicon::LexObject {
description: None,
required: Some(
vec![
::jacquard_common::deps::smol_str::SmolStr::new_static("name"),
::jacquard_common::deps::smol_str::SmolStr::new_static("createdAt")
],
),
nullable: None,
properties: {
#[allow(unused_mut)]
let mut map = ::alloc::collections::BTreeMap::new();
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"abbreviation",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: None,
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"alternativeName",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: None,
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"category",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
description: None,
r#ref: ::jacquard_common::CowStr::new_static(
"games.gamesgamesgamesgames.defs#platformCategory",
),
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"createdAt",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: None,
format: Some(
::jacquard_lexicon::lexicon::LexStringFormat::Datetime,
),
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"description",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: None,
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"family",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: None,
format: Some(
::jacquard_lexicon::lexicon::LexStringFormat::AtUri,
),
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"generation",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Integer(::jacquard_lexicon::lexicon::LexInteger {
description: None,
default: None,
minimum: None,
maximum: None,
r#enum: None,
r#const: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"media",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
description: None,
items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef {
description: None,
r#ref: ::jacquard_common::CowStr::new_static(
"games.gamesgamesgamesgames.defs#mediaItem",
),
}),
min_length: None,
max_length: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"name",
),
::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
description: None,
format: None,
default: None,
min_length: None,
max_length: None,
min_graphemes: None,
max_graphemes: None,
r#enum: None,
r#const: None,
known_values: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"versions",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
description: None,
items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef {
description: None,
r#ref: ::jacquard_common::CowStr::new_static(
"games.gamesgamesgamesgames.defs#platformVersion",
),
}),
min_length: None,
max_length: None,
}),
);
map.insert(
::jacquard_common::deps::smol_str::SmolStr::new_static(
"websites",
),
::jacquard_lexicon::lexicon::LexObjectProperty::Array(::jacquard_lexicon::lexicon::LexArray {
description: None,
items: ::jacquard_lexicon::lexicon::LexArrayItem::Ref(::jacquard_lexicon::lexicon::LexRef {
description: None,
r#ref: ::jacquard_common::CowStr::new_static(
"games.gamesgamesgamesgames.defs#website",
),
}),
min_length: None,
max_length: None,
}),
);
map
},
}),
}),
);
map
},
}
}