#[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::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_firehose::barklesheep::place_sheeps;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct PlaceSheeps<S: BosStr = DefaultStr> {
pub game_id: S,
pub sheeps: Vec<place_sheeps::SheepPlacement<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, Default)]
#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
pub struct PlaceSheepsOutput<S: BosStr = DefaultStr> {
#[serde(skip_serializing_if = "Option::is_none")]
pub success: Option<bool>,
#[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 SheepPlacement<S: BosStr = DefaultStr> {
pub horizontal: bool,
pub start: i64,
pub r#type: S,
#[serde(flatten, default, skip_serializing_if = "Option::is_none")]
pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
}
pub struct PlaceSheepsResponse;
impl jacquard_common::xrpc::XrpcResp for PlaceSheepsResponse {
const NSID: &'static str = "games.firehose.barklesheep.placeSheeps";
const ENCODING: &'static str = "application/json";
type Output<S: BosStr> = PlaceSheepsOutput<S>;
type Err = jacquard_common::xrpc::GenericError;
}
impl<S: BosStr> jacquard_common::xrpc::XrpcRequest for PlaceSheeps<S> {
const NSID: &'static str = "games.firehose.barklesheep.placeSheeps";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
"application/json",
);
type Response = PlaceSheepsResponse;
}
pub struct PlaceSheepsRequest;
impl jacquard_common::xrpc::XrpcEndpoint for PlaceSheepsRequest {
const PATH: &'static str = "/xrpc/games.firehose.barklesheep.placeSheeps";
const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
"application/json",
);
type Request<S: BosStr> = PlaceSheeps<S>;
type Response = PlaceSheepsResponse;
}
impl<S: BosStr> LexiconSchema for SheepPlacement<S> {
fn nsid() -> &'static str {
"games.firehose.barklesheep.placeSheeps"
}
fn def_name() -> &'static str {
"sheepPlacement"
}
fn lexicon_doc() -> LexiconDoc<'static> {
lexicon_doc_games_firehose_barklesheep_placeSheeps()
}
fn validate(&self) -> Result<(), ConstraintError> {
Ok(())
}
}
pub mod place_sheeps_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 GameId;
type Sheeps;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type GameId = Unset;
type Sheeps = Unset;
}
pub struct SetGameId<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetGameId<St> {}
impl<St: State> State for SetGameId<St> {
type GameId = Set<members::game_id>;
type Sheeps = St::Sheeps;
}
pub struct SetSheeps<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetSheeps<St> {}
impl<St: State> State for SetSheeps<St> {
type GameId = St::GameId;
type Sheeps = Set<members::sheeps>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct game_id(());
pub struct sheeps(());
}
}
pub struct PlaceSheepsBuilder<St: place_sheeps_state::State, S: BosStr = DefaultStr> {
_state: PhantomData<fn() -> St>,
_fields: (Option<S>, Option<Vec<place_sheeps::SheepPlacement<S>>>),
_type: PhantomData<fn() -> S>,
}
impl PlaceSheeps<DefaultStr> {
pub fn new() -> PlaceSheepsBuilder<place_sheeps_state::Empty, DefaultStr> {
PlaceSheepsBuilder::new()
}
}
impl<S: BosStr> PlaceSheeps<S> {
pub fn builder() -> PlaceSheepsBuilder<place_sheeps_state::Empty, S> {
PlaceSheepsBuilder::builder()
}
}
impl PlaceSheepsBuilder<place_sheeps_state::Empty, DefaultStr> {
pub fn new() -> Self {
PlaceSheepsBuilder {
_state: PhantomData,
_fields: (None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr> PlaceSheepsBuilder<place_sheeps_state::Empty, S> {
pub fn builder() -> Self {
PlaceSheepsBuilder {
_state: PhantomData,
_fields: (None, None),
_type: PhantomData,
}
}
}
impl<St, S: BosStr> PlaceSheepsBuilder<St, S>
where
St: place_sheeps_state::State,
St::GameId: place_sheeps_state::IsUnset,
{
pub fn game_id(
mut self,
value: impl Into<S>,
) -> PlaceSheepsBuilder<place_sheeps_state::SetGameId<St>, S> {
self._fields.0 = Option::Some(value.into());
PlaceSheepsBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> PlaceSheepsBuilder<St, S>
where
St: place_sheeps_state::State,
St::Sheeps: place_sheeps_state::IsUnset,
{
pub fn sheeps(
mut self,
value: impl Into<Vec<place_sheeps::SheepPlacement<S>>>,
) -> PlaceSheepsBuilder<place_sheeps_state::SetSheeps<St>, S> {
self._fields.1 = Option::Some(value.into());
PlaceSheepsBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> PlaceSheepsBuilder<St, S>
where
St: place_sheeps_state::State,
St::GameId: place_sheeps_state::IsSet,
St::Sheeps: place_sheeps_state::IsSet,
{
pub fn build(self) -> PlaceSheeps<S> {
PlaceSheeps {
game_id: self._fields.0.unwrap(),
sheeps: self._fields.1.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> PlaceSheeps<S> {
PlaceSheeps {
game_id: self._fields.0.unwrap(),
sheeps: self._fields.1.unwrap(),
extra_data: Some(extra_data),
}
}
}
pub mod sheep_placement_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 Horizontal;
type Start;
type Type;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Horizontal = Unset;
type Start = Unset;
type Type = Unset;
}
pub struct SetHorizontal<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetHorizontal<St> {}
impl<St: State> State for SetHorizontal<St> {
type Horizontal = Set<members::horizontal>;
type Start = St::Start;
type Type = St::Type;
}
pub struct SetStart<St: State = Empty>(PhantomData<fn() -> St>);
impl<St: State> sealed::Sealed for SetStart<St> {}
impl<St: State> State for SetStart<St> {
type Horizontal = St::Horizontal;
type Start = Set<members::start>;
type Type = St::Type;
}
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 Horizontal = St::Horizontal;
type Start = St::Start;
type Type = Set<members::r#type>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct horizontal(());
pub struct start(());
pub struct r#type(());
}
}
pub struct SheepPlacementBuilder<
St: sheep_placement_state::State,
S: BosStr = DefaultStr,
> {
_state: PhantomData<fn() -> St>,
_fields: (Option<bool>, Option<i64>, Option<S>),
_type: PhantomData<fn() -> S>,
}
impl SheepPlacement<DefaultStr> {
pub fn new() -> SheepPlacementBuilder<sheep_placement_state::Empty, DefaultStr> {
SheepPlacementBuilder::new()
}
}
impl<S: BosStr> SheepPlacement<S> {
pub fn builder() -> SheepPlacementBuilder<sheep_placement_state::Empty, S> {
SheepPlacementBuilder::builder()
}
}
impl SheepPlacementBuilder<sheep_placement_state::Empty, DefaultStr> {
pub fn new() -> Self {
SheepPlacementBuilder {
_state: PhantomData,
_fields: (None, None, None),
_type: PhantomData,
}
}
}
impl<S: BosStr> SheepPlacementBuilder<sheep_placement_state::Empty, S> {
pub fn builder() -> Self {
SheepPlacementBuilder {
_state: PhantomData,
_fields: (None, None, None),
_type: PhantomData,
}
}
}
impl<St, S: BosStr> SheepPlacementBuilder<St, S>
where
St: sheep_placement_state::State,
St::Horizontal: sheep_placement_state::IsUnset,
{
pub fn horizontal(
mut self,
value: impl Into<bool>,
) -> SheepPlacementBuilder<sheep_placement_state::SetHorizontal<St>, S> {
self._fields.0 = Option::Some(value.into());
SheepPlacementBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> SheepPlacementBuilder<St, S>
where
St: sheep_placement_state::State,
St::Start: sheep_placement_state::IsUnset,
{
pub fn start(
mut self,
value: impl Into<i64>,
) -> SheepPlacementBuilder<sheep_placement_state::SetStart<St>, S> {
self._fields.1 = Option::Some(value.into());
SheepPlacementBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> SheepPlacementBuilder<St, S>
where
St: sheep_placement_state::State,
St::Type: sheep_placement_state::IsUnset,
{
pub fn r#type(
mut self,
value: impl Into<S>,
) -> SheepPlacementBuilder<sheep_placement_state::SetType<St>, S> {
self._fields.2 = Option::Some(value.into());
SheepPlacementBuilder {
_state: PhantomData,
_fields: self._fields,
_type: PhantomData,
}
}
}
impl<St, S: BosStr> SheepPlacementBuilder<St, S>
where
St: sheep_placement_state::State,
St::Horizontal: sheep_placement_state::IsSet,
St::Start: sheep_placement_state::IsSet,
St::Type: sheep_placement_state::IsSet,
{
pub fn build(self) -> SheepPlacement<S> {
SheepPlacement {
horizontal: self._fields.0.unwrap(),
start: self._fields.1.unwrap(),
r#type: self._fields.2.unwrap(),
extra_data: Default::default(),
}
}
pub fn build_with_data(
self,
extra_data: BTreeMap<SmolStr, Data<S>>,
) -> SheepPlacement<S> {
SheepPlacement {
horizontal: self._fields.0.unwrap(),
start: self._fields.1.unwrap(),
r#type: self._fields.2.unwrap(),
extra_data: Some(extra_data),
}
}
}
fn lexicon_doc_games_firehose_barklesheep_placeSheeps() -> 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.firehose.barklesheep.placeSheeps"),
defs: {
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("main"),
LexUserType::XrpcProcedure(LexXrpcProcedure {
input: Some(LexXrpcBody {
encoding: CowStr::new_static("application/json"),
schema: Some(
LexXrpcBodySchema::Object(LexObject {
required: Some(
vec![
SmolStr::new_static("gameId"), SmolStr::new_static("sheeps")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("gameId"),
LexObjectProperty::String(LexString {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("sheeps"),
LexObjectProperty::Array(LexArray {
items: LexArrayItem::Ref(LexRef {
r#ref: CowStr::new_static("#sheepPlacement"),
..Default::default()
}),
..Default::default()
}),
);
map
},
..Default::default()
}),
),
..Default::default()
}),
..Default::default()
}),
);
map.insert(
SmolStr::new_static("sheepPlacement"),
LexUserType::Object(LexObject {
required: Some(
vec![
SmolStr::new_static("type"), SmolStr::new_static("start"),
SmolStr::new_static("horizontal")
],
),
properties: {
#[allow(unused_mut)]
let mut map = BTreeMap::new();
map.insert(
SmolStr::new_static("horizontal"),
LexObjectProperty::Boolean(LexBoolean {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("start"),
LexObjectProperty::Integer(LexInteger {
..Default::default()
}),
);
map.insert(
SmolStr::new_static("type"),
LexObjectProperty::String(LexString { ..Default::default() }),
);
map
},
..Default::default()
}),
);
map
},
..Default::default()
}
}