package com.ruoyi.analytics.dto;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;

import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * 财务报表数据传输对象
 * 
 * @author ruoyi
 * @date 2025-12-19
 */
public class FinancialReportData
{
    /** 报表生成时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date generateTime;

    /** 统计期间开始时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date startDate;

    /** 统计期间结束时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date endDate;

    /** 债权统计数据 */
    private CreditStatistics creditStatistics;

    /** 收益分析数据 */
    private RevenueAnalysis revenueAnalysis;

    /** 风险评估数据 */
    private RiskAssessment riskAssessment;

    /** 趋势分析数据 */
    private List<TrendData> trendAnalysis;

    /** 分类统计数据 */
    private Map<String, Object> categoryStatistics;

    /** 同比数据 */
    private Map<String, Object> yearOverYearData;

    /** 环比数据 */
    private Map<String, Object> monthOverMonthData;

    /**
     * 债权统计数据
     */
    public static class CreditStatistics {
        /** 总债权数量 */
        private Long totalCredits;
        
        /** 总债权金额 */
        private BigDecimal totalAmount;
        
        /** 已结清债权数量 */
        private Long settledCredits;
        
        /** 已结清金额 */
        private BigDecimal settledAmount;
        
        /** 未结清债权数量 */
        private Long unsettledCredits;
        
        /** 未结清金额 */
        private BigDecimal unsettledAmount;
        
        /** 逾期债权数量 */
        private Long overdueCredits;
        
        /** 逾期金额 */
        private BigDecimal overdueAmount;

        // Getters and Setters
        public Long getTotalCredits() { return totalCredits; }
        public void setTotalCredits(Long totalCredits) { this.totalCredits = totalCredits; }
        
        public BigDecimal getTotalAmount() { return totalAmount; }
        public void setTotalAmount(BigDecimal totalAmount) { this.totalAmount = totalAmount; }
        
        public Long getSettledCredits() { return settledCredits; }
        public void setSettledCredits(Long settledCredits) { this.settledCredits = settledCredits; }
        
        public BigDecimal getSettledAmount() { return settledAmount; }
        public void setSettledAmount(BigDecimal settledAmount) { this.settledAmount = settledAmount; }
        
        public Long getUnsettledCredits() { return unsettledCredits; }
        public void setUnsettledCredits(Long unsettledCredits) { this.unsettledCredits = unsettledCredits; }
        
        public BigDecimal getUnsettledAmount() { return unsettledAmount; }
        public void setUnsettledAmount(BigDecimal unsettledAmount) { this.unsettledAmount = unsettledAmount; }
        
        public Long getOverdueCredits() { return overdueCredits; }
        public void setOverdueCredits(Long overdueCredits) { this.overdueCredits = overdueCredits; }
        
        public BigDecimal getOverdueAmount() { return overdueAmount; }
        public void setOverdueAmount(BigDecimal overdueAmount) { this.overdueAmount = overdueAmount; }
    }

    /**
     * 收益分析数据
     */
    public static class RevenueAnalysis {
        /** 总收入 */
        private BigDecimal totalRevenue;
        
        /** 总成本 */
        private BigDecimal totalCost;
        
        /** 净利润 */
        private BigDecimal netProfit;
        
        /** 利润率 */
        private BigDecimal profitMargin;
        
        /** 融资收入 */
        private BigDecimal financingRevenue;
        
        /** 融资成本 */
        private BigDecimal financingCost;
        
        /** 服务收入 */
        private BigDecimal serviceRevenue;

        // Getters and Setters
        public BigDecimal getTotalRevenue() { return totalRevenue; }
        public void setTotalRevenue(BigDecimal totalRevenue) { this.totalRevenue = totalRevenue; }
        
        public BigDecimal getTotalCost() { return totalCost; }
        public void setTotalCost(BigDecimal totalCost) { this.totalCost = totalCost; }
        
        public BigDecimal getNetProfit() { return netProfit; }
        public void setNetProfit(BigDecimal netProfit) { this.netProfit = netProfit; }
        
        public BigDecimal getProfitMargin() { return profitMargin; }
        public void setProfitMargin(BigDecimal profitMargin) { this.profitMargin = profitMargin; }
        
        public BigDecimal getFinancingRevenue() { return financingRevenue; }
        public void setFinancingRevenue(BigDecimal financingRevenue) { this.financingRevenue = financingRevenue; }
        
        public BigDecimal getFinancingCost() { return financingCost; }
        public void setFinancingCost(BigDecimal financingCost) { this.financingCost = financingCost; }
        
        public BigDecimal getServiceRevenue() { return serviceRevenue; }
        public void setServiceRevenue(BigDecimal serviceRevenue) { this.serviceRevenue = serviceRevenue; }
    }

    /**
     * 风险评估数据
     */
    public static class RiskAssessment {
        /** 整体风险等级 */
        private String overallRiskLevel;
        
        /** 风险评分 */
        private Integer riskScore;
        
        /** 信用风险 */
        private BigDecimal creditRisk;
        
        /** 流动性风险 */
        private BigDecimal liquidityRisk;
        
        /** 市场风险 */
        private BigDecimal marketRisk;
        
        /** 风险建议 */
        private List<String> riskRecommendations;

        // Getters and Setters
        public String getOverallRiskLevel() { return overallRiskLevel; }
        public void setOverallRiskLevel(String overallRiskLevel) { this.overallRiskLevel = overallRiskLevel; }
        
        public Integer getRiskScore() { return riskScore; }
        public void setRiskScore(Integer riskScore) { this.riskScore = riskScore; }
        
        public BigDecimal getCreditRisk() { return creditRisk; }
        public void setCreditRisk(BigDecimal creditRisk) { this.creditRisk = creditRisk; }
        
        public BigDecimal getLiquidityRisk() { return liquidityRisk; }
        public void setLiquidityRisk(BigDecimal liquidityRisk) { this.liquidityRisk = liquidityRisk; }
        
        public BigDecimal getMarketRisk() { return marketRisk; }
        public void setMarketRisk(BigDecimal marketRisk) { this.marketRisk = marketRisk; }
        
        public List<String> getRiskRecommendations() { return riskRecommendations; }
        public void setRiskRecommendations(List<String> riskRecommendations) { this.riskRecommendations = riskRecommendations; }
    }

    /**
     * 趋势数据
     */
    public static class TrendData {
        /** 时间点 */
        @JsonFormat(pattern = "yyyy-MM-dd")
        private Date timePoint;
        
        /** 指标名称 */
        private String metricName;
        
        /** 指标值 */
        private BigDecimal metricValue;
        
        /** 变化率 */
        private BigDecimal changeRate;

        // Getters and Setters
        public Date getTimePoint() { return timePoint; }
        public void setTimePoint(Date timePoint) { this.timePoint = timePoint; }
        
        public String getMetricName() { return metricName; }
        public void setMetricName(String metricName) { this.metricName = metricName; }
        
        public BigDecimal getMetricValue() { return metricValue; }
        public void setMetricValue(BigDecimal metricValue) { this.metricValue = metricValue; }
        
        public BigDecimal getChangeRate() { return changeRate; }
        public void setChangeRate(BigDecimal changeRate) { this.changeRate = changeRate; }
    }

    // Main class getters and setters
    public Date getGenerateTime() { return generateTime; }
    public void setGenerateTime(Date generateTime) { this.generateTime = generateTime; }
    
    public Date getStartDate() { return startDate; }
    public void setStartDate(Date startDate) { this.startDate = startDate; }
    
    public Date getEndDate() { return endDate; }
    public void setEndDate(Date endDate) { this.endDate = endDate; }
    
    public CreditStatistics getCreditStatistics() { return creditStatistics; }
    public void setCreditStatistics(CreditStatistics creditStatistics) { this.creditStatistics = creditStatistics; }
    
    public RevenueAnalysis getRevenueAnalysis() { return revenueAnalysis; }
    public void setRevenueAnalysis(RevenueAnalysis revenueAnalysis) { this.revenueAnalysis = revenueAnalysis; }
    
    public RiskAssessment getRiskAssessment() { return riskAssessment; }
    public void setRiskAssessment(RiskAssessment riskAssessment) { this.riskAssessment = riskAssessment; }
    
    public List<TrendData> getTrendAnalysis() { return trendAnalysis; }
    public void setTrendAnalysis(List<TrendData> trendAnalysis) { this.trendAnalysis = trendAnalysis; }
    
    public Map<String, Object> getCategoryStatistics() { return categoryStatistics; }
    public void setCategoryStatistics(Map<String, Object> categoryStatistics) { this.categoryStatistics = categoryStatistics; }
    
    public Map<String, Object> getYearOverYearData() { return yearOverYearData; }
    public void setYearOverYearData(Map<String, Object> yearOverYearData) { this.yearOverYearData = yearOverYearData; }
    
    public Map<String, Object> getMonthOverMonthData() { return monthOverMonthData; }
    public void setMonthOverMonthData(Map<String, Object> monthOverMonthData) { this.monthOverMonthData = monthOverMonthData; }
}