1pub mod invite;
9pub mod request;
10
11
12#[allow(unused_imports)]
13use alloc::collections::BTreeMap;
14
15#[allow(unused_imports)]
16use core::marker::PhantomData;
17
18#[allow(unused_imports)]
19use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
20use jacquard_common::types::string::{Did, AtUri, Datetime};
21use jacquard_derive::{IntoStatic, lexicon};
22use jacquard_lexicon::lexicon::LexiconDoc;
23use jacquard_lexicon::schema::LexiconSchema;
24
25#[allow(unused_imports)]
26use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
27use serde::{Serialize, Deserialize};
28use crate::app_bsky::actor::ProfileViewBasic;
29#[lexicon]
32#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
33#[serde(rename_all = "camelCase")]
34pub struct InviteView<'a> {
35 pub created_at: Datetime,
37 #[serde(borrow)]
39 pub did: Did<'a>,
40 #[serde(skip_serializing_if = "Option::is_none")]
42 pub expires_at: Option<Datetime>,
43 #[serde(skip_serializing_if = "Option::is_none")]
45 #[serde(borrow)]
46 pub profile: Option<ProfileViewBasic<'a>>,
47 #[serde(borrow)]
49 pub slice: AtUri<'a>,
50 #[serde(skip_serializing_if = "Option::is_none")]
52 #[serde(borrow)]
53 pub uri: Option<AtUri<'a>>,
54}
55
56#[lexicon]
59#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
60#[serde(rename_all = "camelCase")]
61pub struct RequestView<'a> {
62 pub created_at: Datetime,
64 #[serde(skip_serializing_if = "Option::is_none")]
66 #[serde(borrow)]
67 pub profile: Option<ProfileViewBasic<'a>>,
68 #[serde(borrow)]
70 pub slice: AtUri<'a>,
71}
72
73impl<'a> LexiconSchema for InviteView<'a> {
74 fn nsid() -> &'static str {
75 "network.slices.waitlist.defs"
76 }
77 fn def_name() -> &'static str {
78 "inviteView"
79 }
80 fn lexicon_doc() -> LexiconDoc<'static> {
81 lexicon_doc_network_slices_waitlist_defs()
82 }
83 fn validate(&self) -> Result<(), ConstraintError> {
84 Ok(())
85 }
86}
87
88impl<'a> LexiconSchema for RequestView<'a> {
89 fn nsid() -> &'static str {
90 "network.slices.waitlist.defs"
91 }
92 fn def_name() -> &'static str {
93 "requestView"
94 }
95 fn lexicon_doc() -> LexiconDoc<'static> {
96 lexicon_doc_network_slices_waitlist_defs()
97 }
98 fn validate(&self) -> Result<(), ConstraintError> {
99 Ok(())
100 }
101}
102
103pub mod invite_view_state {
104
105 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
106 #[allow(unused)]
107 use ::core::marker::PhantomData;
108 mod sealed {
109 pub trait Sealed {}
110 }
111 pub trait State: sealed::Sealed {
113 type Slice;
114 type CreatedAt;
115 type Did;
116 }
117 pub struct Empty(());
119 impl sealed::Sealed for Empty {}
120 impl State for Empty {
121 type Slice = Unset;
122 type CreatedAt = Unset;
123 type Did = Unset;
124 }
125 pub struct SetSlice<S: State = Empty>(PhantomData<fn() -> S>);
127 impl<S: State> sealed::Sealed for SetSlice<S> {}
128 impl<S: State> State for SetSlice<S> {
129 type Slice = Set<members::slice>;
130 type CreatedAt = S::CreatedAt;
131 type Did = S::Did;
132 }
133 pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>);
135 impl<S: State> sealed::Sealed for SetCreatedAt<S> {}
136 impl<S: State> State for SetCreatedAt<S> {
137 type Slice = S::Slice;
138 type CreatedAt = Set<members::created_at>;
139 type Did = S::Did;
140 }
141 pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>);
143 impl<S: State> sealed::Sealed for SetDid<S> {}
144 impl<S: State> State for SetDid<S> {
145 type Slice = S::Slice;
146 type CreatedAt = S::CreatedAt;
147 type Did = Set<members::did>;
148 }
149 #[allow(non_camel_case_types)]
151 pub mod members {
152 pub struct slice(());
154 pub struct created_at(());
156 pub struct did(());
158 }
159}
160
161pub struct InviteViewBuilder<'a, S: invite_view_state::State> {
163 _state: PhantomData<fn() -> S>,
164 _fields: (
165 Option<Datetime>,
166 Option<Did<'a>>,
167 Option<Datetime>,
168 Option<ProfileViewBasic<'a>>,
169 Option<AtUri<'a>>,
170 Option<AtUri<'a>>,
171 ),
172 _lifetime: PhantomData<&'a ()>,
173}
174
175impl<'a> InviteView<'a> {
176 pub fn new() -> InviteViewBuilder<'a, invite_view_state::Empty> {
178 InviteViewBuilder::new()
179 }
180}
181
182impl<'a> InviteViewBuilder<'a, invite_view_state::Empty> {
183 pub fn new() -> Self {
185 InviteViewBuilder {
186 _state: PhantomData,
187 _fields: (None, None, None, None, None, None),
188 _lifetime: PhantomData,
189 }
190 }
191}
192
193impl<'a, S> InviteViewBuilder<'a, S>
194where
195 S: invite_view_state::State,
196 S::CreatedAt: invite_view_state::IsUnset,
197{
198 pub fn created_at(
200 mut self,
201 value: impl Into<Datetime>,
202 ) -> InviteViewBuilder<'a, invite_view_state::SetCreatedAt<S>> {
203 self._fields.0 = Option::Some(value.into());
204 InviteViewBuilder {
205 _state: PhantomData,
206 _fields: self._fields,
207 _lifetime: PhantomData,
208 }
209 }
210}
211
212impl<'a, S> InviteViewBuilder<'a, S>
213where
214 S: invite_view_state::State,
215 S::Did: invite_view_state::IsUnset,
216{
217 pub fn did(
219 mut self,
220 value: impl Into<Did<'a>>,
221 ) -> InviteViewBuilder<'a, invite_view_state::SetDid<S>> {
222 self._fields.1 = Option::Some(value.into());
223 InviteViewBuilder {
224 _state: PhantomData,
225 _fields: self._fields,
226 _lifetime: PhantomData,
227 }
228 }
229}
230
231impl<'a, S: invite_view_state::State> InviteViewBuilder<'a, S> {
232 pub fn expires_at(mut self, value: impl Into<Option<Datetime>>) -> Self {
234 self._fields.2 = value.into();
235 self
236 }
237 pub fn maybe_expires_at(mut self, value: Option<Datetime>) -> Self {
239 self._fields.2 = value;
240 self
241 }
242}
243
244impl<'a, S: invite_view_state::State> InviteViewBuilder<'a, S> {
245 pub fn profile(mut self, value: impl Into<Option<ProfileViewBasic<'a>>>) -> Self {
247 self._fields.3 = value.into();
248 self
249 }
250 pub fn maybe_profile(mut self, value: Option<ProfileViewBasic<'a>>) -> Self {
252 self._fields.3 = value;
253 self
254 }
255}
256
257impl<'a, S> InviteViewBuilder<'a, S>
258where
259 S: invite_view_state::State,
260 S::Slice: invite_view_state::IsUnset,
261{
262 pub fn slice(
264 mut self,
265 value: impl Into<AtUri<'a>>,
266 ) -> InviteViewBuilder<'a, invite_view_state::SetSlice<S>> {
267 self._fields.4 = Option::Some(value.into());
268 InviteViewBuilder {
269 _state: PhantomData,
270 _fields: self._fields,
271 _lifetime: PhantomData,
272 }
273 }
274}
275
276impl<'a, S: invite_view_state::State> InviteViewBuilder<'a, S> {
277 pub fn uri(mut self, value: impl Into<Option<AtUri<'a>>>) -> Self {
279 self._fields.5 = value.into();
280 self
281 }
282 pub fn maybe_uri(mut self, value: Option<AtUri<'a>>) -> Self {
284 self._fields.5 = value;
285 self
286 }
287}
288
289impl<'a, S> InviteViewBuilder<'a, S>
290where
291 S: invite_view_state::State,
292 S::Slice: invite_view_state::IsSet,
293 S::CreatedAt: invite_view_state::IsSet,
294 S::Did: invite_view_state::IsSet,
295{
296 pub fn build(self) -> InviteView<'a> {
298 InviteView {
299 created_at: self._fields.0.unwrap(),
300 did: self._fields.1.unwrap(),
301 expires_at: self._fields.2,
302 profile: self._fields.3,
303 slice: self._fields.4.unwrap(),
304 uri: self._fields.5,
305 extra_data: Default::default(),
306 }
307 }
308 pub fn build_with_data(
310 self,
311 extra_data: BTreeMap<
312 jacquard_common::deps::smol_str::SmolStr,
313 jacquard_common::types::value::Data<'a>,
314 >,
315 ) -> InviteView<'a> {
316 InviteView {
317 created_at: self._fields.0.unwrap(),
318 did: self._fields.1.unwrap(),
319 expires_at: self._fields.2,
320 profile: self._fields.3,
321 slice: self._fields.4.unwrap(),
322 uri: self._fields.5,
323 extra_data: Some(extra_data),
324 }
325 }
326}
327
328fn lexicon_doc_network_slices_waitlist_defs() -> LexiconDoc<'static> {
329 #[allow(unused_imports)]
330 use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
331 use jacquard_lexicon::lexicon::*;
332 use alloc::collections::BTreeMap;
333 LexiconDoc {
334 lexicon: Lexicon::Lexicon1,
335 id: CowStr::new_static("network.slices.waitlist.defs"),
336 defs: {
337 let mut map = BTreeMap::new();
338 map.insert(
339 SmolStr::new_static("inviteView"),
340 LexUserType::Object(LexObject {
341 description: Some(
342 CowStr::new_static(
343 "An invite granting a DID access with profile information",
344 ),
345 ),
346 required: Some(
347 vec![
348 SmolStr::new_static("did"), SmolStr::new_static("slice"),
349 SmolStr::new_static("createdAt")
350 ],
351 ),
352 properties: {
353 #[allow(unused_mut)]
354 let mut map = BTreeMap::new();
355 map.insert(
356 SmolStr::new_static("createdAt"),
357 LexObjectProperty::String(LexString {
358 description: Some(
359 CowStr::new_static("When this invitation was created"),
360 ),
361 format: Some(LexStringFormat::Datetime),
362 ..Default::default()
363 }),
364 );
365 map.insert(
366 SmolStr::new_static("did"),
367 LexObjectProperty::String(LexString {
368 description: Some(
369 CowStr::new_static("The DID being invited"),
370 ),
371 format: Some(LexStringFormat::Did),
372 ..Default::default()
373 }),
374 );
375 map.insert(
376 SmolStr::new_static("expiresAt"),
377 LexObjectProperty::String(LexString {
378 description: Some(
379 CowStr::new_static(
380 "Optional expiration date for this invitation",
381 ),
382 ),
383 format: Some(LexStringFormat::Datetime),
384 ..Default::default()
385 }),
386 );
387 map.insert(
388 SmolStr::new_static("profile"),
389 LexObjectProperty::Ref(LexRef {
390 r#ref: CowStr::new_static(
391 "app.bsky.actor.defs#profileViewBasic",
392 ),
393 ..Default::default()
394 }),
395 );
396 map.insert(
397 SmolStr::new_static("slice"),
398 LexObjectProperty::String(LexString {
399 description: Some(
400 CowStr::new_static(
401 "The AT URI of the slice this invite is for",
402 ),
403 ),
404 format: Some(LexStringFormat::AtUri),
405 ..Default::default()
406 }),
407 );
408 map.insert(
409 SmolStr::new_static("uri"),
410 LexObjectProperty::String(LexString {
411 description: Some(
412 CowStr::new_static("The AT URI of this invite record"),
413 ),
414 format: Some(LexStringFormat::AtUri),
415 ..Default::default()
416 }),
417 );
418 map
419 },
420 ..Default::default()
421 }),
422 );
423 map.insert(
424 SmolStr::new_static("requestView"),
425 LexUserType::Object(LexObject {
426 description: Some(
427 CowStr::new_static(
428 "A request to join the waitlist with profile information",
429 ),
430 ),
431 required: Some(
432 vec![
433 SmolStr::new_static("slice"),
434 SmolStr::new_static("createdAt")
435 ],
436 ),
437 properties: {
438 #[allow(unused_mut)]
439 let mut map = BTreeMap::new();
440 map.insert(
441 SmolStr::new_static("createdAt"),
442 LexObjectProperty::String(LexString {
443 description: Some(
444 CowStr::new_static("When the user joined the waitlist"),
445 ),
446 format: Some(LexStringFormat::Datetime),
447 ..Default::default()
448 }),
449 );
450 map.insert(
451 SmolStr::new_static("profile"),
452 LexObjectProperty::Ref(LexRef {
453 r#ref: CowStr::new_static(
454 "app.bsky.actor.defs#profileViewBasic",
455 ),
456 ..Default::default()
457 }),
458 );
459 map.insert(
460 SmolStr::new_static("slice"),
461 LexObjectProperty::String(LexString {
462 description: Some(
463 CowStr::new_static(
464 "The AT URI of the slice being requested access to",
465 ),
466 ),
467 format: Some(LexStringFormat::AtUri),
468 ..Default::default()
469 }),
470 );
471 map
472 },
473 ..Default::default()
474 }),
475 );
476 map
477 },
478 ..Default::default()
479 }
480}
481
482pub mod request_view_state {
483
484 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
485 #[allow(unused)]
486 use ::core::marker::PhantomData;
487 mod sealed {
488 pub trait Sealed {}
489 }
490 pub trait State: sealed::Sealed {
492 type Slice;
493 type CreatedAt;
494 }
495 pub struct Empty(());
497 impl sealed::Sealed for Empty {}
498 impl State for Empty {
499 type Slice = Unset;
500 type CreatedAt = Unset;
501 }
502 pub struct SetSlice<S: State = Empty>(PhantomData<fn() -> S>);
504 impl<S: State> sealed::Sealed for SetSlice<S> {}
505 impl<S: State> State for SetSlice<S> {
506 type Slice = Set<members::slice>;
507 type CreatedAt = S::CreatedAt;
508 }
509 pub struct SetCreatedAt<S: State = Empty>(PhantomData<fn() -> S>);
511 impl<S: State> sealed::Sealed for SetCreatedAt<S> {}
512 impl<S: State> State for SetCreatedAt<S> {
513 type Slice = S::Slice;
514 type CreatedAt = Set<members::created_at>;
515 }
516 #[allow(non_camel_case_types)]
518 pub mod members {
519 pub struct slice(());
521 pub struct created_at(());
523 }
524}
525
526pub struct RequestViewBuilder<'a, S: request_view_state::State> {
528 _state: PhantomData<fn() -> S>,
529 _fields: (Option<Datetime>, Option<ProfileViewBasic<'a>>, Option<AtUri<'a>>),
530 _lifetime: PhantomData<&'a ()>,
531}
532
533impl<'a> RequestView<'a> {
534 pub fn new() -> RequestViewBuilder<'a, request_view_state::Empty> {
536 RequestViewBuilder::new()
537 }
538}
539
540impl<'a> RequestViewBuilder<'a, request_view_state::Empty> {
541 pub fn new() -> Self {
543 RequestViewBuilder {
544 _state: PhantomData,
545 _fields: (None, None, None),
546 _lifetime: PhantomData,
547 }
548 }
549}
550
551impl<'a, S> RequestViewBuilder<'a, S>
552where
553 S: request_view_state::State,
554 S::CreatedAt: request_view_state::IsUnset,
555{
556 pub fn created_at(
558 mut self,
559 value: impl Into<Datetime>,
560 ) -> RequestViewBuilder<'a, request_view_state::SetCreatedAt<S>> {
561 self._fields.0 = Option::Some(value.into());
562 RequestViewBuilder {
563 _state: PhantomData,
564 _fields: self._fields,
565 _lifetime: PhantomData,
566 }
567 }
568}
569
570impl<'a, S: request_view_state::State> RequestViewBuilder<'a, S> {
571 pub fn profile(mut self, value: impl Into<Option<ProfileViewBasic<'a>>>) -> Self {
573 self._fields.1 = value.into();
574 self
575 }
576 pub fn maybe_profile(mut self, value: Option<ProfileViewBasic<'a>>) -> Self {
578 self._fields.1 = value;
579 self
580 }
581}
582
583impl<'a, S> RequestViewBuilder<'a, S>
584where
585 S: request_view_state::State,
586 S::Slice: request_view_state::IsUnset,
587{
588 pub fn slice(
590 mut self,
591 value: impl Into<AtUri<'a>>,
592 ) -> RequestViewBuilder<'a, request_view_state::SetSlice<S>> {
593 self._fields.2 = Option::Some(value.into());
594 RequestViewBuilder {
595 _state: PhantomData,
596 _fields: self._fields,
597 _lifetime: PhantomData,
598 }
599 }
600}
601
602impl<'a, S> RequestViewBuilder<'a, S>
603where
604 S: request_view_state::State,
605 S::Slice: request_view_state::IsSet,
606 S::CreatedAt: request_view_state::IsSet,
607{
608 pub fn build(self) -> RequestView<'a> {
610 RequestView {
611 created_at: self._fields.0.unwrap(),
612 profile: self._fields.1,
613 slice: self._fields.2.unwrap(),
614 extra_data: Default::default(),
615 }
616 }
617 pub fn build_with_data(
619 self,
620 extra_data: BTreeMap<
621 jacquard_common::deps::smol_str::SmolStr,
622 jacquard_common::types::value::Data<'a>,
623 >,
624 ) -> RequestView<'a> {
625 RequestView {
626 created_at: self._fields.0.unwrap(),
627 profile: self._fields.1,
628 slice: self._fields.2.unwrap(),
629 extra_data: Some(extra_data),
630 }
631 }
632}