using AutoMapper;
using ConverterDTE.Model.Dtos.Response;
using ConvertToDTE.Model;

public class DTEProfile : Profile
{
    public DTEProfile()
    {
        CreateMap<SourceDTE, DTE_MediPiel>()
            .ForMember(dest => dest.Version, opt => opt.MapFrom(src => src.Version))
            .ForMember(dest => dest.Documento, opt => opt.MapFrom(src => src.Documento))
            .ForMember(dest => dest.Personalizados, opt => opt.MapFrom(src => src.Personalizados));


        CreateMap<SourceDocumento, DTE_MediPiel.DocumentoMP>()
            .ForMember(dest => dest.ID, opt => opt.MapFrom(src => src.ID))
            .ForMember(dest => dest.Encabezado, opt => opt.MapFrom(src => src.Encabezado))
            .ForMember(dest => dest.DscRcgGlobal, opt => opt.MapFrom(src => src.DscRcgGlobal))
            .ForMember(dest => dest.Detalle, opt => opt.MapFrom(src => src.Detalle))
            .ForMember(dest => dest.CAE, opt => opt.MapFrom(src => src.CAE));

        CreateMap<SourceEncabezado, DTE_MediPiel.Encabezado>()
            .ForMember(dest => dest.IdDoc, opt => opt.MapFrom(src => src.IdDoc))
            .ForMember(dest => dest.Emisor, opt => opt.MapFrom(src => src.Emisor))
            .ForMember(dest => dest.Receptor, opt => opt.MapFrom(src => src.Receptor))
            .ForMember(dest => dest.Totales, opt => opt.MapFrom(src => src.Totales))
            .ForMember(dest => dest.Impuestos, opt => opt.MapFrom(src => src.Impuestos))
            .ForMember(dest => dest.Retenciones, opt => opt.MapFrom(src => src.Retenciones));

        CreateMap<SourceIdDoc, DTE_MediPiel.IdDoc>()
            .ForMember(dest => dest.Ambiente, opt => opt.MapFrom(src => src.Ambiente))
            .ForMember(dest => dest.TipoServicio, opt => opt.MapFrom(src => src.TipoServicio))
            .ForMember(dest => dest.Tipo, opt => opt.MapFrom(src => src.Tipo))
            .ForMember(dest => dest.Serie, opt => opt.MapFrom(src => src.Serie))
            .ForMember(dest => dest.Numero, opt => opt.MapFrom(src => src.Numero))
            .ForMember(dest => dest.NumeroInterno, opt => opt.MapFrom(src => src.NumeroInterno))
            .ForMember(dest => dest.FechaEmis, opt => opt.MapFrom(src => src.FechaEmis))
            .ForMember(dest => dest.Establecimiento, opt => opt.MapFrom(src => src.Establecimiento))
            .ForMember(dest => dest.PtoEmis, opt => opt.MapFrom(src => src.PtoEmis))
            .ForMember(dest => dest.FechaVenc, opt => opt.MapFrom(src => src.FechaVenc))
            .ForMember(dest => dest.IndServicio, opt => opt.MapFrom(src => src.IndServicio))
            .ForMember(dest => dest.Pagos, opt => opt.MapFrom(src => src.Pagos));

        CreateMap<SourcePagos, DTE_MediPiel.Pagos>()
            .ForMember(dest => dest.TipoPago, opt => opt.MapFrom(src => src.TipoPago))
            .ForMember(dest => dest.DescPago, opt => opt.MapFrom(src => src.DescPago))
            .ForMember(dest => dest.FechaPago, opt => opt.MapFrom(src => src.FechaPago))
            .ForMember(dest => dest.CondPago, opt => opt.MapFrom(src => src.CondPago));

        CreateMap<SourceEmisor, DTE_MediPiel.Emisor>()
            .ForMember(dest => dest.TipoContribuyente, opt => opt.MapFrom(src => src.TipoContribuyente))
            .ForMember(dest => dest.RegimenContable, opt => opt.MapFrom(src => src.RegimenContable))
            .ForMember(dest => dest.CdgSucursal, opt => opt.MapFrom(src => src.CdgSucursal))
            .ForMember(dest => dest.CdgGLNEmisor, opt => opt.MapFrom(src => src.CdgGLNEmisor))
            .ForMember(dest => dest.IDEmisor, opt => opt.MapFrom(src => src.IDEmisor))
            .ForMember(dest => dest.NmbEmisor, opt => opt.MapFrom(src => src.NmbEmisor))
            .ForMember(dest => dest.NombreEmisor, opt => opt.MapFrom(src => src.NombreEmisor))
            .ForMember(dest => dest.CodigoEmisor, opt => opt.MapFrom(src => src.CodigoEmisor))
            .ForMember(dest => dest.DomFiscal, opt => opt.MapFrom(src => src.DomFiscal))
            .ForMember(dest => dest.LugarExped, opt => opt.MapFrom(src => src.LugarExped))
            .ForMember(dest => dest.ContactoEmisor, opt => opt.MapFrom(src => src.ContactoEmisor));

        CreateMap<SourceNombre, DTE_MediPiel.Nombre>()
            .ForMember(dest => dest.PrimerNombre, opt => opt.MapFrom(src => src.PrimerNombre))
            .ForMember(dest => dest.Apellido, opt => opt.MapFrom(src => src.Apellido));

        CreateMap<SourceCodigoEmisor, DTE_MediPiel.CodigoEmisor>()
            .ForMember(dest => dest.TpoCdgIntEmisor, opt => opt.MapFrom(src => src.TpoCdgIntEmisor))
            .ForMember(dest => dest.CdgIntEmisor, opt => opt.MapFrom(src => src.CdgIntEmisor));

        CreateMap<SourceDireccion, DTE_MediPiel.Direccion>()
            .ForMember(dest => dest.Calle, opt => opt.MapFrom(src => src.Calle))
            .ForMember(dest => dest.Departamento, opt => opt.MapFrom(src => src.Departamento))
            .ForMember(dest => dest.Ciudad, opt => opt.MapFrom(src => src.Ciudad))
            .ForMember(dest => dest.Pais, opt => opt.MapFrom(src => src.Pais))
            .ForMember(dest => dest.CodigoPostal, opt => opt.MapFrom(src => src.CodigoPostal));

        CreateMap<SourceContacto, DTE_MediPiel.Contacto>()
            .ForMember(dest => dest.Nombre, opt => opt.MapFrom(src => src.Nombre))
            .ForMember(dest => dest.Descripcion, opt => opt.MapFrom(src => src.Descripcion))
            .ForMember(dest => dest.eMail, opt => opt.MapFrom(src => src.eMail))
            .ForMember(dest => dest.Telefono, opt => opt.MapFrom(src => src.Telefono))
            .ForMember(dest => dest.Fax, opt => opt.MapFrom(src => src.Fax));

        CreateMap<SourceReceptor, DTE_MediPiel.Receptor>()
            .ForMember(dest => dest.TipoContribuyenteR, opt => opt.MapFrom(src => src.TipoContribuyenteR))
            .ForMember(dest => dest.RegimenContableR, opt => opt.MapFrom(src => src.RegimenContableR))
            .ForMember(dest => dest.CdgGNLReceptor, opt => opt.MapFrom(src => src.CdgGNLReceptor))
            .ForMember(dest => dest.CdgSucursal, opt => opt.MapFrom(src => src.CdgSucursal))
            .ForMember(dest => dest.DocRecep, opt => opt.MapFrom(src => src.DocRecep))
            .ForMember(dest => dest.NombreRecep, opt => opt.MapFrom(src => src.NombreRecep))
            .ForMember(dest => dest.CodigoReceptor, opt => opt.MapFrom(src => src.CodigoReceptor))
            .ForMember(dest => dest.DomFiscalRcp, opt => opt.MapFrom(src => src.DomFiscalRcp))
            .ForMember(dest => dest.LugarRecep, opt => opt.MapFrom(src => src.LugarRecep))
            .ForMember(dest => dest.ContactoReceptor, opt => opt.MapFrom(src => src.ContactoReceptor));

        CreateMap<SourceDocRecep, DTE_MediPiel.DocRecep>()
            .ForMember(dest => dest.TipoDocRecep, opt => opt.MapFrom(src => src.TipoDocRecep))
            .ForMember(dest => dest.NroDocRecep, opt => opt.MapFrom(src => src.NroDocRecep))
            .ForMember(dest => dest.NmbRecep, opt => opt.MapFrom(src => src.NmbRecep));

        CreateMap<SourceCodigoReceptor, DTE_MediPiel.CodigoReceptor>()
            .ForMember(dest => dest.TpoCdgIntRecep, opt => opt.MapFrom(src => src.TpoCdgIntRecep))
            .ForMember(dest => dest.CdgIntRecep, opt => opt.MapFrom(src => src.CdgIntRecep));

        CreateMap<SourceTotales, DTE_MediPiel.Totales>()
            .ForMember(dest => dest.Moneda, opt => opt.MapFrom(src => src.Moneda))
            .ForMember(dest => dest.FctConv, opt => opt.MapFrom(src => src.FctConv))
            .ForMember(dest => dest.FechaTCambio, opt => opt.MapFrom(src => src.FechaTCambio))
            .ForMember(dest => dest.SubTotal, opt => opt.MapFrom(src => src.SubTotal))
            .ForMember(dest => dest.MntDcto, opt => opt.MapFrom(src => src.MntDcto))
            .ForMember(dest => dest.MntRcgo, opt => opt.MapFrom(src => src.MntRcgo))
            .ForMember(dest => dest.MntBase, opt => opt.MapFrom(src => src.MntBase))
            .ForMember(dest => dest.MntImp, opt => opt.MapFrom(src => src.MntImp))
            .ForMember(dest => dest.SaldoAnterior, opt => opt.MapFrom(src => src.SaldoAnterior))
            .ForMember(dest => dest.VlrPagar, opt => opt.MapFrom(src => src.VlrPagar));

        CreateMap<SourceImpuestos, DTE_MediPiel.Impuestos>()
            .ForMember(dest => dest.TipoImp, opt => opt.MapFrom(src => src.TipoImp))
            .ForMember(dest => dest.TasaImp, opt => opt.MapFrom(src => src.TasaImp))
            .ForMember(dest => dest.PrecioPorUnidad, opt => opt.MapFrom(src => src.PrecioPorUnidad))
            .ForMember(dest => dest.UnidadMedida, opt => opt.MapFrom(src => src.UnidadMedida))
            .ForMember(dest => dest.MontoBaseImp, opt => opt.MapFrom(src => src.MontoBaseImp))
            .ForMember(dest => dest.MontoImp, opt => opt.MapFrom(src => src.MontoImp));

        CreateMap<SourceRetencion, DTE_MediPiel.Retencion>()
            .ForMember(dest => dest.TipoRet, opt => opt.MapFrom(src => src.TipoRet))
            .ForMember(dest => dest.TasaRet, opt => opt.MapFrom(src => src.TasaRet))
            .ForMember(dest => dest.MontoBaseRet, opt => opt.MapFrom(src => src.MontoBaseRet))
            .ForMember(dest => dest.MontoRet, opt => opt.MapFrom(src => src.MontoRet));

        CreateMap<SourceDetalle, DTE_MediPiel.Detalle>()
            .ForMember(dest => dest.NroLinDet, opt => opt.MapFrom(src => src.NroLinDet))
            .ForMember(dest => dest.CdgItem, opt => opt.MapFrom(src => src.CdgItem))
            .ForMember(dest => dest.TpoListaItem, opt => opt.MapFrom(src => src.TpoListaItem))
            .ForMember(dest => dest.DscLang, opt => opt.MapFrom(src => src.DscLang))
            .ForMember(dest => dest.DscItem, opt => opt.MapFrom(src => src.DscItem))
            .ForMember(dest => dest.QtyItem, opt => opt.MapFrom(src => src.QtyItem))
            .ForMember(dest => dest.UnmdItem, opt => opt.MapFrom(src => src.UnmdItem))
            .ForMember(dest => dest.PrcBrutoItem, opt => opt.MapFrom(src => src.PrcBrutoItem))
            .ForMember(dest => dest.SubDscto, opt => opt.MapFrom(src => src.SubDscto))
            .ForMember(dest => dest.SubRecargo, opt => opt.MapFrom(src => src.SubRecargo))
            .ForMember(dest => dest.ImpuestosDet, opt => opt.MapFrom(src => src.ImpuestosDet))
            .ForMember(dest => dest.RetencionesDet, opt => opt.MapFrom(src => src.RetencionesDet))
            .ForMember(dest => dest.SubMonto, opt => opt.MapFrom(src => src.SubMonto))
            .ForMember(dest => dest.MontoTotalItem, opt => opt.MapFrom(src => src.MontoTotalItem));

        CreateMap<SourceCdgItem, DTE_MediPiel.CdgItem>()
            .ForMember(dest => dest.TpoCodigo, opt => opt.MapFrom(src => src.TpoCodigo))
            .ForMember(dest => dest.VlrCodigo, opt => opt.MapFrom(src => src.VlrCodigo));

        CreateMap<SourceSubDscto, DTE_MediPiel.SubDscto>()
            .ForMember(dest => dest.TipoDscto, opt => opt.MapFrom(src => src.TipoDscto))
            .ForMember(dest => dest.GlosaDscto, opt => opt.MapFrom(src => src.GlosaDscto))
            .ForMember(dest => dest.PctDscto, opt => opt.MapFrom(src => src.PctDscto))
            .ForMember(dest => dest.MntDscto, opt => opt.MapFrom(src => src.MntDscto));

        CreateMap<SourceSubRecargo, DTE_MediPiel.SubRecargo>()
            .ForMember(dest => dest.TipoRecargo, opt => opt.MapFrom(src => src.TipoRecargo))
            .ForMember(dest => dest.GlosaRecargo, opt => opt.MapFrom(src => src.GlosaRecargo))
            .ForMember(dest => dest.PctRecargo, opt => opt.MapFrom(src => src.PctRecargo))
            .ForMember(dest => dest.MntRecargo, opt => opt.MapFrom(src => src.MntRecargo));

        CreateMap<SourceSubMonto, DTE_MediPiel.SubMonto>()
            .ForMember(dest => dest.Tipo, opt => opt.MapFrom(src => src.Tipo))
            .ForMember(dest => dest.CodTipoMonto, opt => opt.MapFrom(src => src.CodTipoMonto))
            .ForMember(dest => dest.MontoConcepto, opt => opt.MapFrom(src => src.MontoConcepto));

        CreateMap<SourceCAE, DTE_MediPiel.CAE>()
            .ForMember(dest => dest.Tipo, opt => opt.MapFrom(src => src.Tipo))
            .ForMember(dest => dest.Serie, opt => opt.MapFrom(src => src.Serie))
            .ForMember(dest => dest.NumeroInicial, opt => opt.MapFrom(src => src.NumeroInicial))
            .ForMember(dest => dest.NumeroFinal, opt => opt.MapFrom(src => src.NumeroFinal))
            .ForMember(dest => dest.NroResolucion, opt => opt.MapFrom(src => src.NroResolucion))
            .ForMember(dest => dest.FechaResolucion, opt => opt.MapFrom(src => src.FechaResolucion))
            .ForMember(dest => dest.ClaveTC, opt => opt.MapFrom(src => src.ClaveTC))
            .ForMember(dest => dest.Plazo, opt => opt.MapFrom(src => src.Plazo));

        CreateMap<SourceDscRcgGlobal, DTE_MediPiel.DscRcgGlobal>()
            .ForMember(dest => dest.TpoMov, opt => opt.MapFrom(src => src.TpoMov))
            .ForMember(dest => dest.CodigoDR, opt => opt.MapFrom(src => src.CodigoDR))
            .ForMember(dest => dest.GlosaDR, opt => opt.MapFrom(src => src.GlosaDR))
            .ForMember(dest => dest.PctDR, opt => opt.MapFrom(src => src.PctDR))
            .ForMember(dest => dest.ValorDR, opt => opt.MapFrom(src => src.ValorDR));

        CreateMap<SourcePersonalizados, DTE_MediPiel.PersonalizadosMP>()
            .ForMember(dest => dest.DocPersonalizado, opt => opt.MapFrom(src => src.DocPersonalizado));

        CreateMap<SourceDocPersonalizado, DTE_MediPiel.DocPersonalizado>()
            .ForMember(dest => dest.CampoStrings, opt => opt.MapFrom(src => src.CampoStrings));

        CreateMap<SourceCampoString, DTE_MediPiel.CampoString>()
            .ForMember(dest => dest.Name, opt => opt.MapFrom(src => src.Name))
            .ForMember(dest => dest.Value, opt => opt.MapFrom(src => src.Value));
    }
}