using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using LittleShop.Enums;

namespace LittleShop.DTOs;

public class BotDto
{
    public Guid Id { get; set; }
    public string Name { get; set; } = string.Empty;
    public string Description { get; set; } = string.Empty;
    public BotType Type { get; set; }
    public BotStatus Status { get; set; }
    public DateTime CreatedAt { get; set; }
    public DateTime? LastSeenAt { get; set; }
    public DateTime? LastConfigSyncAt { get; set; }
    public bool IsActive { get; set; }
    public string Version { get; set; } = string.Empty;
    public string IpAddress { get; set; } = string.Empty;
    public string PlatformUsername { get; set; } = string.Empty;
    public string PlatformDisplayName { get; set; } = string.Empty;
    public string PlatformId { get; set; } = string.Empty;
    public string PersonalityName { get; set; } = string.Empty;
    public Dictionary<string, object> Settings { get; set; } = new();
    
    // Metrics summary
    public int TotalSessions { get; set; }
    public int ActiveSessions { get; set; }
    public decimal TotalRevenue { get; set; }
    public int TotalOrders { get; set; }
}

public class BotRegistrationDto
{
    [Required]
    [StringLength(100)]
    public string Name { get; set; } = string.Empty;
    
    [StringLength(500)]
    public string Description { get; set; } = string.Empty;
    
    public BotType Type { get; set; }
    
    [StringLength(50)]
    public string Version { get; set; } = string.Empty;
    
    [StringLength(50)]
    public string PersonalityName { get; set; } = string.Empty;
    
    public Dictionary<string, object> InitialSettings { get; set; } = new();
}

public class BotRegistrationResponseDto
{
    public Guid BotId { get; set; }
    public string BotKey { get; set; } = string.Empty;
    public string Name { get; set; } = string.Empty;
    public Dictionary<string, object> Settings { get; set; } = new();
}

public class BotAuthenticateDto
{
    public string BotKey { get; set; } = string.Empty;
}

public class BotSettingsDto
{
    public Dictionary<string, object> Telegram { get; set; } = new();
    public Dictionary<string, object> Privacy { get; set; } = new();
    public Dictionary<string, object> Features { get; set; } = new();
    public Dictionary<string, object> Redis { get; set; } = new();
    public List<string> Cryptocurrencies { get; set; } = new();
}

public class UpdateBotSettingsDto
{
    public Dictionary<string, object> Settings { get; set; } = new();
}

public class BotHeartbeatDto
{
    public string Version { get; set; } = string.Empty;
    public string IpAddress { get; set; } = string.Empty;
    public int ActiveSessions { get; set; }
    public Dictionary<string, object> Status { get; set; } = new();
}

public class UpdatePlatformInfoDto
{
    public string PlatformUsername { get; set; } = string.Empty;
    public string PlatformDisplayName { get; set; } = string.Empty;
    public string PlatformId { get; set; } = string.Empty;
}

public class BotWizardDto
{
    [Required(ErrorMessage = "Bot name is required")]
    [StringLength(50)]
    public string BotName { get; set; } = string.Empty;
    
    [Required(ErrorMessage = "Bot username is required")]
    [StringLength(100)]
    public string BotUsername { get; set; } = string.Empty;
    
    [StringLength(500)]
    public string Description { get; set; } = string.Empty;
    
    [StringLength(50)]
    public string PersonalityName { get; set; } = string.Empty;
    
    public string BotToken { get; set; } = string.Empty;
}