using System;

namespace ConvertToDTE.Model
{

    public class SourceDTE
    {
        public required string Version { get; set; }
        public required SourceDocumento Documento { get; set; }
        public required SourcePersonalizados Personalizados { get; set; }
    }

    public class SourceDocumento
    {
        public required string ID { get; set; }
        public required SourceEncabezado Encabezado { get; set; }
        public SourceDscRcgGlobal? DscRcgGlobal { get; set; }
        public SourceDetalle[]? Detalle { get; set; }
        public required SourceCAE CAE { get; set; }
    }

    public class SourceEncabezado
    {
        public required SourceIdDoc IdDoc { get; set; }
        public required SourceEmisor Emisor { get; set; }
        public required SourceReceptor Receptor { get; set; }
        public required SourceTotales Totales { get; set; }
        public SourceImpuestos[]? Impuestos { get; set; }
        public SourceRetencion[]? Retenciones { get; set; }
    }

    public class SourceIdDoc
    {
        public required string Ambiente { get; set; }
        public required string TipoServicio { get; set; }
        public required string Tipo { get; set; }
        public required string Serie { get; set; }
        public required string Numero { get; set; }
        public string? NumeroInterno { get; set; }
        public required string FechaEmis { get; set; }
        public string? Establecimiento { get; set; }
        public string? PtoEmis { get; set; }
        public string? FechaVenc { get; set; }
        public string? IndServicio { get; set; }
        public required SourcePagos[] Pagos { get; set; }
    }

    public class SourcePagos
    {
        public required string TipoPago { get; set; }
        public string? DescPago { get; set; }
        public string? FechaPago { get; set; }
        public required string CondPago { get; set; }
    }

    public class SourceEmisor
    {
        public required string TipoContribuyente { get; set; }
        public string? RegimenContable { get; set; }
        public string? CdgSucursal { get; set; }
        public string? CdgGLNEmisor { get; set; }
        public required string IDEmisor { get; set; }
        public required string NmbEmisor { get; set; }
        public required SourceNombre NombreEmisor { get; set; }
        public required SourceCodigoEmisor CodigoEmisor { get; set; }
        public required SourceDireccion DomFiscal { get; set; }
        public required SourceDireccion LugarExped { get; set; }
        public required SourceContacto ContactoEmisor { get; set; }
    }

    public class SourceNombre
    {
        public required string PrimerNombre { get; set; }
        public string? Apellido { get; set; }
    }

    public class SourceCodigoEmisor
    {
        public required string TpoCdgIntEmisor { get; set; }
        public required string CdgIntEmisor { get; set; }
    }

    public class SourceDireccion
    {
        public required string Calle { get; set; }
        public required string Departamento { get; set; }
        public required string Ciudad { get; set; }
        public required string Pais { get; set; }
        public string? CodigoPostal { get; set; }
    }

    public class SourceContacto
    {
        public string? Nombre { get; set; }
        public string? Descripcion { get; set; }
        public required string eMail { get; set; }
        public string? Telefono { get; set; }
        public string? Fax { get; set; }
    }

    public class SourceReceptor
    {
        public required string TipoContribuyenteR { get; set; }
        public string? RegimenContableR { get; set; }
        public string? CdgGNLReceptor { get; set; }
        public string? CdgSucursal { get; set; }
        public required SourceDocRecep DocRecep { get; set; }
        public required SourceNombre NombreRecep { get; set; }
        public SourceCodigoReceptor? CodigoReceptor { get; set; }
        public SourceDireccion? DomFiscalRcp { get; set; }
        public SourceDireccion? LugarRecep { get; set; }
        public required SourceContacto ContactoReceptor { get; set; }
    }

    public class SourceDocRecep
    {
        public required string TipoDocRecep { get; set; }
        public required string NroDocRecep { get; set; }
        public required string NmbRecep { get; set; }
    }


    public class SourceCodigoReceptor
    {
        public string? TpoCdgIntRecep { get; set; }
        public string? CdgIntRecep { get; set; }
    }

    public class SourceTotales
    {
        public required string Moneda { get; set; }
        public string? FctConv { get; set; }
        public string? FechaTCambio { get; set; }
        public required string SubTotal { get; set; }
        public string? MntDcto { get; set; }
        public string? MntRcgo { get; set; }
        public required string MntBase { get; set; }
        public string? MntImp { get; set; }
        public string? SaldoAnterior { get; set; }
        public required string VlrPagar { get; set; }
    }

    public class SourceImpuestos
    {
        public string? TipoImp { get; set; }
        public string? TasaImp { get; set; }
        public string? PrecioPorUnidad { get; set; }
        public string? UnidadMedida { get; set; }
        public string? MontoBaseImp { get; set; }
        public string? MontoImp { get; set; }
    }

    public class SourceRetencion
    {
        public string? TipoRet { get; set; }
        public string? TasaRet { get; set; }
        public string? MontoBaseRet { get; set; }
        public string? MontoRet { get; set; }
    }

    public class SourceDetalle
    {
        public required string NroLinDet { get; set; }
        public required SourceCdgItem CdgItem { get; set; }
        public string? TpoListaItem { get; set; }
        public string? DscLang { get; set; }
        public required string DscItem { get; set; }
        public required string QtyItem { get; set; }
        public required string UnmdItem { get; set; }
        public required string PrcBrutoItem { get; set; }
        public SourceSubDscto[]? SubDscto { get; set; }
        public SourceSubRecargo? SubRecargo { get; set; }
        public SourceImpuestos[]? ImpuestosDet { get; set; }
        public SourceRetencion[]? RetencionesDet { get; set; }
        public SourceSubMonto? SubMonto { get; set; }
        public required string MontoTotalItem { get; set; }
    }

    public class SourceCdgItem
    {
        public required string TpoCodigo { get; set; }
        public required string VlrCodigo { get; set; }
    }

    public class SourceSubDscto
    {
        public string? TipoDscto { get; set; }
        public string? GlosaDscto { get; set; }
        public string? PctDscto { get; set; }
        public string? MntDscto { get; set; }
    }

    public class SourceSubRecargo
    {
        public string? TipoRecargo { get; set; }
        public string? GlosaRecargo { get; set; }
        public string? PctRecargo { get; set; }
        public string? MntRecargo { get; set; }
    }

    public class SourceSubMonto
    {
        public string? Tipo { get; set; }
        public string? CodTipoMonto { get; set; }
        public string? MontoConcepto { get; set; }
    }

    public class SourceCAE
    {
        public required string Tipo { get; set; }
        public string? Serie { get; set; }
        public required string NumeroInicial { get; set; }
        public required string NumeroFinal { get; set; }
        public required string NroResolucion { get; set; }
        public required string FechaResolucion { get; set; }
        public required string ClaveTC { get; set; }
        public required string Plazo { get; set; }
    }

    public class SourceDscRcgGlobal
    {
        public string? TpoMov { get; set; }
        public string? CodigoDR { get; set; }
        public string? GlosaDR { get; set; }
        public string? PctDR { get; set; }
        public string? ValorDR { get; set; }
    }

    public class SourcePersonalizados
    {
        public required SourceDocPersonalizado DocPersonalizado { get; set; }
    }

    public class SourceDocPersonalizado
    {
        public required SourceCampoString[] CampoStrings { get; set; }
    }

    public class SourceCampoString
    {
        public required string Name { get; set; }
        public required string Value { get; set; }
    }
}