[C#] Drop reference to `assert` which makes building on Win hard
[ldk-java] / c_sharp / src / org / ldk / structs / Option_PaymentIdZ.cs
1 using org.ldk.impl;
2 using org.ldk.enums;
3 using org.ldk.util;
4 using System;
5
6 namespace org { namespace ldk { namespace structs {
7
8 /**
9  * An enum which can either contain a crate::c_types::ThirtyTwoBytes or not
10  */
11 public class Option_PaymentIdZ : CommonBase {
12         protected Option_PaymentIdZ(object _dummy, long ptr) : base(ptr) { }
13         ~Option_PaymentIdZ() {
14                 if (ptr != 0) { bindings.COption_PaymentIdZ_free(ptr); }
15         }
16
17         internal static Option_PaymentIdZ constr_from_ptr(long ptr) {
18                 long raw_ty = bindings.LDKCOption_PaymentIdZ_ty_from_ptr(ptr);
19                 switch (raw_ty) {
20                         case 0: return new Option_PaymentIdZ_Some(ptr);
21                         case 1: return new Option_PaymentIdZ_None(ptr);
22                         default:
23                                 throw new ArgumentException("Impossible enum variant");
24                 }
25         }
26
27         /** A Option_PaymentIdZ of type Some */
28         public class Option_PaymentIdZ_Some : Option_PaymentIdZ {
29                 public byte[] some;
30                 internal Option_PaymentIdZ_Some(long ptr) : base(null, ptr) {
31                         this.some = bindings.LDKCOption_PaymentIdZ_Some_get_some(ptr);
32                 }
33         }
34         /** A Option_PaymentIdZ of type None */
35         public class Option_PaymentIdZ_None : Option_PaymentIdZ {
36                 internal Option_PaymentIdZ_None(long ptr) : base(null, ptr) {
37                 }
38         }
39         /**
40          * Constructs a new COption_PaymentIdZ containing a crate::c_types::ThirtyTwoBytes
41          */
42         public static Option_PaymentIdZ some(byte[] o) {
43                 long ret = bindings.COption_PaymentIdZ_some(InternalUtils.check_arr_len(o, 32));
44                 GC.KeepAlive(o);
45                 if (ret >= 0 && ret <= 4096) { return null; }
46                 org.ldk.structs.Option_PaymentIdZ ret_hu_conv = org.ldk.structs.Option_PaymentIdZ.constr_from_ptr(ret);
47                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
48                 return ret_hu_conv;
49         }
50
51         /**
52          * Constructs a new COption_PaymentIdZ containing nothing
53          */
54         public static Option_PaymentIdZ none() {
55                 long ret = bindings.COption_PaymentIdZ_none();
56                 if (ret >= 0 && ret <= 4096) { return null; }
57                 org.ldk.structs.Option_PaymentIdZ ret_hu_conv = org.ldk.structs.Option_PaymentIdZ.constr_from_ptr(ret);
58                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
59                 return ret_hu_conv;
60         }
61
62         internal long clone_ptr() {
63                 long ret = bindings.COption_PaymentIdZ_clone_ptr(this.ptr);
64                 GC.KeepAlive(this);
65                 return ret;
66         }
67
68         /**
69          * Creates a new COption_PaymentIdZ which has the same data as `orig`
70          * but with all dynamically-allocated buffers duplicated in new buffers.
71          */
72         public Option_PaymentIdZ clone() {
73                 long ret = bindings.COption_PaymentIdZ_clone(this.ptr);
74                 GC.KeepAlive(this);
75                 if (ret >= 0 && ret <= 4096) { return null; }
76                 org.ldk.structs.Option_PaymentIdZ ret_hu_conv = org.ldk.structs.Option_PaymentIdZ.constr_from_ptr(ret);
77                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
78                 return ret_hu_conv;
79         }
80
81 }
82 } } }