pub mod group;
pub mod log;
pub mod programme;
pub mod service;
#[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::{AtUri, Datetime, UriValue};
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::media_ionosphere;
pub type Bearer<S = DefaultStr> = UriValue<S>;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct Broadcast<S: BosStr = DefaultStr> {
pub bearer: media_ionosphere::Bearer<S>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default = "_default_broadcast_cost")]
pub cost: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub from: Option<Datetime>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default = "_default_broadcast_offset")]
pub offset: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub until: Option<Datetime>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct Credit<S: BosStr = DefaultStr> {
pub entity: media_ionosphere::Entity<S>,
pub role: CreditRole<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 CreditRole<S: BosStr = DefaultStr> {
Creator,
Contributor,
Guest,
Other(S),
}
impl<S: BosStr> CreditRole<S> {
pub fn as_str(&self) -> &str {
match self {
Self::Creator => "creator",
Self::Contributor => "contributor",
Self::Guest => "guest",
Self::Other(s) => s.as_ref(),
}
}
pub fn from_value(s: S) -> Self {
match s.as_ref() {
"creator" => Self::Creator,
"contributor" => Self::Contributor,
"guest" => Self::Guest,
_ => Self::Other(s),
}
}
}
impl<S: BosStr> core::fmt::Display for CreditRole<S> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_str())
}
}
impl<S: BosStr> AsRef<str> for CreditRole<S> {
fn as_ref(&self) -> &str {
self.as_str()
}
}
impl<S: BosStr> Serialize for CreditRole<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 CreditRole<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 CreditRole<S> {
fn default() -> Self {
Self::Other(Default::default())
}
}
impl<S: BosStr> jacquard_common::IntoStatic for CreditRole<S>
where
S: BosStr + jacquard_common::IntoStatic,
S::Output: BosStr,
{
type Output = CreditRole<S::Output>;
fn into_static(self) -> Self::Output {
match self {
CreditRole::Creator => CreditRole::Creator,
CreditRole::Contributor => CreditRole::Contributor,
CreditRole::Guest => CreditRole::Guest,
CreditRole::Other(v) => CreditRole::Other(v.into_static()),
}
}
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct Entity<S: BosStr = DefaultStr> {
pub name: S,
pub r#type: S,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
pub type Genre<S = DefaultStr> = UriValue<S>;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct Geocoordinates<S: BosStr = DefaultStr> {
pub latitude: S,
pub longitude: 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 Membership<S: BosStr = DefaultStr> {
pub group: AtUri<S>,
#[serde(skip_serializing_if = "Option::is_none")]
pub index: Option<i64>,
#[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 Recording<S: BosStr = DefaultStr> {
pub bearer: media_ionosphere::Bearer<S>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default = "_default_recording_cost")]
pub cost: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub from: Option<Datetime>,
#[serde(skip_serializing_if = "Option::is_none")]
pub until: Option<Datetime>,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct Track<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub album: Option<S>,
pub artists: Vec<S>,
pub title: S,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
impl<S: BosStr> LexiconSchema for Broadcast<S> {
fn nsid() -> &'static str {
"media.ionosphere.defs"
}
fn def_name() -> &'static str {
"broadcast"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_media_ionosphere_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for Credit<S> {
fn nsid() -> &'static str {
"media.ionosphere.defs"
}
fn def_name() -> &'static str {
"credit"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_media_ionosphere_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
{
let value = &self.role;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 128usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("role"),
max: 128usize,
actual: <str>::len(value.as_ref()),
});
}
}
Ok(())
}
}
impl<S: BosStr> LexiconSchema for Entity<S> {
fn nsid() -> &'static str {
"media.ionosphere.defs"
}
fn def_name() -> &'static str {
"entity"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_media_ionosphere_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
{
let value = &self.name;
{
let count = UnicodeSegmentation::graphemes(value.as_ref(), true).count();
if count > 128usize {
return Err(ConstraintError::MaxGraphemes {
path: ValidationPath::from_field("name"),
max: 128usize,
actual: count,
});
}
}
}
{
let value = &self.r#type;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 128usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("type"),
max: 128usize,
actual: <str>::len(value.as_ref()),
});
}
}
Ok(())
}
}
impl<S: BosStr> LexiconSchema for Geocoordinates<S> {
fn nsid() -> &'static str {
"media.ionosphere.defs"
}
fn def_name() -> &'static str {
"geocoordinates"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_media_ionosphere_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
{
let value = &self.latitude;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 128usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("latitude"),
max: 128usize,
actual: <str>::len(value.as_ref()),
});
}
}
{
let value = &self.longitude;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 128usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("longitude"),
max: 128usize,
actual: <str>::len(value.as_ref()),
});
}
}
Ok(())
}
}
impl<S: BosStr> LexiconSchema for Membership<S> {
fn nsid() -> &'static str {
"media.ionosphere.defs"
}
fn def_name() -> &'static str {
"membership"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_media_ionosphere_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for Recording<S> {
fn nsid() -> &'static str {
"media.ionosphere.defs"
}
fn def_name() -> &'static str {
"recording"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_media_ionosphere_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
impl<S: BosStr> LexiconSchema for Track<S> {
fn nsid() -> &'static str {
"media.ionosphere.defs"
}
fn def_name() -> &'static str {
"track"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_media_ionosphere_defs()
}
fn validate(&self) -> Result<(), ConstraintError> {
if let Some(ref value) = self.album {
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 256usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("album"),
max: 256usize,
actual: <str>::len(value.as_ref()),
});
}
}
{
let value = &self.title;
#[allow(unused_comparisons)]
if <str>::len(value.as_ref()) > 256usize {
return Err(ConstraintError::MaxLength {
path: ValidationPath::from_field("title"),
max: 256usize,
actual: <str>::len(value.as_ref()),
});
}
}
Ok(())
}
}
fn _default_broadcast_cost() -> Option<i64> {
Some(0i64)
}
fn _default_broadcast_offset() -> Option<i64> {
Some(0i64)
}
pub mod broadcast_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 Bearer;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Bearer = Unset;
}
pub struct SetBearer<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetBearer<St> {}
impl<St: State> State for SetBearer<St> {
type Bearer = Set<members::bearer>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct bearer(());
}
}
pub struct BroadcastBuilder<S: BosStr, St: broadcast_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<media_ionosphere::Bearer<S>>,
Option<i64>,
Option<Datetime>,
Option<i64>,
Option<Datetime>,
),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> Broadcast<S> {
pub fn new() -> BroadcastBuilder<S, broadcast_state::Empty> {
BroadcastBuilder::new()
}
}
impl<S: BosStr> BroadcastBuilder<S, broadcast_state::Empty> {
pub fn new() -> Self {
BroadcastBuilder {
_state: PhantomData,
_fields: (None, None, None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> BroadcastBuilder<S, St>
where
St: broadcast_state::State,
St::Bearer: broadcast_state::IsUnset,
{
pub fn bearer(
mut self,
value: impl Into<media_ionosphere::Bearer<S>>,
) -> BroadcastBuilder<S, broadcast_state::SetBearer<St>> {
self._fields.0 = Option::Some(value.into());
BroadcastBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: broadcast_state::State> BroadcastBuilder<S, St> {
pub fn cost(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_cost(mut self, value: Option<i64>) -> Self {
self._fields.1 = value;
self
}
}
impl<S: BosStr, St: broadcast_state::State> BroadcastBuilder<S, St> {
pub fn from(mut self, value: impl Into<Option<Datetime>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_from(mut self, value: Option<Datetime>) -> Self {
self._fields.2 = value;
self
}
}
impl<S: BosStr, St: broadcast_state::State> BroadcastBuilder<S, St> {
pub fn offset(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.3 = value.into();
self
}
pub fn maybe_offset(mut self, value: Option<i64>) -> Self {
self._fields.3 = value;
self
}
}
impl<S: BosStr, St: broadcast_state::State> BroadcastBuilder<S, St> {
pub fn until(mut self, value: impl Into<Option<Datetime>>) -> Self {
self._fields.4 = value.into();
self
}
pub fn maybe_until(mut self, value: Option<Datetime>) -> Self {
self._fields.4 = value;
self
}
}
impl<S: BosStr, St> BroadcastBuilder<S, St>
where
St: broadcast_state::State,
St::Bearer: broadcast_state::IsSet,
{
pub fn build(self) -> Broadcast<S> {
Broadcast {
bearer: self._fields.0.unwrap(),
cost: self._fields.1.or_else(|| Some(0i64)),
from: self._fields.2,
offset: self._fields.3.or_else(|| Some(0i64)),
until: self._fields.4,
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> Broadcast<S> {
Broadcast {
bearer: self._fields.0.unwrap(),
cost: self._fields.1.or_else(|| Some(0i64)),
from: self._fields.2,
offset: self._fields.3.or_else(|| Some(0i64)),
until: self._fields.4,
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_media_ionosphere_defs() -> LexiconDoc<'static> {
#[allow(unused_imports)]
use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
use jacquard_lexicon::lexicon::*;
use alloc::collections::BTreeMap;
LexiconDoc {
lexicon: Lexicon::Lexicon1,
id: CowStr::new_static("media.ionosphere.defs"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("bearer"),
LexUserType::String(LexString {
description: Some(
CowStr::new_static("BearerURI as specified in ETSI TS 103 270"),
),
format: Some(LexStringFormat::Uri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("broadcast"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"Represents the method of accessing a broadcast; i.e. live",
),
),
required: Some(vec![SmolStr::new_static("bearer")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("bearer"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("media.ionosphere.defs#bearer"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("cost"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("from"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"The datetime from which this method is available",
),
),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("offset"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("until"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"The datetime where this method is no longer available",
),
),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("credit"),
LexUserType::Object(LexObject {
required: Some(
vec![SmolStr::new_static("entity"), SmolStr::new_static("role")],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("entity"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("media.ionosphere.defs#entity"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("role"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"Self-explanatory, but beware that the expected values may change in future (possibly to match TV-Anytime role classification schema)",
),
),
max_length: Some(128usize),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("entity"),
LexUserType::Object(LexObject {
required: Some(
vec![SmolStr::new_static("type"), SmolStr::new_static("name")],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("name"),
LexObjectProperty::String(LexString {
max_graphemes: Some(128usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("type"),
LexObjectProperty::String(LexString {
max_length: Some(128usize),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("genre"),
LexUserType::String(LexString {
description: Some(
CowStr::new_static(
"TV-Anytime classification scheme URIs permitted by ETSI TS 102 818 section 5.3",
),
),
format: Some(LexStringFormat::Uri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("geocoordinates"),
LexUserType::Object(LexObject {
required: Some(
vec![
SmolStr::new_static("latitude"),
SmolStr::new_static("longitude")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("latitude"),
LexObjectProperty::String(LexString {
max_length: Some(128usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("longitude"),
LexObjectProperty::String(LexString {
max_length: Some(128usize),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("membership"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"Represents membership to a group, optionally with an index",
),
),
required: Some(vec![SmolStr::new_static("group")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("group"),
LexObjectProperty::String(LexString {
format: Some(LexStringFormat::AtUri),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("index"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("recording"),
LexUserType::Object(LexObject {
description: Some(
CowStr::new_static(
"Represents the method of accessing a recording",
),
),
required: Some(vec![SmolStr::new_static("bearer")]),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("bearer"),
LexObjectProperty::Ref(LexRef {
r#ref: CowStr::new_static("media.ionosphere.defs#bearer"),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("cost"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("from"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"The datetime from which this method is available",
),
),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("until"),
LexObjectProperty::String(LexString {
description: Some(
CowStr::new_static(
"The datetime where this method is no longer available",
),
),
format: Some(LexStringFormat::Datetime),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map.insert(
SmolStr::new_static("track"),
LexUserType::Object(LexObject {
required: Some(
vec![
SmolStr::new_static("title"), SmolStr::new_static("artists")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("album"),
LexObjectProperty::String(LexString {
max_length: Some(256usize),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("artists"),
LexObjectProperty::Array(LexArray {
description: Some(
CowStr::new_static(
"Artists in order of importance to the track",
),
),
items: LexArrayItem::String(LexString {
max_length: Some(256usize),
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("title"),
LexObjectProperty::String(LexString {
max_length: Some(256usize),
..Default::default()
}),
);
map
},
..Default::default()
}),
);
map
},
..Default::default()
}
}
pub mod credit_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 Entity;
type Role;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Entity = Unset;
type Role = Unset;
}
pub struct SetEntity<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetEntity<St> {}
impl<St: State> State for SetEntity<St> {
type Entity = Set<members::entity>;
type Role = St::Role;
}
pub struct SetRole<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetRole<St> {}
impl<St: State> State for SetRole<St> {
type Entity = St::Entity;
type Role = Set<members::role>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct entity(());
pub struct role(());
}
}
pub struct CreditBuilder<S: BosStr, St: credit_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<media_ionosphere::Entity<S>>, Option<CreditRole<S>>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> Credit<S> {
pub fn new() -> CreditBuilder<S, credit_state::Empty> {
CreditBuilder::new()
}
}
impl<S: BosStr> CreditBuilder<S, credit_state::Empty> {
pub fn new() -> Self {
CreditBuilder {
_state: PhantomData,
_fields: (None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> CreditBuilder<S, St>
where
St: credit_state::State,
St::Entity: credit_state::IsUnset,
{
pub fn entity(
mut self,
value: impl Into<media_ionosphere::Entity<S>>,
) -> CreditBuilder<S, credit_state::SetEntity<St>> {
self._fields.0 = Option::Some(value.into());
CreditBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> CreditBuilder<S, St>
where
St: credit_state::State,
St::Role: credit_state::IsUnset,
{
pub fn role(
mut self,
value: impl Into<CreditRole<S>>,
) -> CreditBuilder<S, credit_state::SetRole<St>> {
self._fields.1 = Option::Some(value.into());
CreditBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> CreditBuilder<S, St>
where
St: credit_state::State,
St::Entity: credit_state::IsSet,
St::Role: credit_state::IsSet,
{
pub fn build(self) -> Credit<S> {
Credit {
entity: self._fields.0.unwrap(),
role: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> Credit<S> {
Credit {
entity: self._fields.0.unwrap(),
role: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod membership_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 Group;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Group = Unset;
}
pub struct SetGroup<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetGroup<St> {}
impl<St: State> State for SetGroup<St> {
type Group = Set<members::group>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct group(());
}
}
pub struct MembershipBuilder<S: BosStr, St: membership_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<AtUri<S>>, Option<i64>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> Membership<S> {
pub fn new() -> MembershipBuilder<S, membership_state::Empty> {
MembershipBuilder::new()
}
}
impl<S: BosStr> MembershipBuilder<S, membership_state::Empty> {
pub fn new() -> Self {
MembershipBuilder {
_state: PhantomData,
_fields: (None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> MembershipBuilder<S, St>
where
St: membership_state::State,
St::Group: membership_state::IsUnset,
{
pub fn group(
mut self,
value: impl Into<AtUri<S>>,
) -> MembershipBuilder<S, membership_state::SetGroup<St>> {
self._fields.0 = Option::Some(value.into());
MembershipBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: membership_state::State> MembershipBuilder<S, St> {
pub fn index(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_index(mut self, value: Option<i64>) -> Self {
self._fields.1 = value;
self
}
}
impl<S: BosStr, St> MembershipBuilder<S, St>
where
St: membership_state::State,
St::Group: membership_state::IsSet,
{
pub fn build(self) -> Membership<S> {
Membership {
group: self._fields.0.unwrap(),
index: self._fields.1,
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> Membership<S> {
Membership {
group: self._fields.0.unwrap(),
index: self._fields.1,
extra_data: Some(extra_data),
}
}
}
fn _default_recording_cost() -> Option<i64> {
Some(0i64)
}
pub mod recording_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 Bearer;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Bearer = Unset;
}
pub struct SetBearer<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetBearer<St> {}
impl<St: State> State for SetBearer<St> {
type Bearer = Set<members::bearer>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct bearer(());
}
}
pub struct RecordingBuilder<S: BosStr, St: recording_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (
Option<media_ionosphere::Bearer<S>>,
Option<i64>,
Option<Datetime>,
Option<Datetime>,
),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> Recording<S> {
pub fn new() -> RecordingBuilder<S, recording_state::Empty> {
RecordingBuilder::new()
}
}
impl<S: BosStr> RecordingBuilder<S, recording_state::Empty> {
pub fn new() -> Self {
RecordingBuilder {
_state: PhantomData,
_fields: (None, None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St> RecordingBuilder<S, St>
where
St: recording_state::State,
St::Bearer: recording_state::IsUnset,
{
pub fn bearer(
mut self,
value: impl Into<media_ionosphere::Bearer<S>>,
) -> RecordingBuilder<S, recording_state::SetBearer<St>> {
self._fields.0 = Option::Some(value.into());
RecordingBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St: recording_state::State> RecordingBuilder<S, St> {
pub fn cost(mut self, value: impl Into<Option<i64>>) -> Self {
self._fields.1 = value.into();
self
}
pub fn maybe_cost(mut self, value: Option<i64>) -> Self {
self._fields.1 = value;
self
}
}
impl<S: BosStr, St: recording_state::State> RecordingBuilder<S, St> {
pub fn from(mut self, value: impl Into<Option<Datetime>>) -> Self {
self._fields.2 = value.into();
self
}
pub fn maybe_from(mut self, value: Option<Datetime>) -> Self {
self._fields.2 = value;
self
}
}
impl<S: BosStr, St: recording_state::State> RecordingBuilder<S, St> {
pub fn until(mut self, value: impl Into<Option<Datetime>>) -> Self {
self._fields.3 = value.into();
self
}
pub fn maybe_until(mut self, value: Option<Datetime>) -> Self {
self._fields.3 = value;
self
}
}
impl<S: BosStr, St> RecordingBuilder<S, St>
where
St: recording_state::State,
St::Bearer: recording_state::IsSet,
{
pub fn build(self) -> Recording<S> {
Recording {
bearer: self._fields.0.unwrap(),
cost: self._fields.1.or_else(|| Some(0i64)),
from: self._fields.2,
until: self._fields.3,
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> Recording<S> {
Recording {
bearer: self._fields.0.unwrap(),
cost: self._fields.1.or_else(|| Some(0i64)),
from: self._fields.2,
until: self._fields.3,
extra_data: Some(extra_data),
}
}
}
pub mod track_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 Artists;
type Title;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Artists = Unset;
type Title = Unset;
}
pub struct SetArtists<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetArtists<St> {}
impl<St: State> State for SetArtists<St> {
type Artists = Set<members::artists>;
type Title = St::Title;
}
pub struct SetTitle<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetTitle<St> {}
impl<St: State> State for SetTitle<St> {
type Artists = St::Artists;
type Title = Set<members::title>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct artists(());
pub struct title(());
}
}
pub struct TrackBuilder<S: BosStr, St: track_state::State> {
_state: PhantomData<fn() -> St>,
_fields: (Option<S>, Option<Vec<S>>, Option<S>),
_type: PhantomData<fn() -> S>,
}
impl<S: BosStr> Track<S> {
pub fn new() -> TrackBuilder<S, track_state::Empty> {
TrackBuilder::new()
}
}
impl<S: BosStr> TrackBuilder<S, track_state::Empty> {
pub fn new() -> Self {
TrackBuilder {
_state: PhantomData,
_fields: (None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr, St: track_state::State> TrackBuilder<S, St> {
pub fn album(mut self, value: impl Into<Option<S>>) -> Self {
self._fields.0 = value.into();
self
}
pub fn maybe_album(mut self, value: Option<S>) -> Self {
self._fields.0 = value;
self
}
}
impl<S: BosStr, St> TrackBuilder<S, St>
where
St: track_state::State,
St::Artists: track_state::IsUnset,
{
pub fn artists(
mut self,
value: impl Into<Vec<S>>,
) -> TrackBuilder<S, track_state::SetArtists<St>> {
self._fields.1 = Option::Some(value.into());
TrackBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> TrackBuilder<S, St>
where
St: track_state::State,
St::Title: track_state::IsUnset,
{
pub fn title(
mut self,
value: impl Into<S>,
) -> TrackBuilder<S, track_state::SetTitle<St>> {
self._fields.2 = Option::Some(value.into());
TrackBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<S: BosStr, St> TrackBuilder<S, St>
where
St: track_state::State,
St::Artists: track_state::IsSet,
St::Title: track_state::IsSet,
{
pub fn build(self) -> Track<S> {
Track {
album: self._fields.0,
artists: self._fields.1.unwrap(),
title: self._fields.2.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(self, extra_data: BTreeMap<SmolStr, Data<S>>) -> Track<S> {
Track {
album: self._fields.0,
artists: self._fields.1.unwrap(),
title: self._fields.2.unwrap(),
extra_data: Some(extra_data),
}
}
}