#[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_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_firehose::barklesheep::place_sheeps;
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct PlaceSheeps<'a> {
#[serde(borrow)]
pub game_id: CowStr<'a>,
#[serde(borrow)]
pub sheeps: Vec<place_sheeps::SheepPlacement<'a>>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct PlaceSheepsOutput<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
pub success: Option<bool>,
}
#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct SheepPlacement<'a> {
pub horizontal: bool,
pub start: i64,
#[serde(borrow)]
pub r#type: CowStr<'a>,
}
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<'de> = PlaceSheepsOutput<'de>;
type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
}
impl<'a> jacquard_common::xrpc::XrpcRequest for PlaceSheeps<'a> {
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<'de> = PlaceSheeps<'de>;
type Response = PlaceSheepsResponse;
}
impl<'a> LexiconSchema for SheepPlacement<'a> {
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<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetGameId<S> {}
impl<S: State> State for SetGameId<S> {
type GameId = Set<members::game_id>;
type Sheeps = S::Sheeps;
}
pub struct SetSheeps<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetSheeps<S> {}
impl<S: State> State for SetSheeps<S> {
type GameId = S::GameId;
type Sheeps = Set<members::sheeps>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct game_id(());
pub struct sheeps(());
}
}
pub struct PlaceSheepsBuilder<'a, S: place_sheeps_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<CowStr<'a>>, Option<Vec<place_sheeps::SheepPlacement<'a>>>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> PlaceSheeps<'a> {
pub fn new() -> PlaceSheepsBuilder<'a, place_sheeps_state::Empty> {
PlaceSheepsBuilder::new()
}
}
impl<'a> PlaceSheepsBuilder<'a, place_sheeps_state::Empty> {
pub fn new() -> Self {
PlaceSheepsBuilder {
_state: PhantomData,
_fields: (None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> PlaceSheepsBuilder<'a, S>
where
S: place_sheeps_state::State,
S::GameId: place_sheeps_state::IsUnset,
{
pub fn game_id(
mut self,
value: impl Into<CowStr<'a>>,
) -> PlaceSheepsBuilder<'a, place_sheeps_state::SetGameId<S>> {
self._fields.0 = Option::Some(value.into());
PlaceSheepsBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> PlaceSheepsBuilder<'a, S>
where
S: place_sheeps_state::State,
S::Sheeps: place_sheeps_state::IsUnset,
{
pub fn sheeps(
mut self,
value: impl Into<Vec<place_sheeps::SheepPlacement<'a>>>,
) -> PlaceSheepsBuilder<'a, place_sheeps_state::SetSheeps<S>> {
self._fields.1 = Option::Some(value.into());
PlaceSheepsBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> PlaceSheepsBuilder<'a, S>
where
S: place_sheeps_state::State,
S::GameId: place_sheeps_state::IsSet,
S::Sheeps: place_sheeps_state::IsSet,
{
pub fn build(self) -> PlaceSheeps<'a> {
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<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> PlaceSheeps<'a> {
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 Type;
type Start;
type Horizontal;
}
pub struct Empty(());
impl sealed::Sealed for Empty {}
impl State for Empty {
type Type = Unset;
type Start = Unset;
type Horizontal = Unset;
}
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 Type = Set<members::r#type>;
type Start = S::Start;
type Horizontal = S::Horizontal;
}
pub struct SetStart<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetStart<S> {}
impl<S: State> State for SetStart<S> {
type Type = S::Type;
type Start = Set<members::start>;
type Horizontal = S::Horizontal;
}
pub struct SetHorizontal<S: State = Empty>(PhantomData<fn() -> S>);
impl<S: State> sealed::Sealed for SetHorizontal<S> {}
impl<S: State> State for SetHorizontal<S> {
type Type = S::Type;
type Start = S::Start;
type Horizontal = Set<members::horizontal>;
}
#[allow(non_camel_case_types)]
pub mod members {
pub struct r#type(());
pub struct start(());
pub struct horizontal(());
}
}
pub struct SheepPlacementBuilder<'a, S: sheep_placement_state::State> {
_state: PhantomData<fn() -> S>,
_fields: (Option<bool>, Option<i64>, Option<CowStr<'a>>),
_lifetime: PhantomData<&'a ()>,
}
impl<'a> SheepPlacement<'a> {
pub fn new() -> SheepPlacementBuilder<'a, sheep_placement_state::Empty> {
SheepPlacementBuilder::new()
}
}
impl<'a> SheepPlacementBuilder<'a, sheep_placement_state::Empty> {
pub fn new() -> Self {
SheepPlacementBuilder {
_state: PhantomData,
_fields: (None, None, None),
_lifetime: PhantomData,
}
}
}
impl<'a, S> SheepPlacementBuilder<'a, S>
where
S: sheep_placement_state::State,
S::Horizontal: sheep_placement_state::IsUnset,
{
pub fn horizontal(
mut self,
value: impl Into<bool>,
) -> SheepPlacementBuilder<'a, sheep_placement_state::SetHorizontal<S>> {
self._fields.0 = Option::Some(value.into());
SheepPlacementBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> SheepPlacementBuilder<'a, S>
where
S: sheep_placement_state::State,
S::Start: sheep_placement_state::IsUnset,
{
pub fn start(
mut self,
value: impl Into<i64>,
) -> SheepPlacementBuilder<'a, sheep_placement_state::SetStart<S>> {
self._fields.1 = Option::Some(value.into());
SheepPlacementBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> SheepPlacementBuilder<'a, S>
where
S: sheep_placement_state::State,
S::Type: sheep_placement_state::IsUnset,
{
pub fn r#type(
mut self,
value: impl Into<CowStr<'a>>,
) -> SheepPlacementBuilder<'a, sheep_placement_state::SetType<S>> {
self._fields.2 = Option::Some(value.into());
SheepPlacementBuilder {
_state: PhantomData,
_fields: self._fields,
_lifetime: PhantomData,
}
}
}
impl<'a, S> SheepPlacementBuilder<'a, S>
where
S: sheep_placement_state::State,
S::Type: sheep_placement_state::IsSet,
S::Start: sheep_placement_state::IsSet,
S::Horizontal: sheep_placement_state::IsSet,
{
pub fn build(self) -> SheepPlacement<'a> {
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<
jacquard_common::deps::smol_str::SmolStr,
jacquard_common::types::value::Data<'a>,
>,
) -> SheepPlacement<'a> {
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()
}
}