using SqlSugar;
using Volo.Abp.Domain.Entities.Auditing;

namespace Yi.Framework.AiHub.Domain.Entities;

/// <summary>
/// 每日任务奖励领取记录
/// </summary>
[SugarTable("Ai_DailyTaskRewardRecord")]
[SugarIndex($"index_{nameof(UserId)}_{nameof(TaskDate)}",
    nameof(UserId), OrderByType.Asc,
    nameof(TaskDate), OrderByType.Desc)]
public class DailyTaskRewardRecordAggregateRoot : FullAuditedAggregateRoot<Guid>
{
    public DailyTaskRewardRecordAggregateRoot()
    {
    }

    public DailyTaskRewardRecordAggregateRoot(Guid userId, int taskLevel, DateTime taskDate, long rewardTokens)
    {
        UserId = userId;
        TaskLevel = taskLevel;
        TaskDate = taskDate.Date; // 确保只存储日期部分
        RewardTokens = rewardTokens;
        IsRewarded = true;
    }

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

    /// <summary>
    /// 任务等级（1=1000w任务，2=3000w任务）
    /// </summary>
    public int TaskLevel { get; set; }

    /// <summary>
    /// 任务日期（只包含日期，不包含时间）
    /// </summary>
    public DateTime TaskDate { get; set; }

    /// <summary>
    /// 奖励的Token数量
    /// </summary>
    public long RewardTokens { get; set; }

    /// <summary>
    /// 是否已发放奖励
    /// </summary>
    public bool IsRewarded { get; set; }

    /// <summary>
    /// 备注信息
    /// </summary>
    public string? Remark { get; set; }
}
