const { formatDateTime } = require("../../src/utils/ecservice-utils");

function buildFollowedHeader(order) {
  let header = `=== COMANDA ===\n`;
  if (order.table) header += `TAVOLO: ${order.table.name}\n`;
  if (order.guests) header += `OSPITI: ${order.guests}\n\n`;
  if (order.waiter) header += `CAMERIERE: ${order.waiter.name}\n`;
  if (order.order_date) header += `DATA: ${formatDateTime(order.order_date)}\n\n`;
  return header;
}

function buildFollowedTemplate(order) {
  const output = `${buildFollowedHeader(order)}====== SEGUITO ======\n\n`;

  return {
    output,
    printableOutput: output,
  };
}

module.exports = {
  buildFollowedTemplate,
};