jacquard-api 0.10.2

Generated AT Protocol API bindings for Jacquard
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
// @generated by jacquard-lexicon. DO NOT EDIT.
//
// Lexicon: org.hypercerts.funding.receipt
//
// This file was automatically generated from Lexicon schemas.
// Any manual changes will be overwritten on the next regeneration.

/// Records a funding receipt for a payment from one user to another user. It may be recorded by the recipient, by the sender, or by a third party. The sender may remain anonymous.
#[jacquard_derive::lexicon]
#[derive(
    serde::Serialize,
    serde::Deserialize,
    Debug,
    Clone,
    PartialEq,
    Eq,
    jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct Receipt<'a> {
    ///Amount of funding received as a numeric string (e.g. '1000.50').
    #[serde(borrow)]
    pub amount: jacquard_common::CowStr<'a>,
    ///Client-declared timestamp when this receipt record was created.
    pub created_at: jacquard_common::types::string::Datetime,
    ///Currency of the payment (e.g. EUR, USD, ETH).
    #[serde(borrow)]
    pub currency: jacquard_common::CowStr<'a>,
    ///Optional reference to the activity, project, or organization this funding relates to.
    #[serde(skip_serializing_if = "std::option::Option::is_none")]
    #[serde(borrow)]
    pub r#for: std::option::Option<jacquard_common::types::string::AtUri<'a>>,
    ///DID of the sender who transferred the funds. Leave empty if sender wants to stay anonymous.
    #[serde(borrow)]
    pub from: crate::app_certified::Did<'a>,
    ///Optional notes or additional context for this funding receipt.
    #[serde(skip_serializing_if = "std::option::Option::is_none")]
    #[serde(borrow)]
    pub notes: std::option::Option<jacquard_common::CowStr<'a>>,
    ///Timestamp when the payment occurred.
    #[serde(skip_serializing_if = "std::option::Option::is_none")]
    pub occurred_at: std::option::Option<jacquard_common::types::string::Datetime>,
    ///Optional network within the payment rail (e.g. arbitrum, ethereum, sepa, visa, paypal).
    #[serde(skip_serializing_if = "std::option::Option::is_none")]
    #[serde(borrow)]
    pub payment_network: std::option::Option<jacquard_common::CowStr<'a>>,
    ///How the funds were transferred (e.g. bank_transfer, credit_card, onchain, cash, check, payment_processor).
    #[serde(skip_serializing_if = "std::option::Option::is_none")]
    #[serde(borrow)]
    pub payment_rail: std::option::Option<jacquard_common::CowStr<'a>>,
    ///The recipient of the funds. Can be identified by DID or a clear-text name.
    #[serde(borrow)]
    pub to: jacquard_common::CowStr<'a>,
    ///Identifier of the underlying payment transaction (e.g. bank reference, onchain transaction hash, or processor-specific ID). Use paymentNetwork to specify the network where applicable.
    #[serde(skip_serializing_if = "std::option::Option::is_none")]
    #[serde(borrow)]
    pub transaction_id: std::option::Option<jacquard_common::CowStr<'a>>,
}

pub mod receipt_state {

    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
    #[allow(unused)]
    use ::core::marker::PhantomData;
    mod sealed {
        pub trait Sealed {}
    }
    /// State trait tracking which required fields have been set
    pub trait State: sealed::Sealed {
        type Amount;
        type To;
        type From;
        type Currency;
        type CreatedAt;
    }
    /// Empty state - all required fields are unset
    pub struct Empty(());
    impl sealed::Sealed for Empty {}
    impl State for Empty {
        type Amount = Unset;
        type To = Unset;
        type From = Unset;
        type Currency = Unset;
        type CreatedAt = Unset;
    }
    ///State transition - sets the `amount` field to Set
    pub struct SetAmount<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetAmount<S> {}
    impl<S: State> State for SetAmount<S> {
        type Amount = Set<members::amount>;
        type To = S::To;
        type From = S::From;
        type Currency = S::Currency;
        type CreatedAt = S::CreatedAt;
    }
    ///State transition - sets the `to` field to Set
    pub struct SetTo<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetTo<S> {}
    impl<S: State> State for SetTo<S> {
        type Amount = S::Amount;
        type To = Set<members::to>;
        type From = S::From;
        type Currency = S::Currency;
        type CreatedAt = S::CreatedAt;
    }
    ///State transition - sets the `from` field to Set
    pub struct SetFrom<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetFrom<S> {}
    impl<S: State> State for SetFrom<S> {
        type Amount = S::Amount;
        type To = S::To;
        type From = Set<members::from>;
        type Currency = S::Currency;
        type CreatedAt = S::CreatedAt;
    }
    ///State transition - sets the `currency` field to Set
    pub struct SetCurrency<S: State = Empty>(PhantomData<fn() -> S>);
    impl<S: State> sealed::Sealed for SetCurrency<S> {}
    impl<S: State> State for SetCurrency<S> {
        type Amount = S::Amount;
        type To = S::To;
        type From = S::From;
        type Currency = Set<members::currency>;
        type CreatedAt = S::CreatedAt;
    }
    ///State transition - sets the `created_at` field to Set
    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 Amount = S::Amount;
        type To = S::To;
        type From = S::From;
        type Currency = S::Currency;
        type CreatedAt = Set<members::created_at>;
    }
    /// Marker types for field names
    #[allow(non_camel_case_types)]
    pub mod members {
        ///Marker type for the `amount` field
        pub struct amount(());
        ///Marker type for the `to` field
        pub struct to(());
        ///Marker type for the `from` field
        pub struct from(());
        ///Marker type for the `currency` field
        pub struct currency(());
        ///Marker type for the `created_at` field
        pub struct created_at(());
    }
}

/// Builder for constructing an instance of this type
pub struct ReceiptBuilder<'a, S: receipt_state::State> {
    _phantom_state: ::core::marker::PhantomData<fn() -> S>,
    __unsafe_private_named: (
        ::core::option::Option<jacquard_common::CowStr<'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<crate::app_certified::Did<'a>>,
        ::core::option::Option<jacquard_common::CowStr<'a>>,
        ::core::option::Option<jacquard_common::types::string::Datetime>,
        ::core::option::Option<jacquard_common::CowStr<'a>>,
        ::core::option::Option<jacquard_common::CowStr<'a>>,
        ::core::option::Option<jacquard_common::CowStr<'a>>,
        ::core::option::Option<jacquard_common::CowStr<'a>>,
    ),
    _phantom: ::core::marker::PhantomData<&'a ()>,
}

impl<'a> Receipt<'a> {
    /// Create a new builder for this type
    pub fn new() -> ReceiptBuilder<'a, receipt_state::Empty> {
        ReceiptBuilder::new()
    }
}

impl<'a> ReceiptBuilder<'a, receipt_state::Empty> {
    /// Create a new builder with all fields unset
    pub fn new() -> Self {
        ReceiptBuilder {
            _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> ReceiptBuilder<'a, S>
where
    S: receipt_state::State,
    S::Amount: receipt_state::IsUnset,
{
    /// Set the `amount` field (required)
    pub fn amount(
        mut self,
        value: impl Into<jacquard_common::CowStr<'a>>,
    ) -> ReceiptBuilder<'a, receipt_state::SetAmount<S>> {
        self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
        ReceiptBuilder {
            _phantom_state: ::core::marker::PhantomData,
            __unsafe_private_named: self.__unsafe_private_named,
            _phantom: ::core::marker::PhantomData,
        }
    }
}

impl<'a, S> ReceiptBuilder<'a, S>
where
    S: receipt_state::State,
    S::CreatedAt: receipt_state::IsUnset,
{
    /// Set the `createdAt` field (required)
    pub fn created_at(
        mut self,
        value: impl Into<jacquard_common::types::string::Datetime>,
    ) -> ReceiptBuilder<'a, receipt_state::SetCreatedAt<S>> {
        self.__unsafe_private_named.1 = ::core::option::Option::Some(value.into());
        ReceiptBuilder {
            _phantom_state: ::core::marker::PhantomData,
            __unsafe_private_named: self.__unsafe_private_named,
            _phantom: ::core::marker::PhantomData,
        }
    }
}

impl<'a, S> ReceiptBuilder<'a, S>
where
    S: receipt_state::State,
    S::Currency: receipt_state::IsUnset,
{
    /// Set the `currency` field (required)
    pub fn currency(
        mut self,
        value: impl Into<jacquard_common::CowStr<'a>>,
    ) -> ReceiptBuilder<'a, receipt_state::SetCurrency<S>> {
        self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into());
        ReceiptBuilder {
            _phantom_state: ::core::marker::PhantomData,
            __unsafe_private_named: self.__unsafe_private_named,
            _phantom: ::core::marker::PhantomData,
        }
    }
}

impl<'a, S: receipt_state::State> ReceiptBuilder<'a, S> {
    /// Set the `for` field (optional)
    pub fn r#for(
        mut self,
        value: impl Into<Option<jacquard_common::types::string::AtUri<'a>>>,
    ) -> Self {
        self.__unsafe_private_named.3 = value.into();
        self
    }
    /// Set the `for` field to an Option value (optional)
    pub fn maybe_for(
        mut self,
        value: Option<jacquard_common::types::string::AtUri<'a>>,
    ) -> Self {
        self.__unsafe_private_named.3 = value;
        self
    }
}

impl<'a, S> ReceiptBuilder<'a, S>
where
    S: receipt_state::State,
    S::From: receipt_state::IsUnset,
{
    /// Set the `from` field (required)
    pub fn from(
        mut self,
        value: impl Into<crate::app_certified::Did<'a>>,
    ) -> ReceiptBuilder<'a, receipt_state::SetFrom<S>> {
        self.__unsafe_private_named.4 = ::core::option::Option::Some(value.into());
        ReceiptBuilder {
            _phantom_state: ::core::marker::PhantomData,
            __unsafe_private_named: self.__unsafe_private_named,
            _phantom: ::core::marker::PhantomData,
        }
    }
}

impl<'a, S: receipt_state::State> ReceiptBuilder<'a, S> {
    /// Set the `notes` field (optional)
    pub fn notes(
        mut self,
        value: impl Into<Option<jacquard_common::CowStr<'a>>>,
    ) -> Self {
        self.__unsafe_private_named.5 = value.into();
        self
    }
    /// Set the `notes` field to an Option value (optional)
    pub fn maybe_notes(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self {
        self.__unsafe_private_named.5 = value;
        self
    }
}

impl<'a, S: receipt_state::State> ReceiptBuilder<'a, S> {
    /// Set the `occurredAt` field (optional)
    pub fn occurred_at(
        mut self,
        value: impl Into<Option<jacquard_common::types::string::Datetime>>,
    ) -> Self {
        self.__unsafe_private_named.6 = value.into();
        self
    }
    /// Set the `occurredAt` field to an Option value (optional)
    pub fn maybe_occurred_at(
        mut self,
        value: Option<jacquard_common::types::string::Datetime>,
    ) -> Self {
        self.__unsafe_private_named.6 = value;
        self
    }
}

impl<'a, S: receipt_state::State> ReceiptBuilder<'a, S> {
    /// Set the `paymentNetwork` field (optional)
    pub fn payment_network(
        mut self,
        value: impl Into<Option<jacquard_common::CowStr<'a>>>,
    ) -> Self {
        self.__unsafe_private_named.7 = value.into();
        self
    }
    /// Set the `paymentNetwork` field to an Option value (optional)
    pub fn maybe_payment_network(
        mut self,
        value: Option<jacquard_common::CowStr<'a>>,
    ) -> Self {
        self.__unsafe_private_named.7 = value;
        self
    }
}

impl<'a, S: receipt_state::State> ReceiptBuilder<'a, S> {
    /// Set the `paymentRail` field (optional)
    pub fn payment_rail(
        mut self,
        value: impl Into<Option<jacquard_common::CowStr<'a>>>,
    ) -> Self {
        self.__unsafe_private_named.8 = value.into();
        self
    }
    /// Set the `paymentRail` field to an Option value (optional)
    pub fn maybe_payment_rail(
        mut self,
        value: Option<jacquard_common::CowStr<'a>>,
    ) -> Self {
        self.__unsafe_private_named.8 = value;
        self
    }
}

impl<'a, S> ReceiptBuilder<'a, S>
where
    S: receipt_state::State,
    S::To: receipt_state::IsUnset,
{
    /// Set the `to` field (required)
    pub fn to(
        mut self,
        value: impl Into<jacquard_common::CowStr<'a>>,
    ) -> ReceiptBuilder<'a, receipt_state::SetTo<S>> {
        self.__unsafe_private_named.9 = ::core::option::Option::Some(value.into());
        ReceiptBuilder {
            _phantom_state: ::core::marker::PhantomData,
            __unsafe_private_named: self.__unsafe_private_named,
            _phantom: ::core::marker::PhantomData,
        }
    }
}

impl<'a, S: receipt_state::State> ReceiptBuilder<'a, S> {
    /// Set the `transactionId` field (optional)
    pub fn transaction_id(
        mut self,
        value: impl Into<Option<jacquard_common::CowStr<'a>>>,
    ) -> Self {
        self.__unsafe_private_named.10 = value.into();
        self
    }
    /// Set the `transactionId` field to an Option value (optional)
    pub fn maybe_transaction_id(
        mut self,
        value: Option<jacquard_common::CowStr<'a>>,
    ) -> Self {
        self.__unsafe_private_named.10 = value;
        self
    }
}

impl<'a, S> ReceiptBuilder<'a, S>
where
    S: receipt_state::State,
    S::Amount: receipt_state::IsSet,
    S::To: receipt_state::IsSet,
    S::From: receipt_state::IsSet,
    S::Currency: receipt_state::IsSet,
    S::CreatedAt: receipt_state::IsSet,
{
    /// Build the final struct
    pub fn build(self) -> Receipt<'a> {
        Receipt {
            amount: self.__unsafe_private_named.0.unwrap(),
            created_at: self.__unsafe_private_named.1.unwrap(),
            currency: self.__unsafe_private_named.2.unwrap(),
            r#for: self.__unsafe_private_named.3,
            from: self.__unsafe_private_named.4.unwrap(),
            notes: self.__unsafe_private_named.5,
            occurred_at: self.__unsafe_private_named.6,
            payment_network: self.__unsafe_private_named.7,
            payment_rail: self.__unsafe_private_named.8,
            to: self.__unsafe_private_named.9.unwrap(),
            transaction_id: self.__unsafe_private_named.10,
            extra_data: Default::default(),
        }
    }
    /// Build the final struct with custom extra_data
    pub fn build_with_data(
        self,
        extra_data: std::collections::BTreeMap<
            jacquard_common::deps::smol_str::SmolStr,
            jacquard_common::types::value::Data<'a>,
        >,
    ) -> Receipt<'a> {
        Receipt {
            amount: self.__unsafe_private_named.0.unwrap(),
            created_at: self.__unsafe_private_named.1.unwrap(),
            currency: self.__unsafe_private_named.2.unwrap(),
            r#for: self.__unsafe_private_named.3,
            from: self.__unsafe_private_named.4.unwrap(),
            notes: self.__unsafe_private_named.5,
            occurred_at: self.__unsafe_private_named.6,
            payment_network: self.__unsafe_private_named.7,
            payment_rail: self.__unsafe_private_named.8,
            to: self.__unsafe_private_named.9.unwrap(),
            transaction_id: self.__unsafe_private_named.10,
            extra_data: Some(extra_data),
        }
    }
}

impl<'a> Receipt<'a> {
    pub fn uri(
        uri: impl Into<jacquard_common::CowStr<'a>>,
    ) -> Result<
        jacquard_common::types::uri::RecordUri<'a, ReceiptRecord>,
        jacquard_common::types::uri::UriError,
    > {
        jacquard_common::types::uri::RecordUri::try_from_uri(
            jacquard_common::types::string::AtUri::new_cow(uri.into())?,
        )
    }
}

/// Typed wrapper for GetRecord response with this collection's record type.
#[derive(
    serde::Serialize,
    serde::Deserialize,
    Debug,
    Clone,
    PartialEq,
    Eq,
    jacquard_derive::IntoStatic
)]
#[serde(rename_all = "camelCase")]
pub struct ReceiptGetRecordOutput<'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: Receipt<'a>,
}

impl From<ReceiptGetRecordOutput<'_>> for Receipt<'_> {
    fn from(output: ReceiptGetRecordOutput<'_>) -> Self {
        use jacquard_common::IntoStatic;
        output.value.into_static()
    }
}

impl jacquard_common::types::collection::Collection for Receipt<'_> {
    const NSID: &'static str = "org.hypercerts.funding.receipt";
    type Record = ReceiptRecord;
}

/// Marker type for deserializing records from this collection.
#[derive(Debug, serde::Serialize, serde::Deserialize)]
pub struct ReceiptRecord;
impl jacquard_common::xrpc::XrpcResp for ReceiptRecord {
    const NSID: &'static str = "org.hypercerts.funding.receipt";
    const ENCODING: &'static str = "application/json";
    type Output<'de> = ReceiptGetRecordOutput<'de>;
    type Err<'de> = jacquard_common::types::collection::RecordError<'de>;
}

impl jacquard_common::types::collection::Collection for ReceiptRecord {
    const NSID: &'static str = "org.hypercerts.funding.receipt";
    type Record = ReceiptRecord;
}

impl<'a> ::jacquard_lexicon::schema::LexiconSchema for Receipt<'a> {
    fn nsid() -> &'static str {
        "org.hypercerts.funding.receipt"
    }
    fn def_name() -> &'static str {
        "main"
    }
    fn lexicon_doc() -> ::jacquard_lexicon::lexicon::LexiconDoc<'static> {
        lexicon_doc_org_hypercerts_funding_receipt()
    }
    fn validate(
        &self,
    ) -> ::core::result::Result<(), ::jacquard_lexicon::validation::ConstraintError> {
        {
            let value = &self.amount;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 50usize {
                return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
                    path: ::jacquard_lexicon::validation::ValidationPath::from_field(
                        "amount",
                    ),
                    max: 50usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            let value = &self.currency;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 10usize {
                return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
                    path: ::jacquard_lexicon::validation::ValidationPath::from_field(
                        "currency",
                    ),
                    max: 10usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.notes {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 500usize {
                return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
                    path: ::jacquard_lexicon::validation::ValidationPath::from_field(
                        "notes",
                    ),
                    max: 500usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.payment_network {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 50usize {
                return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
                    path: ::jacquard_lexicon::validation::ValidationPath::from_field(
                        "payment_network",
                    ),
                    max: 50usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.payment_rail {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 50usize {
                return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
                    path: ::jacquard_lexicon::validation::ValidationPath::from_field(
                        "payment_rail",
                    ),
                    max: 50usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        {
            let value = &self.to;
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 2048usize {
                return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
                    path: ::jacquard_lexicon::validation::ValidationPath::from_field(
                        "to",
                    ),
                    max: 2048usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        if let Some(ref value) = self.transaction_id {
            #[allow(unused_comparisons)]
            if <str>::len(value.as_ref()) > 256usize {
                return Err(::jacquard_lexicon::validation::ConstraintError::MaxLength {
                    path: ::jacquard_lexicon::validation::ValidationPath::from_field(
                        "transaction_id",
                    ),
                    max: 256usize,
                    actual: <str>::len(value.as_ref()),
                });
            }
        }
        Ok(())
    }
}

fn lexicon_doc_org_hypercerts_funding_receipt() -> ::jacquard_lexicon::lexicon::LexiconDoc<
    'static,
> {
    ::jacquard_lexicon::lexicon::LexiconDoc {
        lexicon: ::jacquard_lexicon::lexicon::Lexicon::Lexicon1,
        id: ::jacquard_common::CowStr::new_static("org.hypercerts.funding.receipt"),
        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(
                            "Records a funding receipt for a payment from one user to another user. It may be recorded by the recipient, by the sender, or by a third party. The sender may remain anonymous.",
                        ),
                    ),
                    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("from"),
                                ::jacquard_common::deps::smol_str::SmolStr::new_static("to"),
                                ::jacquard_common::deps::smol_str::SmolStr::new_static("amount"),
                                ::jacquard_common::deps::smol_str::SmolStr::new_static("currency"),
                                ::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(
                                    "amount",
                                ),
                                ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
                                    description: Some(
                                        ::jacquard_common::CowStr::new_static(
                                            "Amount of funding received as a numeric string (e.g. '1000.50').",
                                        ),
                                    ),
                                    format: None,
                                    default: None,
                                    min_length: None,
                                    max_length: Some(50usize),
                                    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(
                                    "createdAt",
                                ),
                                ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
                                    description: Some(
                                        ::jacquard_common::CowStr::new_static(
                                            "Client-declared timestamp when this receipt record was created.",
                                        ),
                                    ),
                                    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(
                                    "currency",
                                ),
                                ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
                                    description: Some(
                                        ::jacquard_common::CowStr::new_static(
                                            "Currency of the payment (e.g. EUR, USD, ETH).",
                                        ),
                                    ),
                                    format: None,
                                    default: None,
                                    min_length: None,
                                    max_length: Some(10usize),
                                    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(
                                    "for",
                                ),
                                ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
                                    description: Some(
                                        ::jacquard_common::CowStr::new_static(
                                            "Optional reference to the activity, project, or organization this funding relates to.",
                                        ),
                                    ),
                                    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(
                                    "from",
                                ),
                                ::jacquard_lexicon::lexicon::LexObjectProperty::Ref(::jacquard_lexicon::lexicon::LexRef {
                                    description: None,
                                    r#ref: ::jacquard_common::CowStr::new_static(
                                        "app.certified.defs#did",
                                    ),
                                }),
                            );
                            map.insert(
                                ::jacquard_common::deps::smol_str::SmolStr::new_static(
                                    "notes",
                                ),
                                ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
                                    description: Some(
                                        ::jacquard_common::CowStr::new_static(
                                            "Optional notes or additional context for this funding receipt.",
                                        ),
                                    ),
                                    format: None,
                                    default: None,
                                    min_length: None,
                                    max_length: Some(500usize),
                                    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(
                                    "occurredAt",
                                ),
                                ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
                                    description: Some(
                                        ::jacquard_common::CowStr::new_static(
                                            "Timestamp when the payment occurred.",
                                        ),
                                    ),
                                    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(
                                    "paymentNetwork",
                                ),
                                ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
                                    description: Some(
                                        ::jacquard_common::CowStr::new_static(
                                            "Optional network within the payment rail (e.g. arbitrum, ethereum, sepa, visa, paypal).",
                                        ),
                                    ),
                                    format: None,
                                    default: None,
                                    min_length: None,
                                    max_length: Some(50usize),
                                    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(
                                    "paymentRail",
                                ),
                                ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
                                    description: Some(
                                        ::jacquard_common::CowStr::new_static(
                                            "How the funds were transferred (e.g. bank_transfer, credit_card, onchain, cash, check, payment_processor).",
                                        ),
                                    ),
                                    format: None,
                                    default: None,
                                    min_length: None,
                                    max_length: Some(50usize),
                                    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(
                                    "to",
                                ),
                                ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
                                    description: Some(
                                        ::jacquard_common::CowStr::new_static(
                                            "The recipient of the funds. Can be identified by DID or a clear-text name.",
                                        ),
                                    ),
                                    format: None,
                                    default: None,
                                    min_length: None,
                                    max_length: Some(2048usize),
                                    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(
                                    "transactionId",
                                ),
                                ::jacquard_lexicon::lexicon::LexObjectProperty::String(::jacquard_lexicon::lexicon::LexString {
                                    description: Some(
                                        ::jacquard_common::CowStr::new_static(
                                            "Identifier of the underlying payment transaction (e.g. bank reference, onchain transaction hash, or processor-specific ID). Use paymentNetwork to specify the network where applicable.",
                                        ),
                                    ),
                                    format: None,
                                    default: None,
                                    min_length: None,
                                    max_length: Some(256usize),
                                    min_graphemes: None,
                                    max_graphemes: None,
                                    r#enum: None,
                                    r#const: None,
                                    known_values: None,
                                }),
                            );
                            map
                        },
                    }),
                }),
            );
            map
        },
    }
}