namespace ROLAC.API.Services.Disbursement;
///
/// Field coordinates (in inches) for printing onto pre-printed three-stub check stock.
/// Every position is bound from the "CheckPrint:Layout" section of appsettings.json so alignment
/// can be tuned and reloaded without recompiling. Positions are expressed as an X (absolute from the
/// page's left edge) plus a Y offset within the field's stub; the per-stub origins below place the
/// three stacked regions (check + two identical receipt copies) down the 8.5"x11" page.
///
public sealed class CheckPrintLayoutOptions
{
// Calibration nudge (inches): a TextBox renders its text inset down-and-right from the box
// origin by a fixed internal margin + line leading, so configured X/Y don't match the ink.
// These values are subtracted from every position so configured X/Y == actual printed position.
// To recalibrate: set both to 0, print, measure how far the ink sits past a known X/Y, and put
// those differences here (defaults are the measured inset for this stock).
public float TextInsetX { get; set; } = 0.13f;
public float TextInsetY { get; set; } = 0.15f;
// Stub origins — top edge of each region, inches from the top of the page.
public float CheckOriginY { get; set; } = 0f;
public float Receipt1OriginY { get; set; } = 3.67f;
public float Receipt2OriginY { get; set; } = 7.33f;
// Check stub fields (offset within the check stub).
public FieldPos Payee { get; set; } = new() { X = 1.25f, OffsetY = 1.75f, FontSize = 11, Bold = true };
public FieldPos AmountNumeric { get; set; } = new() { X = 6.50f, OffsetY = 1.75f, FontSize = 11, Bold = true };
public FieldPos AmountWords { get; set; } = new() { X = 0.60f, OffsetY = 2.20f, FontSize = 10 };
public FieldPos Memo { get; set; } = new() { X = 0.60f, OffsetY = 2.90f, FontSize = 9 };
public FieldPos CheckDate { get; set; } = new() { X = 6.50f, OffsetY = 1.25f, FontSize = 10 };
// Receipt stub fields (offset within a receipt stub — shared by both identical copies).
public FieldPos ReceiptPayee { get; set; } = new() { X = 1.00f, OffsetY = 0.30f, FontSize = 10, Bold = true };
public FieldPos ReceiptAmount { get; set; } = new() { X = 6.50f, OffsetY = 0.30f, FontSize = 10, Bold = true };
public FieldPos ReceiptMemo { get; set; } = new() { X = 1.00f, OffsetY = 0.60f, FontSize = 9 };
public FieldPos ReceiptDate { get; set; } = new() { X = 6.50f, OffsetY = 0.60f, FontSize = 9 };
// Voucher detail grid (offsets within a receipt stub).
public VoucherGridOptions Grid { get; set; } = new();
}
/// One printable field: where it sits and how it renders.
public sealed class FieldPos
{
/// Absolute X from the page's left edge, in inches.
public float X { get; set; }
/// Y offset within the field's stub, in inches (added to the stub origin).
public float OffsetY { get; set; }
public float FontSize { get; set; } = 10;
public bool Bold { get; set; }
}
///
/// Two-column voucher detail grid on each receipt stub: 6 rows per column, 12 expense lines max,
/// filled column-major (lines 1-6 left, 7-12 right). All offsets are within the receipt stub.
///
public sealed class VoucherGridOptions
{
/// Left edge of the left column block, in inches from the page's left edge.
public float OriginX { get; set; } = 0.60f;
/// Y offset (within the stub) of the first data row.
public float OffsetY { get; set; } = 1.10f;
public float RowHeight { get; set; } = 0.22f;
/// Horizontal gap between the left and right column blocks, in inches.
public float ColumnGap { get; set; } = 0.30f;
public float DateWidth { get; set; } = 0.85f;
public float DescWidth { get; set; } = 2.10f;
public float AmountWidth { get; set; } = 0.80f;
/// Draw our own Date/Description/Amount headers. Set false if the stock pre-prints them.
public bool ShowGridHeaders { get; set; } = true;
/// Y offset (within the stub) of the header row.
public float HeaderOffsetY { get; set; } = 0.88f;
/// Y offset (within the stub) of the "...and N more lines" overflow hint.
public float OverflowOffsetY { get; set; } = 2.55f;
public float FontSize { get; set; } = 8.5f;
}