using System.ComponentModel.DataAnnotations;

namespace FutureMailAPI.DTOs
{
    public class TimelineQueryDto
    {
        public DateTime? StartDate { get; set; }
        public DateTime? EndDate { get; set; }
        public TimelineType Type { get; set; } = TimelineType.ALL;
    }
    
    public class TimelineResponseDto
    {
        public List<TimelineDateDto> Timeline { get; set; } = new();
    }
    
    public class TimelineDateDto
    {
        public string Date { get; set; } = string.Empty; // YYYY-MM-DD格式
        public List<TimelineEventDto> Events { get; set; } = new();
    }
    
    public class TimelineEventDto
    {
        public TimelineEventType Type { get; set; }
        public int MailId { get; set; }
        public string Title { get; set; } = string.Empty;
        public string Time { get; set; } = string.Empty; // HH:mm格式
        public UserInfoDto WithUser { get; set; } = new();
        public string Emotion { get; set; } = string.Empty;
    }
    
    public class StatisticsResponseDto
    {
        public int TotalSent { get; set; }
        public int TotalReceived { get; set; }
        public int TimeTravelDuration { get; set; } // 总时间旅行时长（天）
        public string MostFrequentRecipient { get; set; } = string.Empty;
        public int MostCommonYear { get; set; }
        public List<KeywordCloudDto> KeywordCloud { get; set; } = new();
        public List<MonthlyStatsDto> MonthlyStats { get; set; } = new();
    }
    
    public class KeywordCloudDto
    {
        public string Word { get; set; } = string.Empty;
        public int Count { get; set; }
        public int Size { get; set; } // 用于显示的大小
    }
    
    public class MonthlyStatsDto
    {
        public string Month { get; set; } = string.Empty; // YYYY-MM格式
        public int Sent { get; set; }
        public int Received { get; set; }
    }
    
    public class UserInfoDto
    {
        public int UserId { get; set; }
        public string Username { get; set; } = string.Empty;
        public string? Avatar { get; set; }
    }
    
    public class SubscriptionResponseDto
    {
        public SubscriptionPlan Plan { get; set; }
        public int RemainingMails { get; set; }
        public long MaxAttachmentSize { get; set; } // 字节
        public SubscriptionFeaturesDto Features { get; set; } = new();
        public DateTime? ExpireDate { get; set; }
    }
    
    public class SubscriptionFeaturesDto
    {
        public bool AdvancedTriggers { get; set; }
        public bool CustomCapsules { get; set; }
        public bool AIAssistant { get; set; }
        public bool UnlimitedStorage { get; set; }
        public bool PriorityDelivery { get; set; }
    }
    
    public class UserProfileResponseDto
    {
        public int Id { get; set; }
        public string Username { get; set; } = string.Empty;
        public string Email { get; set; } = string.Empty;
        public string? Nickname { get; set; }
        public string? Avatar { get; set; }
        public DateTime CreatedAt { get; set; }
        public DateTime? LastLoginAt { get; set; }
        public SubscriptionResponseDto Subscription { get; set; } = new();
    }
    
    // 枚举定义
    public enum TimelineType
    {
        ALL = 0,
        SENT = 1,
        RECEIVED = 2
    }
    
    public enum TimelineEventType
    {
        SENT = 0,
        RECEIVED = 1
    }
    
    public enum SubscriptionPlan
    {
        FREE = 0,
        PREMIUM = 1,
        PRO = 2
    }
}