import { DateTime } from 'luxon';
/** Invoice fields needed for O&M 10-year aggregation (subset of Invoice entity). */
export type OmTenYearInvoiceInput = {
    fromDate?: string | null;
    toDate?: string | null;
    billingPeriodKey?: string | null;
    penaltyAmount?: number | null;
    /** Column M: sum for invoices overlapping this O&M year. */
    paidAmount?: number | null;
};
export type OmTenYearRowView = {
    year: number;
    /** Display: e.g. "1st year of O&M" */
    yearLabel: string;
    start: string;
    end: string;
    percent: string;
    amount: string;
    monthly: string;
    from: string;
    to: string;
    months: string;
    /** J */
    totalBill: string;
    /** K */
    cumulative: string;
    /** L */
    penalty: string;
    /** M: Bill paid till date (in Rs) */
    billPaid: string;
    /** N */
    finalBasic: string;
    /** O */
    gst18: string;
    /** P */
    totalPayable: string;
    /** Q */
    gstDed2: string;
    /** R */
    tdsDed2: string;
    /** S */
    labourCess: string;
    /** T */
    totalDeduction: string;
    /** U */
    finalAmount: string;
};
/** e.g. 1 -> "1st year of O&M", 10 -> "10th year of O&M" */
export declare function formatOmDisplayYearLabel(displayYear1To10: number): string;
/**
 * Per-row J–U from I, F, and penalty L (column).
 * J = I * F, N = J - L, O = N * 18%, P = N + O, Q/R/S = N*2%/2%/1%, T = Q+R+S, U = P - T.
 */
export declare function computeRowFinancials(params: {
    I: number;
    F: number;
    L: number;
}): {
    J: number;
    N: number;
    O: number;
    P: number;
    Q: number;
    R: number;
    S: number;
    T: number;
    U: number;
};
/**
 * Wall-calendar effective [from, to] for an invoice; used for overlap with O&M year windows.
 */
export declare function effectiveInvoiceRange(inv: OmTenYearInvoiceInput, zone: string): {
    from: DateTime;
    to: DateTime;
} | null;
export type AggregateYearBilling = {
    gFrom: DateTime | null;
    hTo: DateTime | null;
    /** Invoices overlapping the year window and service start (+1 pending when it overlaps); fallback when DB `no_of_months` absent. */
    billedCycleCount: number;
    L: number;
    /** Sum of paidAmount (Rs) for invoices in window; pending run has no extra paid. */
    totalPaid: number;
};
/**
 * G, H, billed-cycle fallback count, L for one O&M display year (DB invoices + optional pending).
 * **G/H:** latest bill **to** in that display year (pending included for the active year).
 */
export declare function aggregateInvoicesForYearWindow(invoices: OmTenYearInvoiceInput[], yearStart: DateTime, yearEnd: DateTime, omStart: DateTime, zone: string, options: {
    isCurrentYear: boolean;
    /** When isCurrentYear, this scheduled cycle is not yet in DB. */
    pendingFrom?: DateTime;
    pendingTo?: DateTime;
}): AggregateYearBilling;
/** Optional DB-backed progress from `scheme_yearly_details` (per display year 1–10). */
export type OmYearlyDbProgress = {
    noOfMonths: number;
    totalBillAmount: number;
    penaltyAmount: number | null;
};
export type ComputeOmTenYearRowsInput = {
    omStartDateIso: string;
    finalExecutedWorkCost: number;
    /** Scheme om_year **1–10** (display year). Used as a fallback when the bill period cannot place the active year. */
    omYear: number;
    invoices: OmTenYearInvoiceInput[];
    /** Current scheduled invoice period (not yet stored). */
    pendingPeriod: {
        fromIso: string;
        toIso: string;
    };
    timeZone: string;
    /** When set, billed months (I) and rollups align with `scheme_yearly_details` for that display year. */
    yearlyProgressByYear?: Record<number, OmYearlyDbProgress> | null;
};
export type OmTenYearRowMetric = {
    year: number;
    monthsI: number;
    F: number;
    J: number;
};
export type OmTenYearComputeMeta = {
    currentDisplayYear: number;
    inferredDisplayYear: number | null;
    usedDisplayYearFallback: boolean;
    pendingFromIso: string;
    pendingToIso: string;
    omStartDateIso: string;
    rowMetrics: OmTenYearRowMetric[];
};
/**
 * Template columns require **J = I × F** (after rupee rounding). `F` here is the displayed monthly amount.
 */
export declare function assertOmTenYearJEqualsITimesF(metrics: OmTenYearRowMetric[], tol?: number): void;
/**
 * Build 10 rows (display years 1–10) for O&M 10-year bill template.
 */
export declare function computeOmTenYearRows(input: ComputeOmTenYearRowsInput): {
    rows: OmTenYearRowView[];
    totals: {
        omCost: string;
    };
    meta: OmTenYearComputeMeta;
};
//# sourceMappingURL=computeOmTenYearRows.d.ts.map