package com.lincfusion.udyamlinc.dto; import com.lincfusion.udyamlinc.enterprise.Enterprise; import com.lincfusion.udyamlinc.enterprise.LedgerEntry; import com.lincfusion.udyamlinc.officer.FieldVisit; import com.lincfusion.udyamlinc.risk.ForecastPoint; import com.lincfusion.udyamlinc.risk.ReasonCode; import com.lincfusion.udyamlinc.risk.RiskAlert; import com.lincfusion.udyamlinc.risk.StressScore; import java.math.BigDecimal; import java.util.List; /** Response shapes. These mirror the interfaces in UdyamLinc-UI/src/lib/api.ts. */ public final class UdyamResponses { private UdyamResponses() { } public record OfficerSessionResponse( String token, String tokenType, String username, String fullName, String role, List blocks, String branch) { } public record EnterpriseSessionResponse( String token, String tokenType, String enterpriseId, String name, String nameHi, String sector, String block, String lang) { } /** An enterprise flattened with its sector code, as the console's table expects. */ public record EnterpriseRow( Long id, String enterpriseId, String name, String nameHi, String sector, String block, String district, Integer ownerCount, Integer vintageMonths, BigDecimal loanOutstanding, BigDecimal monthlyInstalment, Integer score, String band, List trend, String lastUpdated, /** * Months until the downside case first fails to cover the instalment, * or null if it never does over the horizon. * *

Here because lead time is the product. A dashboard that ranks by * score alone shows what a bureau score already shows; ranking by when * trouble arrives is the thing this platform can do that they cannot. */ Integer firstBreachHorizon, String firstBreachMonth, /** The top-ranked reason sentence from the run that produced the score. */ String topDriver, String topDriverHi) { } /** Dashboard KPI tiles plus the enterprises-by-risk register. */ public record PortfolioResponse( String block, String month, long total, long totalDelta, long red, long redDelta, long watch, long watchDelta, long standard, long standardDelta, int updatedMinutesAgo, List rows) { } /** Everything the risk detail panel needs for one enterprise. */ public record EnterpriseDetailResponse( Enterprise enterprise, String sector, String district, StressScore score, List reasons, List forecast, List alerts, List visits, List ledger) { } public record ForecastResponse( String enterpriseId, String modelVersion, String engine, int horizonMonths, String breachMonth, BigDecimal shortfall, List points) { } /** The enterprise app's Home tab in one call. */ public record AppHomeResponse( Enterprise enterprise, RiskAlert alert, List forecast, BigDecimal todayIn, BigDecimal todayOut, String adviceEn, String adviceHi, String lastSyncedAt) { } public record SyncResultResponse(int accepted, int duplicates, String syncedAt) { } /** One playbook action, offered for a band. */ public record PlaybookActionResponse( String code, String label, String labelHi, String appliesTo, String detail) { } /** Sector pack rollup for the Forecasts screen. */ public record SectorRollupResponse( String sector, String label, long count, long red, long watch, long standard, int avgScore) { } }