/** * * 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 LineItem : TBase { private int _lineNo; private global::Echo.ThriftModel.LineType _type; private string _sku; private string _description; private double _qty; private string _qtyUnit; private double _unitPrice; private double _vatRate; private double _discount; private Dictionary _ext; public int LineNo { get { return _lineNo; } set { __isset.lineNo = true; this._lineNo = value; } } /// /// /// /// public global::Echo.ThriftModel.LineType Type { get { return _type; } set { __isset.@type = true; this._type = value; } } public string Sku { get { return _sku; } set { __isset.@sku = true; this._sku = value; } } public string Description { get { return _description; } set { __isset.@description = true; this._description = value; } } public double Qty { get { return _qty; } set { __isset.@qty = true; this._qty = value; } } public string QtyUnit { get { return _qtyUnit; } set { __isset.qtyUnit = true; this._qtyUnit = value; } } public double UnitPrice { get { return _unitPrice; } set { __isset.unitPrice = true; this._unitPrice = value; } } public double VatRate { get { return _vatRate; } set { __isset.vatRate = true; this._vatRate = value; } } public double Discount { get { return _discount; } set { __isset.@discount = true; this._discount = value; } } public Dictionary Ext { get { return _ext; } set { __isset.@ext = true; this._ext = value; } } public Isset __isset; public struct Isset { public bool lineNo; public bool @type; public bool @sku; public bool @description; public bool @qty; public bool qtyUnit; public bool unitPrice; public bool vatRate; public bool @discount; public bool @ext; } public LineItem() { } public LineItem DeepCopy() { var tmp35 = new LineItem(); if(__isset.lineNo) { tmp35.LineNo = this.LineNo; } tmp35.__isset.lineNo = this.__isset.lineNo; if(__isset.@type) { tmp35.Type = this.Type; } tmp35.__isset.@type = this.__isset.@type; if((Sku != null) && __isset.@sku) { tmp35.Sku = this.Sku; } tmp35.__isset.@sku = this.__isset.@sku; if((Description != null) && __isset.@description) { tmp35.Description = this.Description; } tmp35.__isset.@description = this.__isset.@description; if(__isset.@qty) { tmp35.Qty = this.Qty; } tmp35.__isset.@qty = this.__isset.@qty; if((QtyUnit != null) && __isset.qtyUnit) { tmp35.QtyUnit = this.QtyUnit; } tmp35.__isset.qtyUnit = this.__isset.qtyUnit; if(__isset.unitPrice) { tmp35.UnitPrice = this.UnitPrice; } tmp35.__isset.unitPrice = this.__isset.unitPrice; if(__isset.vatRate) { tmp35.VatRate = this.VatRate; } tmp35.__isset.vatRate = this.__isset.vatRate; if(__isset.@discount) { tmp35.Discount = this.Discount; } tmp35.__isset.@discount = this.__isset.@discount; if((Ext != null) && __isset.@ext) { tmp35.Ext = this.Ext.DeepCopy(); } tmp35.__isset.@ext = this.__isset.@ext; return tmp35; } 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.I32) { LineNo = await iprot.ReadI32Async(cancellationToken); } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 2: if (field.Type == TType.I32) { Type = (global::Echo.ThriftModel.LineType)await iprot.ReadI32Async(cancellationToken); } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 3: if (field.Type == TType.String) { Sku = await iprot.ReadStringAsync(cancellationToken); } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 4: if (field.Type == TType.String) { Description = await iprot.ReadStringAsync(cancellationToken); } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 5: if (field.Type == TType.Double) { Qty = await iprot.ReadDoubleAsync(cancellationToken); } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 6: if (field.Type == TType.String) { QtyUnit = await iprot.ReadStringAsync(cancellationToken); } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 7: if (field.Type == TType.Double) { UnitPrice = await iprot.ReadDoubleAsync(cancellationToken); } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 8: if (field.Type == TType.Double) { VatRate = await iprot.ReadDoubleAsync(cancellationToken); } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 9: if (field.Type == TType.Double) { Discount = await iprot.ReadDoubleAsync(cancellationToken); } else { await TProtocolUtil.SkipAsync(iprot, field.Type, cancellationToken); } break; case 10: if (field.Type == TType.Map) { { var _map36 = await iprot.ReadMapBeginAsync(cancellationToken); Ext = new Dictionary(_map36.Count); for(int _i37 = 0; _i37 < _map36.Count; ++_i37) { string _key38; global::Echo.ThriftModel.Variant _val39; _key38 = await iprot.ReadStringAsync(cancellationToken); _val39 = new global::Echo.ThriftModel.Variant(); await _val39.ReadAsync(iprot, cancellationToken); Ext[_key38] = _val39; } await iprot.ReadMapEndAsync(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 tmp40 = new TStruct("LineItem"); await oprot.WriteStructBeginAsync(tmp40, cancellationToken); var tmp41 = new TField(); if(__isset.lineNo) { tmp41.Name = "lineNo"; tmp41.Type = TType.I32; tmp41.ID = 1; await oprot.WriteFieldBeginAsync(tmp41, cancellationToken); await oprot.WriteI32Async(LineNo, cancellationToken); await oprot.WriteFieldEndAsync(cancellationToken); } if(__isset.@type) { tmp41.Name = "type"; tmp41.Type = TType.I32; tmp41.ID = 2; await oprot.WriteFieldBeginAsync(tmp41, cancellationToken); await oprot.WriteI32Async((int)Type, cancellationToken); await oprot.WriteFieldEndAsync(cancellationToken); } if((Sku != null) && __isset.@sku) { tmp41.Name = "sku"; tmp41.Type = TType.String; tmp41.ID = 3; await oprot.WriteFieldBeginAsync(tmp41, cancellationToken); await oprot.WriteStringAsync(Sku, cancellationToken); await oprot.WriteFieldEndAsync(cancellationToken); } if((Description != null) && __isset.@description) { tmp41.Name = "description"; tmp41.Type = TType.String; tmp41.ID = 4; await oprot.WriteFieldBeginAsync(tmp41, cancellationToken); await oprot.WriteStringAsync(Description, cancellationToken); await oprot.WriteFieldEndAsync(cancellationToken); } if(__isset.@qty) { tmp41.Name = "qty"; tmp41.Type = TType.Double; tmp41.ID = 5; await oprot.WriteFieldBeginAsync(tmp41, cancellationToken); await oprot.WriteDoubleAsync(Qty, cancellationToken); await oprot.WriteFieldEndAsync(cancellationToken); } if((QtyUnit != null) && __isset.qtyUnit) { tmp41.Name = "qtyUnit"; tmp41.Type = TType.String; tmp41.ID = 6; await oprot.WriteFieldBeginAsync(tmp41, cancellationToken); await oprot.WriteStringAsync(QtyUnit, cancellationToken); await oprot.WriteFieldEndAsync(cancellationToken); } if(__isset.unitPrice) { tmp41.Name = "unitPrice"; tmp41.Type = TType.Double; tmp41.ID = 7; await oprot.WriteFieldBeginAsync(tmp41, cancellationToken); await oprot.WriteDoubleAsync(UnitPrice, cancellationToken); await oprot.WriteFieldEndAsync(cancellationToken); } if(__isset.vatRate) { tmp41.Name = "vatRate"; tmp41.Type = TType.Double; tmp41.ID = 8; await oprot.WriteFieldBeginAsync(tmp41, cancellationToken); await oprot.WriteDoubleAsync(VatRate, cancellationToken); await oprot.WriteFieldEndAsync(cancellationToken); } if(__isset.@discount) { tmp41.Name = "discount"; tmp41.Type = TType.Double; tmp41.ID = 9; await oprot.WriteFieldBeginAsync(tmp41, cancellationToken); await oprot.WriteDoubleAsync(Discount, cancellationToken); await oprot.WriteFieldEndAsync(cancellationToken); } if((Ext != null) && __isset.@ext) { tmp41.Name = "ext"; tmp41.Type = TType.Map; tmp41.ID = 10; await oprot.WriteFieldBeginAsync(tmp41, cancellationToken); await oprot.WriteMapBeginAsync(new TMap(TType.String, TType.Struct, Ext.Count), cancellationToken); foreach (string _iter42 in Ext.Keys) { await oprot.WriteStringAsync(_iter42, cancellationToken); await Ext[_iter42].WriteAsync(oprot, cancellationToken); } await oprot.WriteMapEndAsync(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 LineItem other)) return false; if (ReferenceEquals(this, other)) return true; return ((__isset.lineNo == other.__isset.lineNo) && ((!__isset.lineNo) || (global::System.Object.Equals(LineNo, other.LineNo)))) && ((__isset.@type == other.__isset.@type) && ((!__isset.@type) || (global::System.Object.Equals(Type, other.Type)))) && ((__isset.@sku == other.__isset.@sku) && ((!__isset.@sku) || (global::System.Object.Equals(Sku, other.Sku)))) && ((__isset.@description == other.__isset.@description) && ((!__isset.@description) || (global::System.Object.Equals(Description, other.Description)))) && ((__isset.@qty == other.__isset.@qty) && ((!__isset.@qty) || (global::System.Object.Equals(Qty, other.Qty)))) && ((__isset.qtyUnit == other.__isset.qtyUnit) && ((!__isset.qtyUnit) || (global::System.Object.Equals(QtyUnit, other.QtyUnit)))) && ((__isset.unitPrice == other.__isset.unitPrice) && ((!__isset.unitPrice) || (global::System.Object.Equals(UnitPrice, other.UnitPrice)))) && ((__isset.vatRate == other.__isset.vatRate) && ((!__isset.vatRate) || (global::System.Object.Equals(VatRate, other.VatRate)))) && ((__isset.@discount == other.__isset.@discount) && ((!__isset.@discount) || (global::System.Object.Equals(Discount, other.Discount)))) && ((__isset.@ext == other.__isset.@ext) && ((!__isset.@ext) || (TCollections.Equals(Ext, other.Ext)))); } public override int GetHashCode() { int hashcode = 157; unchecked { if(__isset.lineNo) { hashcode = (hashcode * 397) + LineNo.GetHashCode(); } if(__isset.@type) { hashcode = (hashcode * 397) + Type.GetHashCode(); } if((Sku != null) && __isset.@sku) { hashcode = (hashcode * 397) + Sku.GetHashCode(); } if((Description != null) && __isset.@description) { hashcode = (hashcode * 397) + Description.GetHashCode(); } if(__isset.@qty) { hashcode = (hashcode * 397) + Qty.GetHashCode(); } if((QtyUnit != null) && __isset.qtyUnit) { hashcode = (hashcode * 397) + QtyUnit.GetHashCode(); } if(__isset.unitPrice) { hashcode = (hashcode * 397) + UnitPrice.GetHashCode(); } if(__isset.vatRate) { hashcode = (hashcode * 397) + VatRate.GetHashCode(); } if(__isset.@discount) { hashcode = (hashcode * 397) + Discount.GetHashCode(); } if((Ext != null) && __isset.@ext) { hashcode = (hashcode * 397) + TCollections.GetHashCode(Ext); } } return hashcode; } public override string ToString() { var tmp43 = new StringBuilder("LineItem("); int tmp44 = 0; if(__isset.lineNo) { if(0 < tmp44++) { tmp43.Append(", "); } tmp43.Append("LineNo: "); LineNo.ToString(tmp43); } if(__isset.@type) { if(0 < tmp44++) { tmp43.Append(", "); } tmp43.Append("Type: "); Type.ToString(tmp43); } if((Sku != null) && __isset.@sku) { if(0 < tmp44++) { tmp43.Append(", "); } tmp43.Append("Sku: "); Sku.ToString(tmp43); } if((Description != null) && __isset.@description) { if(0 < tmp44++) { tmp43.Append(", "); } tmp43.Append("Description: "); Description.ToString(tmp43); } if(__isset.@qty) { if(0 < tmp44++) { tmp43.Append(", "); } tmp43.Append("Qty: "); Qty.ToString(tmp43); } if((QtyUnit != null) && __isset.qtyUnit) { if(0 < tmp44++) { tmp43.Append(", "); } tmp43.Append("QtyUnit: "); QtyUnit.ToString(tmp43); } if(__isset.unitPrice) { if(0 < tmp44++) { tmp43.Append(", "); } tmp43.Append("UnitPrice: "); UnitPrice.ToString(tmp43); } if(__isset.vatRate) { if(0 < tmp44++) { tmp43.Append(", "); } tmp43.Append("VatRate: "); VatRate.ToString(tmp43); } if(__isset.@discount) { if(0 < tmp44++) { tmp43.Append(", "); } tmp43.Append("Discount: "); Discount.ToString(tmp43); } if((Ext != null) && __isset.@ext) { if(0 < tmp44++) { tmp43.Append(", "); } tmp43.Append("Ext: "); Ext.ToString(tmp43); } tmp43.Append(')'); return tmp43.ToString(); } } }