| 2180 | namespace com.chronoxor.proto { |
| 2181 | |
| 2182 | public struct Account : IComparable, IComparable<Account>, IEquatable<Account> |
| 2183 | { |
| 2184 | public int id; |
| 2185 | public string name; |
| 2186 | public State state; |
| 2187 | public Balance wallet; |
| 2188 | public Balance? asset; |
| 2189 | public List<Order> orders; |
| 2190 | |
| 2191 | public const long FBETypeConst = 3; |
| 2192 | #if UTF8JSON |
| 2193 | [IgnoreDataMember] |
| 2194 | #else |
| 2195 | [JsonIgnore] |
| 2196 | #endif |
| 2197 | public long FBEType => FBETypeConst; |
| 2198 | |
| 2199 | public static Account Default => new Account |
| 2200 | { |
| 2201 | id = (int)0 |
| 2202 | , name = "" |
| 2203 | , state = global::com.chronoxor.proto.State.initialized | global::com.chronoxor.proto.State.bad |
| 2204 | , wallet = global::com.chronoxor.proto.Balance.Default |
| 2205 | , asset = null |
| 2206 | , orders = new List<Order>() |
| 2207 | }; |
| 2208 | |
| 2209 | public Account(int id, string name, State state, Balance wallet, Balance? asset, List<Order> orders) |
| 2210 | { |
| 2211 | this.id = id; |
| 2212 | this.name = name; |
| 2213 | this.state = state; |
| 2214 | this.wallet = wallet; |
| 2215 | this.asset = asset; |
| 2216 | this.orders = orders; |
| 2217 | } |
| 2218 | |
| 2219 | public Account Clone() |
| 2220 | { |
| 2221 | // Serialize the struct to the FBE stream |
| 2222 | var writer = new com.chronoxor.proto.FBE.AccountModel(); |
| 2223 | writer.Serialize(this); |
| 2224 | |
| 2225 | // Deserialize the struct from the FBE stream |
| 2226 | var reader = new com.chronoxor.proto.FBE.AccountModel(); |
| 2227 | reader.Attach(writer.Buffer); |
| 2228 | reader.Deserialize(out var result); |
| 2229 | return result; |
| 2230 | } |
| 2231 | |
| 2232 | public int CompareTo(object other) |
| 2233 | { |
| 2234 | int result = 0; |
| 2235 | result = id.CompareTo(((Account)other).id); |
| 2236 | if (result != 0) |
| 2237 | return result; |
| 2238 | return result; |
| 2239 | } |