async function addLine(lineDocY, text, value, lineType, isNewPageHeader, font = false) {
  const {doc, y} = lineDocY;
  const x = constants.X_START;
  // const headerColor = lineType === constants.PDFDocumentLineType.HEADER_LINE ? constants.PDFColors.INDICATIVE_COLOR : constants.PDFColors.NORMAL_COLOR;
  const headerColor = constants.PDFColors.NORMAL_COLOR;
  // A type should ALWAYS start with the getDocY function to ensure you are correctly positioned
  let docY;
  switch (lineType) {
    case constants.PDFDocumentLineType.EMPTY_LINE:
    case constants.PDFDocumentLineType.END_LINE: {
      docY = emptyLine.generateLineThatIsEmpty(doc, lineType, y);
      break;
    }
    case constants.PDFDocumentLineType.HEADER_LINE: {
      docY = headerLine.generateHeaderLine(doc, x, y, text, font);
      break;
    }
    case constants.PDFDocumentLineType.KEY_ICON_LINE: {
      docY = iconLine.populateIconLine(doc, x, y, text, value, headerColor, 180);
      break;
    }
    case constants.PDFDocumentLineType.ADDRESS_LINE: {
      docY = addressLine.generateAddressLine(doc, text, value, x, y, headerColor, font);
      break;
    }
    case constants.PDFDocumentLineType.COLUMN_INFO:
    case constants.PDFDocumentLineType.META_INFO: {
      docY = objectLine.generateLineThatIsObject(doc, x, y, text, value, lineType);
      break;
    }
    case constants.PDFDocumentLineType.GRID: { // TODO: requires validating new headers for page space
      docY = gridLine.generateLineThatIsGrid(doc, x, y, text, value, isNewPageHeader, headerColor, font);
      break;
    }
    case constants.PDFDocumentLineType.TABLE_OF_CONTENTS_LINE: {
      docY = pageOfContentsLine.generatePageOfContentsLine(doc, x, y, text, value, headerColor);
      break;
    }
    case constants.PDFDocumentLineType.KEY_LINK_LINE: {
      docY = linkLine.generateLineThatIsLink(doc, x, y, text, value, headerColor);
      break;
    }
    case constants.PDFDocumentLineType.INDICATIVE_BAR_LINE: {
      docY = indicativeLine.generateLineThatIsIndicativeBar(doc, x, y, text, value);
      break;
    }
    case constants.PDFDocumentLineType.IMAGE_LINE: {
      docY = await imageLine.generateLineThatIsImage(doc, x, y, value);
      break;
    }
    case constants.PDFDocumentLineType.PAGE_BREAK: {
      docY = doc.createNewPage();
      break;
    }
    case constants.PDFDocumentLineType.CHART_LINE: {
      docY = await chartLine.generateChart(doc, y, text, value);
      break;
    }
    default: {
      docY = textLine.generateLineThatIsText(doc, x, y, text, value, headerColor);
      break;
    }
  }
  return docY;
}
// addLine : This function builds the line/section to display on the PDF document
addLine : This function builds the line/section to display on the PDF document
addLine : This function builds the line / section to display on the PDF document
async function addLine(lineDocY, text, value, lineType, isNewPageHeader, font = false) {
  const {doc, y} = lineDocY;
  const x = constants.X_START;
  const headerColor = constants.PDFColors.NORMAL_COLOR;
  let docY;
  switch (lineType) {
    case constants.PDFDocumentLineType.EMPTY_LINE:
    case constants.PDFDocumentLineType.END_LINE: {
      docY = emptyLine.generateLineThatIsEmpty(doc, lineType, y);
      break;
    }
    case constants.PDFDocumentLineType.HEADER_LINE: {
      docY = headerLine.generateHeaderLine(doc, x, y, text, font);
      break;
    }
    case constants.PDFDocumentLineType.KEY_ICON_LINE: {
      docY = iconLine.populateIconLine(doc, x, y, text, value, headerColor, 180);
      break;
    }
    case constants.PDFDocumentLineType.ADDRESS_LINE: {
      docY = addressLine.generateAddressLine(doc, text, value, x, y, headerColor, font);
      break;
    }
    case constants.PDFDocumentLineType.COLUMN_INFO:
    case constants.PDFDocumentLineType.META_INFO: {
      docY = objectLine.generateLineThatIsObject(doc, x, y, text, value, lineType);
      break;
    }
    case constants.PDFDocumentLineType.GRID: { 
      docY = gridLine.generateLineThatIsGrid(doc, x, y, text, value, isNewPageHeader, headerColor, font);
      break;
    }
    case constants.PDFDocumentLineType.TABLE_OF_CONTENTS_LINE: {
      docY = pageOfContentsLine.generatePageOfContentsLine(doc, x, y, text, value, headerColor);
      break;
    }
    case constants.PDFDocumentLineType.KEY_LINK_LINE: {
      docY = linkLine.generateLineThatIsLink(doc, x, y, text, value, headerColor);
      break;
    }
    case constants.PDFDocumentLineType.INDICATIVE_BAR_LINE: {
      docY = indicativeLine.generateLineThatIsIndicativeBar(doc, x, y, text, value);
      break;
    }
    case constants.PDFDocumentLineType.IMAGE_LINE: {
      docY = await imageLine.generateLineThatIsImage(doc, x, y, value);
      break;
    }
    case constants.PDFDocumentLineType.PAGE_BREAK: {
      docY = doc.createNewPage();
      break;
    }
    case constants.PDFDocumentLineType.CHART_LINE: {
      docY = await chartLine.generateChart(doc, y, text, value);
      break;
    }
    default: {
      docY = textLine.generateLineThatIsText(doc, x, y, text, value, headerColor);
      break;
    }
  }
  return docY;
}
async function addLine ( lineDocY , text , value , lineType , isNewPageHeader , font = false ) { const { doc , y } = lineDocY ; const x = constants . X_START ; const headerColor = constants . PDFColors . NORMAL_COLOR ; let docY ; switch ( lineType ) { case constants . PDFDocumentLineType . EMPTY_LINE : case constants . PDFDocumentLineType . END_LINE : { docY = emptyLine . generateLineThatIsEmpty ( doc , lineType , y ) ; break ; } case constants . PDFDocumentLineType . HEADER_LINE : { docY = headerLine . generateHeaderLine ( doc , x , y , text , font ) ; break ; } case constants . PDFDocumentLineType . KEY_ICON_LINE : { docY = iconLine . populateIconLine ( doc , x , y , text , value , headerColor , 180 ) ; break ; } case constants . PDFDocumentLineType . ADDRESS_LINE : { docY = addressLine . generateAddressLine ( doc , text , value , x , y , headerColor , font ) ; break ; } case constants . PDFDocumentLineType . COLUMN_INFO : case constants . PDFDocumentLineType . META_INFO : { docY = objectLine . generateLineThatIsObject ( doc , x , y , text , value , lineType ) ; break ; } case constants . PDFDocumentLineType . GRID : { docY = gridLine . generateLineThatIsGrid ( doc , x , y , text , value , isNewPageHeader , headerColor , font ) ; break ; } case constants . PDFDocumentLineType . TABLE_OF_CONTENTS_LINE : { docY = pageOfContentsLine . generatePageOfContentsLine ( doc , x , y , text , value , headerColor ) ; break ; } case constants . PDFDocumentLineType . KEY_LINK_LINE : { docY = linkLine . generateLineThatIsLink ( doc , x , y , text , value , headerColor ) ; break ; } case constants . PDFDocumentLineType . INDICATIVE_BAR_LINE : { docY = indicativeLine . generateLineThatIsIndicativeBar ( doc , x , y , text , value ) ; break ; } case constants . PDFDocumentLineType . IMAGE_LINE : { docY = await imageLine . generateLineThatIsImage ( doc , x , y , value ) ; break ; } case constants . PDFDocumentLineType . PAGE_BREAK : { docY = doc . createNewPage ( ) ; break ; } case constants . PDFDocumentLineType . CHART_LINE : { docY = await chartLine . generateChart ( doc , y , text , value ) ; break ; } default : { docY = textLine . generateLineThatIsText ( doc , x , y , text , value , headerColor ) ; break ; } } return docY ; }
addLine : This function builds the line/section to display on the PDF document
addLine : This function builds the line / section to display on the PDF document
// const headerColor = lineType === constants.PDFDocumentLineType.HEADER_LINE ? constants.PDFColors.INDICATIVE_COLOR : constants.PDFColors.NORMAL_COLOR; // A type should ALWAYS start with the getDocY function to ensure you are correctly positioned // TODO: requires validating new headers for page space