using System.ComponentModel.DataAnnotations;

namespace DramaLing.Api.Models.Configuration;

public class ReplicateOptions
{
    public const string SectionName = "Replicate";

    [Required(ErrorMessage = "Replicate API Key is required")]
    public string ApiKey { get; set; } = string.Empty;

    public string BaseUrl { get; set; } = "https://api.replicate.com/v1";

    [Range(60, 600, ErrorMessage = "Timeout must be between 60 and 600 seconds")]
    public int TimeoutSeconds { get; set; } = 300;

    public string DefaultModel { get; set; } = "ideogram-v2a-turbo";

    public Dictionary<string, ModelConfig> Models { get; set; } = new()
    {
        ["ideogram-v2a-turbo"] = new ModelConfig
        {
            Version = "c169dbd9a03b7bd35c3b05aa91e83bc4ad23ee2a4b8f93f2b6cbdda4f466de4a",
            CostPerGeneration = 0.025m,
            DefaultWidth = 512,
            DefaultHeight = 512,
            StyleType = "General",
            AspectRatio = "ASPECT_1_1",
            Model = "V_2_TURBO"
        },
        ["flux-1-dev"] = new ModelConfig
        {
            Version = "dev",
            CostPerGeneration = 0.05m,
            DefaultWidth = 512,
            DefaultHeight = 512
        },
        ["stable-diffusion-xl"] = new ModelConfig
        {
            Version = "39ed52f2a78e934b3ba6e2a89f5b1c712de7dfea535525255b1aa35c5565e08b",
            CostPerGeneration = 0.04m,
            DefaultWidth = 512,
            DefaultHeight = 512
        }
    };
}

public class ModelConfig
{
    public string Version { get; set; } = string.Empty;
    public decimal CostPerGeneration { get; set; }
    public int DefaultWidth { get; set; } = 512;
    public int DefaultHeight { get; set; } = 512;
    public string? StyleType { get; set; }
    public string? AspectRatio { get; set; }
    public string? Model { get; set; }
}