namespace Entity;

public class BudgetArchive : BaseEntity
{
    /// <summary>
    /// 归档目标年份
    /// </summary>
    public int Year { get; set; }

    /// <summary>
    /// 归档目标月份
    /// </summary>
    public int Month { get; set; }

    /// <summary>
    /// 归档内容
    /// </summary>
    [JsonMap]
    public BudgetArchiveContent[] Content { get; set; } = [];

    /// <summary>
    /// 归档日期
    /// </summary>
    public DateTime ArchiveDate { get; set; } = DateTime.Now;

    /// <summary>
    /// 支出结余（预算 - 实际，正数表示省钱，负数表示超支）
    /// </summary>
    public decimal ExpenseSurplus { get; set; }

    /// <summary>
    /// 收入结余（实际 - 预算，正数表示超额收入，负数表示未达预期）
    /// </summary>
    public decimal IncomeSurplus { get; set; }

    public string? Summary { get; set; }
}

public record BudgetArchiveContent
{
    /// <summary>
    /// 预算名称
    /// </summary>
    public string Name { get; set; } = string.Empty;

    /// <summary>
    /// 统计周期
    /// </summary>
    public BudgetPeriodType Type { get; set; } = BudgetPeriodType.Month;

    /// <summary>
    /// 预算金额
    /// </summary>
    public decimal Limit { get; set; }

    /// <summary>
    /// 实际金额
    /// </summary>
    public decimal Actual { get; set; }

    /// <summary>
    /// 预算类别
    /// </summary>
    public BudgetCategory Category { get; set; }

    /// <summary>
    /// 相关分类 (逗号分隔的分类名称)
    /// </summary>
    public string[] SelectedCategories { get; set; } = [];

    /// <summary>
    /// 不记额预算
    /// </summary>
    public bool NoLimit { get; set; } = false;

    /// <summary>
    /// 描述说明
    /// </summary>
    public string Description { get; set; } = string.Empty;
}