import jsPDF from 'jspdf';

export class TextBuilder {
  private text: string;

  constructor(private doc: jsPDF) {
    this.text = '';
  }

  // const save = () => {
  //   const h = 5;
  //   let y = 10;
  //   model.forEach((section) => {
  //     doc.setFontSize(14);
  //     doc.text(section.title, 10, y);
  //     y += h;
  //     section.paragraphs.forEach((paragraph) => {
  //       doc.setFontSize(11);
  //       const lines = doc.splitTextToSize(paragraph, 180);
  //       lines.forEach((line) => {
  //         doc.text(line, 10, y);
  //         y += h;
  //       });
  //       y += h;
  //     });
  //     y += h;
  //   });
  //   doc.save('test.pdf');
  // };

  public addText(text: string): TextBuilder {
    this.text += text;
    return this;
  }

  public addLine(text: string): TextBuilder {
    this.text += text + '\n';
    return this;
  }

  public build(): string {
    return this.text;
  }
}
