import * as plugins from './plugins.js';

/**
 * A class to convert a given ZUGFeRD XML string
 * into a structured ILetter with invoice data.
 */
export class ZUGFeRDXmlDecoder {
  private xmlString: string;

  constructor(xmlString: string) {
    this.xmlString = xmlString;
  }

  public async getLetterData(): Promise<plugins.tsclass.business.ILetter> {
    const smartxmlInstance = new plugins.smartxml.SmartXml();
    return smartxmlInstance.parseXmlToObject(this.xmlString);
  }
}