using SqlSugar;
namespace AssetManager.Data;
///
/// 交易流水表
///
[SugarTable("transactions")]
public class Transaction
{
///
/// 主键
///
[SugarColumn(IsPrimaryKey = true, IsIdentity = false)]
public string? Id { get; set; }
///
/// 所属组合ID
///
[SugarColumn(ColumnName = "portfolio_id", IndexGroupNameList = new string[] { "idx_portfolio_id" })]
public string? PortfolioId { get; set; }
///
/// 交易类型 (buy/sell)
///
[SugarColumn(ColumnName = "type", Length = 20)]
public string? Type { get; set; }
///
/// 标的代码
///
[SugarColumn(ColumnName = "stock_code", Length = 50)]
public string? StockCode { get; set; }
///
/// 资产类型 (Stock/Crypto)
///
[SugarColumn(ColumnName = "asset_type", Length = 20)]
public string? AssetType { get; set; }
///
/// 交易标题 (如: 定期定投)
///
[SugarColumn(ColumnName = "title", Length = 200)]
public string? Title { get; set; }
///
/// 交易数量
///
[SugarColumn(ColumnName = "amount", ColumnDataType = "decimal(18,8)")]
public decimal Amount { get; set; }
///
/// 成交价格
///
[SugarColumn(ColumnName = "price", ColumnDataType = "decimal(18,4)")]
public decimal Price { get; set; }
///
/// 交易总金额
///
[SugarColumn(ColumnName = "total_amount", ColumnDataType = "decimal(18,4)")]
public decimal TotalAmount { get; set; }
///
/// 交易币种
///
[SugarColumn(ColumnName = "currency", Length = 10)]
public string? Currency { get; set; }
///
/// 交易状态 (processing/completed)
///
[SugarColumn(ColumnName = "status", Length = 50)]
public string? Status { get; set; }
///
/// 交易备注
///
[SugarColumn(ColumnName = "remark", Length = 500, IsNullable = true)]
public string? Remark { get; set; }
///
/// 交易发生时间
///
[SugarColumn(ColumnName = "transaction_time")]
public DateTime TransactionTime { get; set; }
///
/// 记录创建时间
///
[SugarColumn(ColumnName = "created_at")]
public DateTime CreatedAt { get; set; }
}