import { TypeParser } from './parser-types'; import { HtmlParser } from './html-parser'; import { CsvParser } from './csv-parser'; import { PDFParser } from './pdf-parser'; import { Parser } from './parser.interface'; export class ParserBuilder { static build(type: TypeParser): Parser { const templatePath = '/app/dist/assets/template/pii-reporter.html'; if (type === 'html') { const htmlParser = new HtmlParser(templatePath); return htmlParser; } else if (type === 'csv') { const csvParser = new CsvParser(); return csvParser; } else if (type === 'pdf') { const htmlParser = new HtmlParser(templatePath); const pdfParser = new PDFParser(htmlParser); return pdfParser; } throw new Error('Unsupported Type: ' + type); } }