[C#] Update auto-generated files
[ldk-java] / c_sharp / src / org / ldk / structs / EffectiveCapacity.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  * The effective capacity of a channel for routing purposes.
10  * 
11  * While this may be smaller than the actual channel capacity, amounts greater than
12  * [`Self::as_msat`] should not be routed through the channel.
13  */
14 public class EffectiveCapacity : CommonBase {
15         protected EffectiveCapacity(object _dummy, long ptr) : base(ptr) { }
16         ~EffectiveCapacity() {
17                 if (ptr != 0) { bindings.EffectiveCapacity_free(ptr); }
18         }
19
20         internal static EffectiveCapacity constr_from_ptr(long ptr) {
21                 long raw_ty = bindings.LDKEffectiveCapacity_ty_from_ptr(ptr);
22                 switch (raw_ty) {
23                         case 0: return new EffectiveCapacity_ExactLiquidity(ptr);
24                         case 1: return new EffectiveCapacity_AdvertisedMaxHTLC(ptr);
25                         case 2: return new EffectiveCapacity_Total(ptr);
26                         case 3: return new EffectiveCapacity_Infinite(ptr);
27                         case 4: return new EffectiveCapacity_HintMaxHTLC(ptr);
28                         case 5: return new EffectiveCapacity_Unknown(ptr);
29                         default:
30                                 throw new ArgumentException("Impossible enum variant");
31                 }
32         }
33
34         /** A EffectiveCapacity of type ExactLiquidity */
35         public class EffectiveCapacity_ExactLiquidity : EffectiveCapacity {
36                 /**
37                  * Either the inbound or outbound liquidity depending on the direction, denominated in
38                  * millisatoshi.
39                  */
40                 public long liquidity_msat;
41                 internal EffectiveCapacity_ExactLiquidity(long ptr) : base(null, ptr) {
42                         this.liquidity_msat = bindings.LDKEffectiveCapacity_ExactLiquidity_get_liquidity_msat(ptr);
43                 }
44         }
45         /** A EffectiveCapacity of type AdvertisedMaxHTLC */
46         public class EffectiveCapacity_AdvertisedMaxHTLC : EffectiveCapacity {
47                 /**
48                  * The maximum HTLC amount denominated in millisatoshi.
49                  */
50                 public long amount_msat;
51                 internal EffectiveCapacity_AdvertisedMaxHTLC(long ptr) : base(null, ptr) {
52                         this.amount_msat = bindings.LDKEffectiveCapacity_AdvertisedMaxHTLC_get_amount_msat(ptr);
53                 }
54         }
55         /** A EffectiveCapacity of type Total */
56         public class EffectiveCapacity_Total : EffectiveCapacity {
57                 /**
58                  * The funding amount denominated in millisatoshi.
59                  */
60                 public long capacity_msat;
61                 /**
62                  * The maximum HTLC amount denominated in millisatoshi.
63                  */
64                 public long htlc_maximum_msat;
65                 internal EffectiveCapacity_Total(long ptr) : base(null, ptr) {
66                         this.capacity_msat = bindings.LDKEffectiveCapacity_Total_get_capacity_msat(ptr);
67                         this.htlc_maximum_msat = bindings.LDKEffectiveCapacity_Total_get_htlc_maximum_msat(ptr);
68                 }
69         }
70         /** A EffectiveCapacity of type Infinite */
71         public class EffectiveCapacity_Infinite : EffectiveCapacity {
72                 internal EffectiveCapacity_Infinite(long ptr) : base(null, ptr) {
73                 }
74         }
75         /** A EffectiveCapacity of type HintMaxHTLC */
76         public class EffectiveCapacity_HintMaxHTLC : EffectiveCapacity {
77                 /**
78                  * The maximum HTLC amount denominated in millisatoshi.
79                  */
80                 public long amount_msat;
81                 internal EffectiveCapacity_HintMaxHTLC(long ptr) : base(null, ptr) {
82                         this.amount_msat = bindings.LDKEffectiveCapacity_HintMaxHTLC_get_amount_msat(ptr);
83                 }
84         }
85         /** A EffectiveCapacity of type Unknown */
86         public class EffectiveCapacity_Unknown : EffectiveCapacity {
87                 internal EffectiveCapacity_Unknown(long ptr) : base(null, ptr) {
88                 }
89         }
90         internal long clone_ptr() {
91                 long ret = bindings.EffectiveCapacity_clone_ptr(this.ptr);
92                 GC.KeepAlive(this);
93                 return ret;
94         }
95
96         /**
97          * Creates a copy of the EffectiveCapacity
98          */
99         public EffectiveCapacity clone() {
100                 long ret = bindings.EffectiveCapacity_clone(this.ptr);
101                 GC.KeepAlive(this);
102                 if (ret >= 0 && ret <= 4096) { return null; }
103                 org.ldk.structs.EffectiveCapacity ret_hu_conv = org.ldk.structs.EffectiveCapacity.constr_from_ptr(ret);
104                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
105                 return ret_hu_conv;
106         }
107
108         /**
109          * Utility method to constructs a new ExactLiquidity-variant EffectiveCapacity
110          */
111         public static EffectiveCapacity exact_liquidity(long liquidity_msat) {
112                 long ret = bindings.EffectiveCapacity_exact_liquidity(liquidity_msat);
113                 GC.KeepAlive(liquidity_msat);
114                 if (ret >= 0 && ret <= 4096) { return null; }
115                 org.ldk.structs.EffectiveCapacity ret_hu_conv = org.ldk.structs.EffectiveCapacity.constr_from_ptr(ret);
116                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
117                 return ret_hu_conv;
118         }
119
120         /**
121          * Utility method to constructs a new AdvertisedMaxHTLC-variant EffectiveCapacity
122          */
123         public static EffectiveCapacity advertised_max_htlc(long amount_msat) {
124                 long ret = bindings.EffectiveCapacity_advertised_max_htlc(amount_msat);
125                 GC.KeepAlive(amount_msat);
126                 if (ret >= 0 && ret <= 4096) { return null; }
127                 org.ldk.structs.EffectiveCapacity ret_hu_conv = org.ldk.structs.EffectiveCapacity.constr_from_ptr(ret);
128                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
129                 return ret_hu_conv;
130         }
131
132         /**
133          * Utility method to constructs a new Total-variant EffectiveCapacity
134          */
135         public static EffectiveCapacity total(long capacity_msat, long htlc_maximum_msat) {
136                 long ret = bindings.EffectiveCapacity_total(capacity_msat, htlc_maximum_msat);
137                 GC.KeepAlive(capacity_msat);
138                 GC.KeepAlive(htlc_maximum_msat);
139                 if (ret >= 0 && ret <= 4096) { return null; }
140                 org.ldk.structs.EffectiveCapacity ret_hu_conv = org.ldk.structs.EffectiveCapacity.constr_from_ptr(ret);
141                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
142                 return ret_hu_conv;
143         }
144
145         /**
146          * Utility method to constructs a new Infinite-variant EffectiveCapacity
147          */
148         public static EffectiveCapacity infinite() {
149                 long ret = bindings.EffectiveCapacity_infinite();
150                 if (ret >= 0 && ret <= 4096) { return null; }
151                 org.ldk.structs.EffectiveCapacity ret_hu_conv = org.ldk.structs.EffectiveCapacity.constr_from_ptr(ret);
152                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
153                 return ret_hu_conv;
154         }
155
156         /**
157          * Utility method to constructs a new HintMaxHTLC-variant EffectiveCapacity
158          */
159         public static EffectiveCapacity hint_max_htlc(long amount_msat) {
160                 long ret = bindings.EffectiveCapacity_hint_max_htlc(amount_msat);
161                 GC.KeepAlive(amount_msat);
162                 if (ret >= 0 && ret <= 4096) { return null; }
163                 org.ldk.structs.EffectiveCapacity ret_hu_conv = org.ldk.structs.EffectiveCapacity.constr_from_ptr(ret);
164                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
165                 return ret_hu_conv;
166         }
167
168         /**
169          * Utility method to constructs a new Unknown-variant EffectiveCapacity
170          */
171         public static EffectiveCapacity unknown() {
172                 long ret = bindings.EffectiveCapacity_unknown();
173                 if (ret >= 0 && ret <= 4096) { return null; }
174                 org.ldk.structs.EffectiveCapacity ret_hu_conv = org.ldk.structs.EffectiveCapacity.constr_from_ptr(ret);
175                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
176                 return ret_hu_conv;
177         }
178
179         /**
180          * Returns the effective capacity denominated in millisatoshi.
181          */
182         public long as_msat() {
183                 long ret = bindings.EffectiveCapacity_as_msat(this.ptr);
184                 GC.KeepAlive(this);
185                 return ret;
186         }
187
188 }
189 } } }