/** * * Autogenerated by Thrift Compiler (0.19.0) * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * */ using System; using System.Collections; using System.Collections.Generic; using System.Text; using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.Logging; using Thrift; using Thrift.Collections; using Thrift.Protocol; using Thrift.Protocol.Entities; using Thrift.Protocol.Utilities; using Thrift.Transport; using Thrift.Transport.Client; using Thrift.Transport.Server; using Thrift.Processor; #pragma warning disable IDE0079 // remove unnecessary pragmas #pragma warning disable IDE0017 // object init can be simplified #pragma warning disable IDE0028 // collection init can be simplified #pragma warning disable IDE1006 // parts of the code use IDL spelling #pragma warning disable CA1822 // empty DeepCopy() methods still non-static #pragma warning disable IDE0083 // pattern matching "that is not SomeType" requires net5.0 but we still support earlier versions namespace Echo.ThriftModel { public partial class BusinessDocument : TBase { private global::Echo.ThriftModel.DocumentHeader _header; private global::Echo.ThriftModel.Party _seller; private global::Echo.ThriftModel.Party _buyer; private List _items; private List _payments; private List _attachments; private List _riskScores; public global::Echo.ThriftModel.DocumentHeader Header { get { return _header; } set { __isset.@header = true; this._header = value; } } public global::Echo.ThriftModel.Party Seller { get { return _seller; } set { __isset.@seller = true; this._seller = value; } } public global::Echo.ThriftModel.Party Buyer { get { return _buyer; } set { __isset.@buyer = true; this._buyer = value; } } public List Items { get { return _items; } set { __isset.@items = true; this._items = value; } } public List Payments { get { return _payments; } set { __isset.@payments = true; this._payments = value; } } public List Attachments { get { return _attachments; } set { __isset.@attachments = true; this._attachments = value; } } public List RiskScores { get { return _riskScores; } set { __isset.riskScores = true; this._riskScores = value; } } public Isset __isset; public struct Isset { public bool @header; public bool @seller; public bool @buyer; public bool @items; public bool @payments; public bool @attachments; public bool riskScores; } public BusinessDocument() { } public BusinessDocument DeepCopy() { var tmp55 = new BusinessDocument(); if((Header != null) && __isset.@header) { tmp55.Header = (global::Echo.ThriftModel.DocumentHeader)this.Header.DeepCopy(); } tmp55.__isset.@header = this.__isset.@header; if((Seller != null) && __isset.@seller) { tmp55.Seller = (global::Echo.ThriftModel.Party)this.Seller.DeepCopy(); } tmp55.__isset.@seller = this.__isset.@seller; if((Buyer != null) && __isset.@buyer) { tmp55.Buyer = (global::Echo.ThriftModel.Party)this.Buyer.DeepCopy(); } tmp55.__isset.@buyer = this.__isset.@buyer; if((Items != null) && __isset.@items) { tmp55.Items = this.Items.DeepCopy(); } tmp55.__isset.@items = this.__isset.@items; if((Payments != null) && __isset.@payments) { tmp55.Payments = this.Payments.DeepCopy(); } tmp55.__isset.@payments = this.__isset.@payments; if((Attachments != null) && __isset.@attachments) { tmp55.Attachments = this.Attachments.DeepCopy(); } tmp55.__isset.@attachments = this.__isset.@attachments; if((RiskScores != null) && __isset.riskScores) { tmp55.RiskScores = this.RiskScores.DeepCopy(); } tmp55.__isset.riskScores = this.__isset.riskScores; return tmp55; } public async global::System.Threading.Tasks.Task ReadAsync(TProtocol iprot, CancellationToken cancellationToken) { iprot.IncrementRecursionDepth(); try { TField field; await iprot.ReadStructBeginAsync(cancellationToken); while (true) { field = await iprot.ReadFieldBeginAsync(cancellationToken); if (field.Type == TType.Stop) { break; } switch (field.ID) { case 1: if (field.Type == TType.Struct) { Header = new global::Echo.ThriftModel.DocumentHeader(); await Header.ReadAsync(iprot, cancellationToken); } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 2: if (field.Type == TType.Struct) { Seller = new global::Echo.ThriftModel.Party(); await Seller.ReadAsync(iprot, cancellationToken); } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 3: if (field.Type == TType.Struct) { Buyer = new global::Echo.ThriftModel.Party(); await Buyer.ReadAsync(iprot, cancellationToken); } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 4: if (field.Type == TType.List) { { var _list56 = await iprot.ReadListBeginAsync(cancellationToken); Items = new List(_list56.Count); for(int _i57 = 0; _i57 < _list56.Count; ++_i57) { global::Echo.ThriftModel.LineItem _elem58; _elem58 = new global::Echo.ThriftModel.LineItem(); await _elem58.ReadAsync(iprot, cancellationToken); Items.Add(_elem58); } await iprot.ReadListEndAsync(cancellationToken); } } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 5: if (field.Type == TType.List) { { var _list59 = await iprot.ReadListBeginAsync(cancellationToken); Payments = new List(_list59.Count); for(int _i60 = 0; _i60 < _list59.Count; ++_i60) { global::Echo.ThriftModel.Payment _elem61; _elem61 = new global::Echo.ThriftModel.Payment(); await _elem61.ReadAsync(iprot, cancellationToken); Payments.Add(_elem61); } await iprot.ReadListEndAsync(cancellationToken); } } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 6: if (field.Type == TType.List) { { var _list62 = await iprot.ReadListBeginAsync(cancellationToken); Attachments = new List(_list62.Count); for(int _i63 = 0; _i63 < _list62.Count; ++_i63) { global::Echo.ThriftModel.Attachment _elem64; _elem64 = new global::Echo.ThriftModel.Attachment(); await _elem64.ReadAsync(iprot, cancellationToken); Attachments.Add(_elem64); } await iprot.ReadListEndAsync(cancellationToken); } } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 7: if (field.Type == TType.List) { { var _list65 = await iprot.ReadListBeginAsync(cancellationToken); RiskScores = new List(_list65.Count); for(int _i66 = 0; _i66 < _list65.Count; ++_i66) { int _elem67; _elem67 = await iprot.ReadI32Async(cancellationToken); RiskScores.Add(_elem67); } await iprot.ReadListEndAsync(cancellationToken); } } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; default: await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); break; } await iprot.ReadFieldEndAsync(cancellationToken); } await iprot.ReadStructEndAsync(cancellationToken); } finally { iprot.DecrementRecursionDepth(); } } public async global::System.Threading.Tasks.Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken) { oprot.IncrementRecursionDepth(); try { var tmp68 = new TStruct("BusinessDocument"); await oprot.WriteStructBeginAsync(tmp68, cancellationToken); var tmp69 = new TField(); if((Header != null) && __isset.@header) { tmp69.Name = "header"; tmp69.Type = TType.Struct; tmp69.ID = 1; await oprot.WriteFieldBeginAsync(tmp69, cancellationToken); await Header.WriteAsync(oprot, cancellationToken); await oprot.WriteFieldEndAsync(cancellationToken); } if((Seller != null) && __isset.@seller) { tmp69.Name = "seller"; tmp69.Type = TType.Struct; tmp69.ID = 2; await oprot.WriteFieldBeginAsync(tmp69, cancellationToken); await Seller.WriteAsync(oprot, cancellationToken); await oprot.WriteFieldEndAsync(cancellationToken); } if((Buyer != null) && __isset.@buyer) { tmp69.Name = "buyer"; tmp69.Type = TType.Struct; tmp69.ID = 3; await oprot.WriteFieldBeginAsync(tmp69, cancellationToken); await Buyer.WriteAsync(oprot, cancellationToken); await oprot.WriteFieldEndAsync(cancellationToken); } if((Items != null) && __isset.@items) { tmp69.Name = "items"; tmp69.Type = TType.List; tmp69.ID = 4; await oprot.WriteFieldBeginAsync(tmp69, cancellationToken); await oprot.WriteListBeginAsync(new TList(TType.Struct, Items.Count), cancellationToken); foreach (global::Echo.ThriftModel.LineItem _iter70 in Items) { await _iter70.WriteAsync(oprot, cancellationToken); } await oprot.WriteListEndAsync(cancellationToken); await oprot.WriteFieldEndAsync(cancellationToken); } if((Payments != null) && __isset.@payments) { tmp69.Name = "payments"; tmp69.Type = TType.List; tmp69.ID = 5; await oprot.WriteFieldBeginAsync(tmp69, cancellationToken); await oprot.WriteListBeginAsync(new TList(TType.Struct, Payments.Count), cancellationToken); foreach (global::Echo.ThriftModel.Payment _iter71 in Payments) { await _iter71.WriteAsync(oprot, cancellationToken); } await oprot.WriteListEndAsync(cancellationToken); await oprot.WriteFieldEndAsync(cancellationToken); } if((Attachments != null) && __isset.@attachments) { tmp69.Name = "attachments"; tmp69.Type = TType.List; tmp69.ID = 6; await oprot.WriteFieldBeginAsync(tmp69, cancellationToken); await oprot.WriteListBeginAsync(new TList(TType.Struct, Attachments.Count), cancellationToken); foreach (global::Echo.ThriftModel.Attachment _iter72 in Attachments) { await _iter72.WriteAsync(oprot, cancellationToken); } await oprot.WriteListEndAsync(cancellationToken); await oprot.WriteFieldEndAsync(cancellationToken); } if((RiskScores != null) && __isset.riskScores) { tmp69.Name = "riskScores"; tmp69.Type = TType.List; tmp69.ID = 7; await oprot.WriteFieldBeginAsync(tmp69, cancellationToken); await oprot.WriteListBeginAsync(new TList(TType.I32, RiskScores.Count), cancellationToken); foreach (int _iter73 in RiskScores) { await oprot.WriteI32Async(_iter73, cancellationToken); } await oprot.WriteListEndAsync(cancellationToken); await oprot.WriteFieldEndAsync(cancellationToken); } await oprot.WriteFieldStopAsync(cancellationToken); await oprot.WriteStructEndAsync(cancellationToken); } finally { oprot.DecrementRecursionDepth(); } } public override bool Equals(object that) { if (!(that is BusinessDocument other)) return false; if (ReferenceEquals(this, other)) return true; return ((__isset.@header == other.__isset.@header) && ((!__isset.@header) || (global::System.Object.Equals(Header, other.Header)))) && ((__isset.@seller == other.__isset.@seller) && ((!__isset.@seller) || (global::System.Object.Equals(Seller, other.Seller)))) && ((__isset.@buyer == other.__isset.@buyer) && ((!__isset.@buyer) || (global::System.Object.Equals(Buyer, other.Buyer)))) && ((__isset.@items == other.__isset.@items) && ((!__isset.@items) || (TCollections.Equals(Items, other.Items)))) && ((__isset.@payments == other.__isset.@payments) && ((!__isset.@payments) || (TCollections.Equals(Payments, other.Payments)))) && ((__isset.@attachments == other.__isset.@attachments) && ((!__isset.@attachments) || (TCollections.Equals(Attachments, other.Attachments)))) && ((__isset.riskScores == other.__isset.riskScores) && ((!__isset.riskScores) || (TCollections.Equals(RiskScores, other.RiskScores)))); } public override int GetHashCode() { int hashcode = 157; unchecked { if((Header != null) && __isset.@header) { hashcode = (hashcode * 397) + Header.GetHashCode(); } if((Seller != null) && __isset.@seller) { hashcode = (hashcode * 397) + Seller.GetHashCode(); } if((Buyer != null) && __isset.@buyer) { hashcode = (hashcode * 397) + Buyer.GetHashCode(); } if((Items != null) && __isset.@items) { hashcode = (hashcode * 397) + TCollections.GetHashCode(Items); } if((Payments != null) && __isset.@payments) { hashcode = (hashcode * 397) + TCollections.GetHashCode(Payments); } if((Attachments != null) && __isset.@attachments) { hashcode = (hashcode * 397) + TCollections.GetHashCode(Attachments); } if((RiskScores != null) && __isset.riskScores) { hashcode = (hashcode * 397) + TCollections.GetHashCode(RiskScores); } } return hashcode; } public override string ToString() { var tmp74 = new StringBuilder("BusinessDocument("); int tmp75 = 0; if((Header != null) && __isset.@header) { if(0 < tmp75++) { tmp74.Append(", "); } tmp74.Append("Header: "); Header.ToString(tmp74); } if((Seller != null) && __isset.@seller) { if(0 < tmp75++) { tmp74.Append(", "); } tmp74.Append("Seller: "); Seller.ToString(tmp74); } if((Buyer != null) && __isset.@buyer) { if(0 < tmp75++) { tmp74.Append(", "); } tmp74.Append("Buyer: "); Buyer.ToString(tmp74); } if((Items != null) && __isset.@items) { if(0 < tmp75++) { tmp74.Append(", "); } tmp74.Append("Items: "); Items.ToString(tmp74); } if((Payments != null) && __isset.@payments) { if(0 < tmp75++) { tmp74.Append(", "); } tmp74.Append("Payments: "); Payments.ToString(tmp74); } if((Attachments != null) && __isset.@attachments) { if(0 < tmp75++) { tmp74.Append(", "); } tmp74.Append("Attachments: "); Attachments.ToString(tmp74); } if((RiskScores != null) && __isset.riskScores) { if(0 < tmp75++) { tmp74.Append(", "); } tmp74.Append("RiskScores: "); RiskScores.ToString(tmp74); } tmp74.Append(')'); return tmp74.ToString(); } } }