using TaxCollectData.Library.Dto; using TaxCollectData.Library.Models; using static Aos19.Shared.Models.TaxModel; namespace Aos19.Infrastructure.Mappers { public static class InvoiceModelMapper { public static InvoiceDto MapToMoadianModel(this InvoiceModel.Header h) => new() { Header = new() { ft = h.Ft, tvop = (long?)h.Tvop, bid = h.Bid, tadis = (long?)h.Tadis, tvam = (long?)h.Tvam, tprdis = (long?)h.Tprdis, bpn = h.Bpn, billid = h.Billid, cap = (long?)h.Cap, cno = h.Cno, an = h.An, asn = h.Asn, asd = h.Asd, bbc = h.Bbc, bpc = h.Bpc, //cdcd = h.Cdcd, cdcn = h.Cdcn, crn = h.Crn, dci = h.Dci, dco = h.Dco, did = h.Did, In = h.In, indati2m = h.Indati2m, indatim = h.Indatim, inno = h.Inno, inp = h.Inp, ins = h.Ins, insp = (long?)h.Insp, inty = h.Inty, irtaxid = h.Irtaxid, lno = h.Lno, lrno = h.Lrno, lt = h.Lt, oci = h.Oci, ocu = h.Ocu, rid = h.Rid, sbc = h.Sbc, scc = h.Scc, scln = h.Scln, setm = h.Setm, tax17 = (long?)h.Tax17, taxid = h.Taxid, tbill = (long?)h.Tbill, tdis = (long?)h.Tdis, todam = (long?)h.Todam, tid = h.Tid, tinb = h.Tinb, tinc = h.Tinc, tins = h.Tins, tob = (int?)h.Tob, tocv = h.Tocv, tonw = h.Tonw, torv = (long?)h.Torv, //it = h.it, //sg = [], //sg = h.Sg, }, Body = h.ListProducts.Select(p => new BodyItemDto() { adis = (long?)p.Adis, tsstam = (long?)p.Tsstam, prdis = (long?)p.Prdis, am = p.Am, bros = (long?)p.Bros, bsrn = p.Bsrn, cfee = p.Cfee, fee = p.Fee, consfee = (long?)p.Consfee, cop = (long?)p.Cop, cpr = p.Cpr, cut = p.Cut, cui = p.Cui, dis = (long?)p.Dis, exr = (long?)p.Exr, hs = p.Hs, mu = p.Mu, nw = p.Nw, odam = (long?)p.Odam, odr = p.Odr, odt = p.Odt, olam = (long?)p.Olam, olr = p.Olr, olt = p.Olt, sovat = p.SoVat, spro = (long?)p.Spro, sscv = p.Sscv, ssrv = (long?)p.Ssrv, sstid = p.Sstid, sstt = p.Sstt, tcpbs = (long?)p.Tcpbs, vam = (long?)p.Vam, vba = p.Vba, vop = (long?)p.Vop, vra = p.Vra, }).ToList(), Extension = [], Payments = [], }; public static List MapToMoadianModel(this List h)// => new() { var r = new List(); foreach (var item in h) { r.Add(item.MapToMoadianModel()); } return r; } public static InvoiceValidationResponseModel2 MapToModel(this InvoiceValidationResponseModel m) => new() { Error = m.Error.Select(a => new ErrorModel2(a.Code, a.Message)).ToList(), Warning = m.Warning.Select(a => new ErrorModel2(a.Code, a.Message)).ToList(), }; } }