using Managing.Domain.Users;
using MediatR;
using static Managing.Common.Enums;

namespace Managing.Application.ManageBot.Commands
{
    public class StartBotCommand : IRequest<string>
    {
        public string Name { get; }
        public BotType BotType { get; }
        public Ticker Ticker { get; internal set; }
        public Timeframe Timeframe { get; internal set; }
        public bool IsForWatchingOnly { get; internal set; }
        public string Scenario { get; internal set; }
        public string AccountName { get; internal set; }
        public string MoneyManagementName { get; internal set; }
        public User User { get; internal set; }
        public decimal InitialTradingBalance { get; internal set; }

        public StartBotCommand(BotType botType,
            string name,
            Ticker ticker,
            string scenario,
            Timeframe timeframe,
            string accountName,
            string moneyManagementName,
            User user,
            bool isForWatchingOnly = false,
            decimal initialTradingBalance = 0)
        {
            BotType = botType;
            Name = name;
            Scenario = scenario;
            Ticker = ticker;
            Timeframe = timeframe;
            IsForWatchingOnly = isForWatchingOnly;
            AccountName = accountName;
            MoneyManagementName = moneyManagementName;
            User = user;
            InitialTradingBalance = initialTradingBalance > 0 ? initialTradingBalance : 
                throw new ArgumentException("Initial trading balance must be greater than zero", nameof(initialTradingBalance));
        }
    }
}
