import { Attributes } from 'xml-js';
import { ComlementType } from '../../node_modules/@cfdi/complementos/src';
import { ComlementTypeConcept } from '../../node_modules/@cfdi/complementos/src';
import { ComplementProperties } from '../../node_modules/@cfdi/complementos/src';
import { ElementCompact } from 'xml-js';
import { ExportacionEnum } from '../../node_modules/@cfdi/catalogos/src';
import { ExportacionType } from '../../node_modules/@cfdi/catalogos/src';
import { FormaPago } from '../../node_modules/@cfdi/catalogos/src';
import { FormaPagoType } from '../../node_modules/@cfdi/catalogos/src';
import { MetodoPago } from '../../node_modules/@cfdi/catalogos/src';
import { MetodoPagoType } from '../../node_modules/@cfdi/catalogos/src';
import { Schema as Schema_2 } from '../../node_modules/@cfdi/xsd/src';
import { TipoComprobante } from '../../node_modules/@cfdi/catalogos/src';
import { TypeComprobante } from '../../node_modules/@cfdi/catalogos/src';
import { XmlComplements } from '../../node_modules/@cfdi/complementos/src';
import { XmlComplementsAttributes } from '../../node_modules/@cfdi/complementos/src';
import { XmlComplementsConcepts } from '../../node_modules/@cfdi/complementos/src';
import { XmlnsComplementsLinks } from '../../node_modules/@cfdi/complementos/src';

export declare interface AnyKey {
    [key: string]: any;
}

declare class BaseImpuestos {
    impuesto: XmlImpuestos;
    constructor(TotalImpuestos?: XmlImpuestosTrasladados);
    setTraslado(traslado: XmlTranRentAttributesProperties & {
        Base: string | number;
    }): this;
    setRetencion(retencion: Omit<XmlTranRentAttributesProperties, 'Base' | 'TipoFactor' | 'TasaOCuota'>): this;
    getTotalImpuestos(): XmlImpuestosTrasladados;
    getRetenciones(): XmlRetencionAttributes[];
    getTraslados(): XmlTransladoAttributes[];
}

export declare class CFDI extends Comprobante {
    private _cadenaOriginal;
    protected saxon?: SaxonHe | undefined;
    protected xslt?: XsltSheet | null;
    private debug;
    constructor(options?: Config);
    certificar(cerpath: string): CFDI;
    sellar(keyfile: string, password: string): Promise<void>;
    getJsonCdfi(): XmlCdfi;
    getXmlCdfi(): string;
    saveFile(file: string, pathSave: string, name: string): boolean;
    generarCadenaOriginal(): string;
    generarSello(cadenaOriginal: string, keyfile: string, password: string): string;
    get sello(): string;
    get cadenaOriginal(): string;
    get isBebug(): boolean;
    setDebug(debug: boolean): void;
}

export declare interface CFDIComprobante {
    Version?: string;
    Serie?: string;
    Folio?: string;
    Fecha: string;
    FormaPago?: FormaPago | FormaPagoType | number;
    CondicionesDePago?: string;
    SubTotal: string | number;
    Descuento?: string | number;
    Moneda: string;
    TipoCambio?: string;
    Total: string | number;
    TipoDeComprobante: TipoComprobante | TypeComprobante;
    Exportacion: ExportacionEnum | ExportacionType | string;
    MetodoPago?: MetodoPago | MetodoPagoType;
    LugarExpedicion: string;
    Confirmacion?: string;
}

declare class Comprobante {
    protected xml: XmlCdfi;
    protected tc: TagComprobante;
    protected version: string;
    protected XMLSchema: string;
    protected cfd: string;
    protected locations: string[];
    schema: Schema_2;
    constructor(options?: Config);
    protected xmlns(xmlns: XmlnsLinks): void;
    protected addXmlns(xmlnsKey: string, xmlns: string): void;
    protected addSchemaLocation(locations: string[]): void;
    setAttributesXml(attr?: XmlVersion): void;
    setAttributes(atrr?: ComprobanteAttributes): void;
    comprobante(attribute: CFDIComprobante): void;
    informacionGlobal(payload: {
        Periodicidad: string;
        Meses: string;
        Año: string | number;
    }): void;
    relacionados(relationCfdi: Relacionado): void;
    emisor(emisor: Emisor): void;
    receptor(receptor: Receptor): void;
    concepto(concept: Concepto): void;
    impuesto(impuesto: Impuestos): void;
    complemento(complements: ComlementType): void;
    setCertificado(certificado: string): void;
    setNoCertificado(noCertificado: string): void;
    setSello(sello: string): void;
    protected restartCfdi(): void;
    get xmlObject(): XmlCdfi;
}

export declare interface ComprobanteAttributes {
    xmlns?: XmlnsLinks;
    schemaLocation?: string[];
}

export declare interface ComprobanteSignature {
    NoCertificado: string;
    Certificado?: string;
    Sello?: string;
}

declare class Concepto extends BaseImpuestos {
    private existComplemnt;
    private complementProperties;
    private concepto;
    constructor(concepto: XmlConceptoAttributes);
    complemento(data: ComlementTypeConcept): void;
    terceros(cuenta: XmlConceptoTercerosAttributes): Concepto;
    predial(cuenta: string): Concepto;
    parte(parte: XmlConceptParteAttributes): Concepto;
    private aduana;
    setParteInformacionAduanera(pedimento: string): Concepto;
    InformacionAduanera(pedimento: string): Concepto;
    traslado(payload: XmlTranRentAttributesProperties & {
        Base: string | number;
    }): Concepto;
    retencion(payload: XmlTranRentAttributesProperties & {
        Base: string | number;
        TasaOCuota: string | number;
        Importe: string | number;
    }): Concepto;
    getConcept(): XmlConceptoProperties;
    isComplement(): boolean;
    getComplementProperties(): ComplementProperties;
}
export { Concepto }
export { Concepto as Concepts }

export declare interface Config {
    debug?: boolean;
    compact?: boolean;
    customTags?: any;
    schema?: Schema;
    saxon?: SaxonHe;
    xslt?: XsltSheet;
}

export declare class Emisor {
    emisor: XmlEmisor;
    constructor(emisor: XmlEmisorAttribute);
    setRfc(rfc: string): void;
    setNombre(nombre: string): void;
    setRegimenFiscal(regimenFiscal: string | number): void;
    setFacAtrAdquirente(facAtrAdquirente: string | number): void;
    toJson(): XmlEmisor;
}

export declare class Impuestos extends BaseImpuestos {
    constructor(TotalImpuestos?: XmlImpuestosTrasladados);
    traslados(payload: XmlTranRentAttributesProperties & {
        Base: string | number;
    }): this;
    retenciones(payload: Omit<XmlTranRentAttributesProperties, 'Base' | 'TipoFactor' | 'TasaOCuota'>): this;
}

export declare interface InformacionAduanera {
    _attributes: XmlInformacionAduaneraAttributes;
}

export declare enum InvoiceRelation {
    NOTA_DE_CREDITO = "01",
    NOTA_DE_DEBITO = "02",
    DELOVUCION_DE_MERCANCIA = "03",
    SUSTITUCION_DE_CFDI_PREVIOS = "04",
    TRASLADOS_DE_MERCANCIA_FACTURADOS_PREVIAMENTE = "05",
    FACTURA_POR_TRASLADOS_PREVIOS = "06",
    APLICACION_DE_ANTICIPO = "07",
    PAGOS_EN_PARCIALIDADES = "08",
    PAGOS_DIFERIDOS = "09"
}

export declare enum InvoiceType {
    INGRESO = "I",
    EGRESO = "E",
    TRASLADO = "T",
    NOMINA = "N",
    PAGO = "P"
}

export declare type ObjetoImp = '01' | '02' | '03';

export declare enum ObjetoImpEnum {
    NoobjetoDeimpuesto = "01",
    SíObjetoDeImpuesto = "02",
    SíObjetoDeImpuestoYNobligadoAlDesglose = "03"
}

export declare class Receptor {
    receptor: XmlReceptor;
    constructor(receptor: XmlReceptorAttribute);
    setRFC(rfc: string): void;
    setNombre(nombre: string): void;
    setUsoCFDI(usoCFDI: string): void;
    setDomicilioFiscalReceptor(domicilioFiscalReceptor: string): void;
    setResidenciaFiscal(residenciaFiscal: string): void;
    setNumRegIdTrib(numRegIdTrib: string): void;
    setRegimenFiscalReceptor(regimenFiscalReceptor: string): void;
    toJson(): XmlReceptor;
}

export declare class Relacionado {
    private relacionada;
    constructor(typeRelation: XmlRelacionadosAttributes);
    addRelation(uuid: string): void;
    getRelation(): XmlRelacionados;
    toJson(): XmlRelacionados;
}

export declare interface SaxonHe {
    binary: string;
}

export declare interface Schema {
    path: string;
}

export declare type TagComprobante = 'cfdi:Comprobante';

export declare type TagConcepto = 'cfdi:Concepto';

export declare type TagEmisor = 'cfdi:Emisor';

export declare type TagImpuestos = 'cfdi:Impuestos';

export declare type TagReceptor = 'cfdi:Receptor';

export declare type TagRelacionados = 'cfdi:CfdiRelacionados';

export declare enum TaxSystem {
    GENERAL_LEY_DE_PERSONAS_MORALES = "601",
    PERSONAS_MORALES_CON_FINES_NO_LUCRATIVOS = "603",
    SUELDOS_Y_SALARIOS = "605",
    ARRENDAMIENTO = "606",
    DEMAS_INGRESOS = "608",
    CONSOLIDACION = "609",
    RESIDENTES_EN_EL_EXTRANJERO = "610",
    INGRESOS_POR_DIVIDENDOS_SOCIOS_Y_ACCIONISTAS = "611",
    PERSONAS_FISICAS_CON_ACTIVIDADES_EMPRESARIALES_Y_PROFESIONALES = "612",
    INGRESOS_POR_INTERESES = "614",
    SIN_OBLIGACIONES_FISCALES = "616",
    SOCIEDADES_COOPERATIVAS_DE_PRODUCCION = "620",
    REGIMEN_DE_INCORPORACION_FISCAL = "621",
    ACTIVIDADES_AGRICOLAS_GANADERAS_SILVICOLAS_Y_PESQUERAS = "622",
    OPCIONAL_PARA_GRUPOS_DE_SOCIEDADES = "623",
    COORDINADOS = "624",
    HIDROCARBUROS = "628",
    REGIMEN_DE_ENAJENACION_O_ADQUISICION_DE_BIENES = "607",
    PREFERENTES_Y_EMPRESAS_MULTINACIONALES = "629",
    ENAJENACION_DE_ACCIONES_EN_BOLSA_DE_VALORES = "630",
    REGIMEN_DE_LOS_INGRESOS_POR_OBTENCION_DE_PREMIOS = "615"
}

export declare interface XmlCdfi {
    _declaration: XmlDeclaration;
    'cfdi:Comprobante': XmlComprobante;
}

export declare interface XmlComprobante {
    _attributes: XmlComprobanteAttributes;
    'cfdi:InformacionGlobal'?: any;
    'cfdi:CfdiRelacionados'?: XmlRelacionados;
    'cfdi:Emisor'?: XmlEmisor;
    'cfdi:Receptor'?: XmlReceptor;
    'cfdi:Conceptos': XmlConcepto;
    'cfdi:Impuestos'?: XmlImpuestos;
    'cfdi:Complemento'?: XmlComplements;
}

export declare interface XmlComprobanteAttributes extends XmlComplementsAttributes, CFDIComprobante, ComprobanteSignature, AnyKey {
    'xmlns:xsi'?: string;
    'xmlns:xs'?: string;
    'xsi:schemaLocation'?: string;
}

export declare interface XmlConcepto {
    'cfdi:Concepto': XmlConceptoProperties[];
}

export declare interface XmlConceptoAttributes extends Attributes {
    ClaveProdServ: string;
    NoIdentificacion?: string;
    Cantidad: number | string;
    ClaveUnidad: string;
    Unidad?: string;
    Descripcion: string;
    ValorUnitario: number | string;
    Importe: number | string;
    Descuento?: number | string;
    ObjetoImp: ObjetoImpEnum | ObjetoImp;
}

export declare interface XmlConceptoParte {
    _attributes: XmlConceptParteAttributes;
    'cfdi:InformacionAduanera'?: InformacionAduanera[];
}

export declare interface XmlConceptoProperties extends ElementCompact {
    _attributes: XmlConceptoAttributes;
    'cfdi:Impuestos': XmlImpuestos;
    'cfdi:ComplementoConcepto': XmlComplementsConcepts;
    'cfdi:Parte'?: XmlConceptoParte;
    'cfdi:InformacionAduanera'?: InformacionAduanera[];
}

export declare interface XmlConceptoTercerosAttributes {
    RfcACuentaTerceros: string | number;
    NombreACuentaTerceros: string | number;
    RegimenFiscalACuentaTerceros: string | number;
    DomicilioFiscalACuentaTerceros: string | number;
}

export declare interface XmlConceptParteAttributes {
    ClaveProdServ: string | number;
    NoIdentificacion?: string | number;
    Cantidad: string | number;
    Unidad?: string | number;
    Descripcion: string | number;
    ValorUnitario?: string | number;
    Importe?: string | number;
}

export declare interface XmlDeclaration {
    _attributes: XmlVersion;
}

export declare interface XmlEmisor {
    _attributes: XmlEmisorAttribute;
}

export declare interface XmlEmisorAttribute {
    Rfc: string;
    Nombre: string;
    RegimenFiscal: string | number;
    FacAtrAdquirente?: string | number;
}

export declare interface XmlImpuestos {
    _attributes: XmlImpuestosTrasladados;
    'cfdi:Traslados': XmlTranslado;
    'cfdi:Retenciones': XmlRetenciones;
}

export declare interface XmlImpuestosTrasladados {
    TotalImpuestosRetenidos?: number | string;
    TotalImpuestosTrasladados?: number | string;
}

export declare interface XmlInformacionAduaneraAttributes {
    NumeroPedimento: string;
}

export declare interface XmlnsLinks extends XmlnsComplementsLinks, AnyKey {
    cfdi?: string;
    xs?: string;
    xsi?: string;
}

export declare interface XmlReceptor {
    _attributes: XmlReceptorAttribute;
}

export declare interface XmlReceptorAttribute {
    Rfc: string;
    Nombre: string;
    UsoCFDI: string;
    DomicilioFiscalReceptor: string;
    ResidenciaFiscal?: string;
    NumRegIdTrib?: string;
    RegimenFiscalReceptor: string | number;
}

export declare interface XmlRelacionado {
    _attributes?: XmlRelacionadoAttributes;
}

export declare interface XmlRelacionadoAttributes {
    UUID: string;
}

export declare interface XmlRelacionados {
    _attributes?: XmlRelacionadosAttributes;
    'cfdi:CfdiRelacionado'?: XmlRelacionado[];
}

export declare interface XmlRelacionadosAttributes {
    TipoRelacion: string;
}

export declare interface XmlRetencionAttributes {
    _attributes: XmlTranRentAttributesProperties;
}

export declare interface XmlRetenciones {
    'cfdi:Retencion': XmlRetencionAttributes[];
}

export declare interface XmlTranRentAttributesProperties {
    Base?: string | number;
    Impuesto: string | number;
    TipoFactor: string;
    TasaOCuota?: string | number;
    Importe?: string | number;
}

export declare interface XmlTranslado {
    'cfdi:Traslado': XmlTransladoAttributes[];
}

export declare interface XmlTransladoAttributes {
    _attributes: XmlTranRentAttributesProperties;
}

export declare interface XmlVersion {
    version: string;
    encoding: string;
}

export declare interface XsltSheet {
    path: string;
}

export { }
