using System.ComponentModel.DataAnnotations;

namespace LittleShop.DTOs;

public class CustomerDto
{
    public Guid Id { get; set; }
    public long TelegramUserId { get; set; }
    public string TelegramUsername { get; set; } = string.Empty;
    public string TelegramDisplayName { get; set; } = string.Empty;
    public string TelegramFirstName { get; set; } = string.Empty;
    public string TelegramLastName { get; set; } = string.Empty;
    public string? Email { get; set; }
    public string? PhoneNumber { get; set; }
    public bool AllowMarketing { get; set; }
    public bool AllowOrderUpdates { get; set; }
    public string Language { get; set; } = "en";
    public string Timezone { get; set; } = "UTC";
    public int TotalOrders { get; set; }
    public decimal TotalSpent { get; set; }
    public decimal AverageOrderValue { get; set; }
    public DateTime FirstOrderDate { get; set; }
    public DateTime LastOrderDate { get; set; }
    public string? CustomerNotes { get; set; }
    public bool IsBlocked { get; set; }
    public string? BlockReason { get; set; }
    public int RiskScore { get; set; }
    public int SuccessfulOrders { get; set; }
    public int CancelledOrders { get; set; }
    public int DisputedOrders { get; set; }
    public DateTime CreatedAt { get; set; }
    public DateTime UpdatedAt { get; set; }
    public DateTime LastActiveAt { get; set; }
    public DateTime? DataRetentionDate { get; set; }
    public bool IsActive { get; set; }

    // Calculated Properties
    public string DisplayName { get; set; } = string.Empty;
    public string CustomerType { get; set; } = string.Empty;
}

public class CustomerSummaryDto
{
    public Guid Id { get; set; }
    public string DisplayName { get; set; } = string.Empty;
    public string TelegramUsername { get; set; } = string.Empty;
    public int TotalOrders { get; set; }
    public decimal TotalSpent { get; set; }
    public string CustomerType { get; set; } = string.Empty;
    public int RiskScore { get; set; }
    public DateTime LastActiveAt { get; set; }
    public bool IsBlocked { get; set; }
}

public class CreateCustomerDto
{
    [Required]
    public long TelegramUserId { get; set; }
    
    public string TelegramUsername { get; set; } = string.Empty;
    
    [Required]
    public string TelegramDisplayName { get; set; } = string.Empty;
    
    public string TelegramFirstName { get; set; } = string.Empty;
    public string TelegramLastName { get; set; } = string.Empty;
    public string? Email { get; set; }
    public string? PhoneNumber { get; set; }
    public bool AllowMarketing { get; set; } = false;
    public bool AllowOrderUpdates { get; set; } = true;
    public string Language { get; set; } = "en";
    public string Timezone { get; set; } = "UTC";
}

public class UpdateCustomerDto
{
    public string TelegramUsername { get; set; } = string.Empty;
    public string TelegramDisplayName { get; set; } = string.Empty;
    public string TelegramFirstName { get; set; } = string.Empty;
    public string TelegramLastName { get; set; } = string.Empty;
    public string? Email { get; set; }
    public string? PhoneNumber { get; set; }
    public bool AllowMarketing { get; set; }
    public bool AllowOrderUpdates { get; set; }
    public string Language { get; set; } = "en";
    public string Timezone { get; set; } = "UTC";
    public string? CustomerNotes { get; set; }
    public bool IsBlocked { get; set; }
    public string? BlockReason { get; set; }
}