using System;

using Hiperscan.Common;
using Hiperscan.Unix;

namespace Hiperscan.PdfLib
{
    /// <summary>Provides segments that should be consistent over all HiperScan reports</summary>
    public class Report
    {
        public static void AddFooterTo(Layout document, string report_number, int page_number, int page_number_max)
        {
            document.SetFont(PdfFontTypes.HELVETICA, 6, PdfColors.Black);
            document.YPosition = document.InnerPageHeight;

            document.AddFooter("HiperScan GmbH\nWeißeritzstraße 3\n01067 Dresden\nGermany");
            string page_entry = string.Format(Catalog.GetString("Page {0}/{1}"), page_number, page_number_max);
            document.AddFooter(page_entry, PdfTextAlignments.Right);
            string label_report_number = Catalog.GetString("Report number");
            string report = $"{label_report_number}: {report_number}";
            document.AddFooter(report,PdfTextAlignments.Center);
        }

        public static string ReportNumber(string device_serial, DateTime date)
        {
            return string.Format("{0}_{1}",
                device_serial.Replace(' ', '_'),
                date.ToString(DateTimeFormat.ISO_8601_ALL_DASHES_NO_TIME_ZONE));
        }
    }
}
