using System.ComponentModel.DataAnnotations;
using Managing.Domain.Backtests;
using static Managing.Common.Enums;

namespace Managing.Domain.Bots;

/// <summary>
/// Simplified trading bot configuration request with only primary properties
/// </summary>
public class TradingBotConfigRequest
{
    /// <summary>
    /// The account name to use for trading
    /// </summary>
    [Required]
    public string AccountName { get; set; }

    /// <summary>
    /// The ticker/symbol to trade
    /// </summary>
    [Required]
    public Ticker Ticker { get; set; }

    /// <summary>
    /// The timeframe for trading decisions
    /// </summary>
    [Required]
    public Timeframe Timeframe { get; set; }

    /// <summary>
    /// Whether this bot is for watching only (no actual trading)
    /// </summary>
    [Required]
    public bool IsForWatchingOnly { get; set; }

    /// <summary>
    /// The initial trading balance for the bot
    /// </summary>
    [Required]
    public decimal BotTradingBalance { get; set; }

    /// <summary>
    /// The name/identifier for this bot
    /// </summary>
    [Required]
    public string Name { get; set; }

    [Required] public bool FlipPosition { get; set; }

    /// <summary>
    /// Cooldown period between trades (in candles)
    /// </summary>
    [Required]
    public int CooldownPeriod { get; set; }

    /// <summary>
    /// Maximum consecutive losses before stopping the bot
    /// </summary>
    [Required]
    public int MaxLossStreak { get; set; }

    /// <summary>
    /// The scenario configuration (takes precedence over ScenarioName)
    /// </summary>
    public ScenarioRequest? Scenario { get; set; }

    /// <summary>
    /// The scenario name to load from database (only used when Scenario is not provided)
    /// </summary>
    public string? ScenarioName { get; set; }

    /// <summary>
    /// The money management name to load from database (only used when MoneyManagement is not provided)
    /// </summary>
    public string? MoneyManagementName { get; set; }

    /// <summary>
    /// The money management object to use for the bot
    /// </summary>
    public MoneyManagementRequest? MoneyManagement { get; set; }

    /// <summary>
    /// Maximum time in hours that a position can remain open before being automatically closed
    /// </summary>
    public decimal? MaxPositionTimeHours { get; set; }

    /// <summary>
    /// Whether to close positions early when they become profitable
    /// </summary>
    public bool CloseEarlyWhenProfitable { get; set; } = false;

    /// <summary>
    /// Whether to only flip positions when the current position is in profit
    /// </summary>
    public bool FlipOnlyWhenInProfit { get; set; } = true;

    /// <summary>
    /// Whether to use Synth API for predictions and risk assessment
    /// </summary>
    public bool UseSynthApi { get; set; } = false;

    /// <summary>
    /// Whether to use Synth predictions for position sizing adjustments
    /// </summary>
    public bool UseForPositionSizing { get; set; } = true;

    /// <summary>
    /// Whether to use Synth predictions for signal filtering
    /// </summary>
    public bool UseForSignalFiltering { get; set; } = true;

    /// <summary>
    /// Whether to use Synth predictions for dynamic stop-loss/take-profit adjustments
    /// </summary>
    public bool UseForDynamicStopLoss { get; set; } = true;
}