namespace Entity;

/// <summary>
/// 银行交易记录（由邮件解析生成）
/// </summary>
public class TransactionRecord : BaseEntity
{
    /// <summary>
    /// 卡号或账户标识
    /// </summary>
    public string Card { get; set; } = string.Empty;

    /// <summary>
    /// 交易原因/摘要
    /// </summary>
    public string Reason { get; set; } = string.Empty;

    /// <summary>
    /// 交易金额
    /// </summary>
    public decimal Amount { get; set; }

    /// <summary>
    /// 退款金额
    /// </summary>
    public decimal RefundAmount { get; set; }

    /// <summary>
    /// 交易后余额
    /// </summary>
    public decimal Balance { get; set; }

    /// <summary>
    /// 发生时间（邮件中的交易时间）
    /// </summary>
    public DateTime OccurredAt { get; set; }

    /// <summary>
    /// 原始邮件记录ID
    /// </summary>
    public long EmailMessageId { get; set; }

    /// <summary>
    /// 交易类型
    /// </summary>
    public TransactionType Type { get; set; }

    /// <summary>
    /// 交易分类
    /// </summary>
    public string Classify { get; set; } = string.Empty;

    /// <summary>
    /// 导入编号
    /// </summary>
    public string ImportNo { get; set; } = string.Empty;

    /// <summary>
    /// 导入来源
    /// </summary>
    public string ImportFrom { get; set; } = string.Empty;
}

public enum TransactionType
{
    /// <summary>
    /// 支出
    /// </summary>
    Expense = 0,

    /// <summary>
    /// 收入
    /// </summary>
    Income = 1,

    /// <summary>
    /// 不计入收支
    /// </summary>
    None = 2
}
