namespace Managing.Common;

public static class Enums
{
    public enum TradingExchanges
    {
        Binance,
        Kraken,
        Ftx,
        Evm,
        GmxV2
    }

    public enum GmxOrderType
    {
        Increase,
        Decrease,
        Swap
    }

    public enum SubgraphProvider
    {
        UniswapV2,
        ChainlinkPrice,
        ChainlinkGmx,
        Gbc
    }

    public enum WorkerAction
    {
        Start,
        Stop
    }

    public enum AccountType
    {
        Cex,
        Trader,
        Watch,
        Auth,
        Privy
    }

    public enum BotType
    {
        SimpleBot,
        ScalpingBot,
        FlippingBot
    }

    public enum IndicatorType
    {
        RsiDivergence,
        RsiDivergenceConfirm,
        MacdCross,
        EmaCross,
        ThreeWhiteSoldiers,
        SuperTrend,
        ChandelierExit,
        EmaTrend,
        Composite,
        StochRsiTrend,
        Stc,
        StDev,
        LaggingStc,
        SuperTrendCrossEma,
        DualEmaCross
    }

    public enum SignalType
    {
        Signal,
        Trend,
        Context
    }

    public enum BotStatus
    {
        Saved,
        Stopped,
        Running,
    }

    public enum SignalStatus
    {
        WaitingForPosition,
        PositionOpen,
        Expired
    }

    public enum Confidence
    {
        Low,
        Medium,
        High,
        None
    }

    public enum TradeDirection
    {
        None,
        Short,
        Long
    }

    public enum RiskLevel
    {
        Low,
        Medium,
        High,
        Adaptive
    }

    public enum TradeType
    {
        //
        // Summary:
        //     Limit order
        Limit = 0,

        //
        // Summary:
        //     Symbol order
        Market = 1,

        //
        // Summary:
        //     Stop market order
        StopMarket = 2,

        //
        // Summary:
        //     Stop limit order
        StopLimit = 3,

        //
        // Summary:
        //     Stop loss order
        StopLoss = 4,

        //
        // Summary:
        //     Take profit order
        TakeProfit = 5,

        //
        // Summary:
        //     Stop loss profit order
        StopLossProfit = 6,

        //
        // Summary:
        //     Stop loss profit limit order
        StopLossProfitLimit = 7,

        //
        // Summary:
        //     Stop loss limit order
        StopLossLimit = 8,

        //
        // Summary:
        //     Take profit limit order
        TakeProfitLimit = 9,

        //
        // Summary:
        //     Trailing stop order
        TrailingStop = 10,

        //
        // Summary:
        //     Trailing stop limit order
        TrailingStopLimit = 11,

        //
        // Summary:
        //     Stop loss and limit order
        StopLossAndLimit = 12,

        //
        // Summary:
        //     Settle position
        SettlePosition = 13
    }

    public enum TradeStatus
    {
        PendingOpen = 0,
        Requested = 1,
        Cancelled = 2,
        Filled = 3,
    }

    public static bool IsActive(this TradeStatus status) =>
        status == TradeStatus.Requested ||
        status == TradeStatus.Cancelled ||
        status == TradeStatus.Filled;


    [Flags]
    public enum PositionStatus
    {
        New = 0,
        Canceled = 1,
        Rejected = 2,
        Updating = 3,
        PartiallyFilled = 4,
        Filled = 5,
        Flipped = 6,
        Finished = 7
    }

    public enum PositionInitiator
    {
        PaperTrading,
        Bot,
        User,
        CopyTrading
    }

    public enum Timeframe
    {
        /// <summary>
        /// 5m
        /// </summary>
        FiveMinutes,

        /// <summary>
        /// 15m
        /// </summary>
        FifteenMinutes,

        /// <summary>
        /// 30m
        /// </summary>
        ThirtyMinutes,

        /// <summary>
        /// 1h
        /// </summary>
        OneHour,

        /// <summary>
        /// 4h
        /// </summary>
        FourHour,

        /// <summary>
        /// 1d
        /// </summary>
        OneDay,
        OneMinute
    }

    public enum Ticker
    {
        AAVE,
        ADA,
        APE,
        ALGO,
        ARB,
        ATOM,
        AVAX,
        BNB,
        BTC,
        BAL,
        CHZ,
        COMP,
        CRO,
        CRV,
        DOGE,
        DOT,
        DYDX,
        ENS,
        ETC,
        ETH,
        FIL,
        FLM,
        FTM,
        GALA,
        GMX,
        GRT,
        IMX,
        JASMY,
        KSM,
        LDO,
        LINK,
        LRC,
        LTC,
        MANA,
        MATIC,
        MKR,
        NEAR,
        OP,
        PEPE,
        QTUM,
        REN,
        ROSE,
        RSR,
        RUNE,
        SAND,
        SOL,
        SRM,
        SUSHI,
        THETA,
        UNI,
        USDC,
        USDT,
        WIF,
        XMR,
        XRP,
        XTZ,
        SHIB,
        STX,
        ORDI,
        APT,
        BOME,
        MEME,
        FLOKI,
        MEW,
        TAO,
        BONK,
        WLD,
        tBTC,
        WBTC_b,
        EIGEN,
        SUI,
        SEI,
        USDC_e,
        DAI,
        TIA,
        TRX,
        TON,
        PENDLE,
        wstETH,
        USDe,
        SATS,
        POL,
        XLM,
        BCH,
        ICP,
        RENDER,
        INJ,
        TRUMP,
        MELANIA,
        ENA,
        FARTCOIN,
        AI16Z,
        ANIME,
        BERA,
        VIRTUAL,
        PENGU,
        ONDO,
        FET,
        AIXBT,
        CAKE,
        S,
        JUP,
        HYPE,
        OM,
        DOLO,
        Unknown
    }

    public enum WorkerType
    {
        PriceOneMinute,
        PriceFiveMinutes,
        PriceFifteenMinutes,
        PriceThirtyMinutes,
        PriceOneHour,
        PriceFourHour,
        PriceOneDay,
        TopVolumeTicker,
        PositionManager,
        Spotlight,
        Fee,
        PositionFetcher,
        TraderWatcher,
        LeaderboardWorker,
        Noobiesboard,
        BotManager,
        FundingRatesWatcher,
        BalanceTracking,
        GeneticAlgorithm,
        BundleBacktest,
        NotifyBundleBacktest
    }

    public enum WorkflowUsage
    {
        Trading,
        Task
    }

    public enum FlowType
    {
        RsiDivergence,
        FeedTicker,
        OpenPosition
    }

    public enum FlowOutput
    {
        Signal,
        Candles,
        Position,
        MoneyManagement
    }

    /// <summary>
    /// Risk tolerance levels for trading strategies
    /// </summary>
    public enum RiskToleranceLevel
    {
        Conservative = 1,
        Moderate = 2,
        Aggressive = 3
    }

    /// <summary>
    /// Selection methods for genetic algorithm optimization
    /// </summary>
    public enum GeneticSelectionMethod
    {
        Elite,
        Roulette,
        StochasticUniversalSampling,
        Tournament,
        Truncation
    }

    /// <summary>
    /// Crossover methods for genetic algorithm optimization
    /// </summary>
    public enum GeneticCrossoverMethod
    {
        AlternatingPosition,
        CutAndSplice,
        Cycle,
        OnePoint,
        OrderBased,
        Ordered,
        PartiallyMapped,
        PositionBased,
        ThreeParent,
        TwoPoint,
        Uniform,
        VotingRecombination
    }

    /// <summary>
    /// Mutation methods for genetic algorithm optimization
    /// </summary>
    public enum GeneticMutationMethod
    {
        Displacement,
        FlipBit,
        Insertion,
        PartialShuffle,
        ReverseSequence,
        Twors,
        Uniform
    }

    /// <summary>
    /// Agent status for indicating if an agent is active or not
    /// </summary>
    public enum AgentStatus
    {
        Offline,
        Online
    }

    /// <summary>
    /// Fields that can be used for sorting in data queries
    /// </summary>
    public enum SortableFields
    {
        TotalPnL,
        TotalROI,
        Wins,
        Losses,
        AgentName,
        CreatedAt,
        UpdatedAt
    }
}