using SqlSugar;
using Volo.Abp.Domain.Entities.Auditing;
using Yi.Framework.AiHub.Domain.Shared.Enums;

namespace Yi.Framework.AiHub.Domain.Entities;

/// <summary>
/// 激活码使用记录
/// </summary>
[SugarTable("Ai_ActivationCodeRecord")]
[SugarIndex($"index_{nameof(UserId)}_{nameof(ActivationCodeId)}",
    nameof(UserId), OrderByType.Asc,
    nameof(ActivationCodeId), OrderByType.Asc, true)]
[SugarIndex($"index_{nameof(UserId)}_{nameof(GoodsType)}",
    nameof(UserId), OrderByType.Asc,
    nameof(GoodsType), OrderByType.Asc)]
public class ActivationCodeRecordAggregateRoot : FullAuditedAggregateRoot<Guid>
{
    /// <summary>
    /// 激活码Id
    /// </summary>
    public Guid ActivationCodeId { get; set; }

    /// <summary>
    /// 激活码内容
    /// </summary>
    [SugarColumn(Length = 50)]
    public string Code { get; set; } = string.Empty;

    /// <summary>
    /// 用户Id
    /// </summary>
    public Guid UserId { get; set; }

    /// <summary>
    /// 商品类型
    /// </summary>
    public ActivationCodeGoodsTypeEnum GoodsType { get; set; }

    /// <summary>
    /// 兑换时间
    /// </summary>
    public DateTime RedeemTime { get; set; }

    /// <summary>
    /// 备注
    /// </summary>
    [SugarColumn(Length = 500, IsNullable = true)]
    public string? Remark { get; set; }
}
