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_ActivationCode")]
[SugarIndex($"index_{nameof(Code)}", nameof(Code), OrderByType.Asc, true)]
[SugarIndex($"index_{nameof(GoodsType)}", nameof(GoodsType), OrderByType.Asc)]
public class ActivationCodeAggregateRoot : FullAuditedAggregateRoot<Guid>
{
    /// <summary>
    /// 激活码（唯一）
    /// </summary>
    [SugarColumn(Length = 50)]
    public string Code { get; set; } = string.Empty;

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

    /// <summary>
    /// 是否允许多人各使用一次
    /// </summary>
    public bool IsReusable { get; set; }

    /// <summary>
    /// 是否限制同类型只能兑换一次
    /// </summary>
    public bool IsSameTypeOnce { get; set; }

    /// <summary>
    /// 已使用次数
    /// </summary>
    public int UsedCount { get; set; }

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