using DramaLing.Core.Enums;

namespace DramaLing.Core.Entities;

public class Achievement : BaseEntity
{
    public string Name { get; set; } = string.Empty;
    public string Description { get; set; } = string.Empty;
    public string IconUrl { get; set; } = string.Empty;
    public AchievementType Type { get; set; }
    public int DiamondReward { get; set; } = 0;
    public int ExperienceReward { get; set; } = 0;
    public string? BadgeUrl { get; set; }
    public bool IsActive { get; set; } = true;
    
    // Navigation Properties
    public virtual ICollection<UserAchievement> UserAchievements { get; set; } = new List<UserAchievement>();
}

public class UserAchievement : BaseEntity
{
    public Guid UserId { get; set; }
    public Guid AchievementId { get; set; }
    public DateTime AchievedAt { get; set; } = DateTime.UtcNow;
    public bool IsRewardClaimed { get; set; } = false;
    public DateTime? RewardClaimedAt { get; set; }
    
    // Navigation Properties
    public virtual User User { get; set; } = null!;
    public virtual Achievement Achievement { get; set; } = null!;
}

public class DailyMission : BaseEntity
{
    public string Name { get; set; } = string.Empty;
    public string Description { get; set; } = string.Empty;
    public string IconUrl { get; set; } = string.Empty;
    public string Type { get; set; } = string.Empty; // vocabulary_recognition, dialogue_training, etc.
    public int TargetValue { get; set; } = 1;
    public string Unit { get; set; } = "次";
    public int ExperienceReward { get; set; } = 50;
    public int DiamondReward { get; set; } = 0;
    public bool IsActive { get; set; } = true;
    
    // Navigation Properties
    public virtual ICollection<UserDailyMission> UserDailyMissions { get; set; } = new List<UserDailyMission>();
}

public class UserDailyMission : BaseEntity
{
    public Guid UserId { get; set; }
    public Guid DailyMissionId { get; set; }
    public DateTime MissionDate { get; set; }
    public int CurrentValue { get; set; } = 0;
    public int TargetValue { get; set; } = 1;
    public bool IsCompleted { get; set; } = false;
    public DateTime? CompletedAt { get; set; }
    public bool IsRewardClaimed { get; set; } = false;
    public DateTime? RewardClaimedAt { get; set; }
    
    // Navigation Properties
    public virtual User User { get; set; } = null!;
    public virtual DailyMission DailyMission { get; set; } = null!;
}

public class TimeWarpChallenge : BaseEntity
{
    public Guid UserId { get; set; }
    public Guid ScenarioId { get; set; }
    public DateTime StartedAt { get; set; }
    public DateTime? CompletedAt { get; set; }
    public int TimeLimit { get; set; } = 300; // seconds
    public int TimeUsed { get; set; } = 0; // seconds
    public bool IsCompleted { get; set; } = false;
    public int Score { get; set; } = 0;
    public int ExperienceGained { get; set; } = 0;
    public int DiamondGained { get; set; } = 0;
    
    // Navigation Properties
    public virtual User User { get; set; } = null!;
    public virtual Scenario Scenario { get; set; } = null!;
}

public class UserLifePoint : BaseEntity
{
    public Guid UserId { get; set; }
    public int CurrentLifePoints { get; set; } = 5;
    public int MaxLifePoints { get; set; } = 5;
    public DateTime? NextRecoveryAt { get; set; }
    public DateTime? LastUsedAt { get; set; }
    
    // Navigation Properties  
    public virtual User User { get; set; } = null!;
}