"""
Trading Plan Templates
Comprehensive trading plan generators for different schools and scenarios
"""

from typing import Dict, List, Any, Optional
from datetime import datetime, date
from enum import Enum
from .trading_schools import TradingSchool


class PlanType(str, Enum):
    """Types of trading plans"""
    INTRADAY = "intraday"  # Day trading
    SWING = "swing"  # Multi-day holds
    POSITION = "position"  # Weeks to months
    SCALPING = "scalping"  # Quick in/out
    EVENT_DRIVEN = "event_driven"  # News/economic events
    RANGE_BOUND = "range_bound"  # Sideways markets
    BREAKOUT = "breakout"  # Breakout strategies
    REVERSAL = "reversal"  # Reversal trading
    TREND_FOLLOWING = "trend_following"  # Trend continuation


class MarketCondition(str, Enum):
    """Market conditions"""
    TRENDING_UP = "trending_up"
    TRENDING_DOWN = "trending_down"
    RANGING = "ranging"
    VOLATILE = "volatile"
    QUIET = "quiet"
    BREAKOUT_PENDING = "breakout_pending"
    POST_NEWS = "post_news"


class PlanTemplates:
    """Generate trading plans based on methodology and conditions"""

    @staticmethod
    def generate_ict_smc_plan(
        current_price: float,
        market_condition: MarketCondition,
        session: str = "london_ny"
    ) -> Dict[str, Any]:
        """Generate ICT/Smart Money Concepts trading plan"""

        # Adaptive targets based on price
        atr_estimate = current_price * 0.015  # ~1.5% for gold

        if session == "london":
            killzone_start = "03:00 EST"
            killzone_end = "05:00 EST"
        elif session == "ny":
            killzone_start = "08:00 EST"
            killzone_end = "11:00 EST"
        else:
            killzone_start = "08:00 EST"
            killzone_end = "11:00 EST"

        return {
            "plan_type": PlanType.INTRADAY,
            "methodology": "ICT / Smart Money Concepts",
            "session_focus": session.upper(),
            "killzone": f"{killzone_start} - {killzone_end}",
            "analysis_framework": [
                "1. MARKET STRUCTURE ANALYSIS",
                "   □ Identify current trend (HH/HL for bullish, LH/LL for bearish)",
                "   □ Mark last BOS (Break of Structure) or ChoCh (Change of Character)",
                "   □ Determine market state: Trending vs Ranging",
                "",
                "2. KEY LEVEL IDENTIFICATION",
                "   □ Mark all Fair Value Gaps (FVG/Imbalance)",
                "   □ Identify Order Blocks (last down candle before up move, vice versa)",
                "   □ Note liquidity pools (equal highs/lows, stop hunts)",
                "   □ Draw Premium/Discount zones (50% of range)",
                "",
                "3. ENTRY STRATEGY",
                "   □ Wait for liquidity sweep (stop hunt)",
                "   □ Price retraces to FVG or Order Block",
                "   □ Optimal Trade Entry: 0.618-0.79 Fibonacci of last leg",
                "   □ Enter during killzone for best probability",
                "   □ Look for displacement after entry (strong move)",
                "",
                "4. RISK MANAGEMENT",
                "   □ Stop loss: 5-10 points beyond Order Block",
                f"   □ Position size: Based on ${atr_estimate:.2f} ATR",
                "   □ First target: Next FVG or liquidity",
                "   □ Final target: Opposite side liquidity or major structure",
                "   □ Move stop to break-even after 1:1 RR"
            ],
            "entry_checklist": [
                "✓ Market structure identified (bullish/bearish)",
                "✓ BOS or ChoCh confirmed",
                "✓ FVG or Order Block located",
                "✓ Waiting for retracement to OTE (0.618-0.79)",
                "✓ Entry during killzone hours",
                "✓ Clear invalidation point defined"
            ],
            "trade_scenarios": {
                "bullish_setup": {
                    "prerequisites": [
                        "Price creates higher high (BOS)",
                        "Retracement to bullish FVG or Order Block",
                        "Entry at 0.618-0.79 Fib of last bullish leg"
                    ],
                    "entry": f"${current_price - (atr_estimate * 0.7):.2f} (at OB/FVG)",
                    "stop_loss": f"${current_price - (atr_estimate * 1.2):.2f} (below OB)",
                    "target_1": f"${current_price + (atr_estimate * 0.8):.2f} (FVG fill)",
                    "target_2": f"${current_price + (atr_estimate * 1.5):.2f} (liquidity)",
                    "rr_ratio": "1:3"
                },
                "bearish_setup": {
                    "prerequisites": [
                        "Price creates lower low (BOS)",
                        "Retracement to bearish FVG or Order Block",
                        "Entry at 0.618-0.79 Fib of last bearish leg"
                    ],
                    "entry": f"${current_price + (atr_estimate * 0.7):.2f} (at OB/FVG)",
                    "stop_loss": f"${current_price + (atr_estimate * 1.2):.2f} (above OB)",
                    "target_1": f"${current_price - (atr_estimate * 0.8):.2f} (FVG fill)",
                    "target_2": f"${current_price - (atr_estimate * 1.5):.2f} (liquidity)",
                    "rr_ratio": "1:3"
                }
            },
            "max_trades": 2,
            "max_daily_loss": 250,
            "notes": [
                "⚠️ CRITICAL RULES:",
                "• Only trade during killzone hours (highest probability)",
                "• Must have clear FVG or Order Block - no guessing",
                "• Wait for displacement (strong candle) for confirmation",
                "• Avoid trading during major news releases",
                "• If stopped out twice, done for the session",
                "",
                "📊 MARKET MAKER MODEL:",
                "1. Accumulation: Quiet consolidation, FVG formation",
                "2. Manipulation: Liquidity sweep (stop hunt) against trend",
                "3. Distribution: True move in intended direction",
                "",
                "🎯 OPTIMAL TRADE ENTRY (OTE):",
                "• 0.618 Fib: Conservative entry",
                "• 0.705 Fib: Sweet spot",
                "• 0.79 Fib: Aggressive entry (higher risk)",
                "",
                "💡 PRO TIPS:",
                "• London session: Watch for Judas swing (false move)",
                "• NY session: Strongest moves, follow London direction",
                "• Avoid Asian session: Low liquidity, choppy",
                "• Best setups: Monday-Thursday (avoid Friday chop)"
            ]
        }

    @staticmethod
    def generate_wyckoff_plan(
        current_price: float,
        market_condition: MarketCondition
    ) -> Dict[str, Any]:
        """Generate Wyckoff Method trading plan"""

        range_size = current_price * 0.03  # 3% trading range estimate

        return {
            "plan_type": PlanType.SWING,
            "methodology": "Wyckoff Method",
            "analysis_framework": [
                "1. PHASE IDENTIFICATION",
                "   □ Accumulation (PS → SC → AR → ST → Spring → Test → SOS → LPS → BU)",
                "   □ Markup (Uptrend with re-accumulation phases)",
                "   □ Distribution (PSY → BC → AR → ST → UTAD → LPSY → SOW)",
                "   □ Markdown (Downtrend with re-distribution phases)",
                "",
                "2. VOLUME ANALYSIS",
                "   □ High volume on spring = institutional buying",
                "   □ Low volume on test = supply absorbed",
                "   □ High volume on UTAD = distribution warning",
                "   □ Effort vs Result: High volume + small range = absorption",
                "",
                "3. SCHEMATIC ANALYSIS",
                "   □ Preliminary Support (PS) - first sign of buying",
                "   □ Selling Climax (SC) - panic selling, widest spread",
                "   □ Automatic Rally (AR) - relief bounce",
                "   □ Secondary Test (ST) - tests SC low on lower volume",
                "   □ Spring - traps sellers, stops below support",
                "   □ Sign of Strength (SOS) - decisive move up",
                "   □ Last Point of Support (LPS) - final buy opportunity",
                "",
                "4. CAUSE & EFFECT",
                f"   □ Trading Range: ~${range_size:.2f}",
                f"   □ Measured Move: ~${range_size * 2:.2f}",
                "   □ Count: Accumulation time predicts markup distance"
            ],
            "entry_strategies": {
                "accumulation_phase": {
                    "entry_point": "After spring, on LPS (Last Point of Support)",
                    "confirmation": "Volume decrease on pullback, increase on SOS",
                    "entry_price": f"${current_price - (range_size * 0.3):.2f}",
                    "stop_loss": f"${current_price - (range_size * 0.6):.2f}",
                    "target": f"${current_price + (range_size * 1.5):.2f}",
                    "holding_period": "Days to weeks"
                },
                "distribution_phase": {
                    "entry_point": "After UTAD (Upthrust After Distribution)",
                    "confirmation": "High volume on weakness, low volume on strength",
                    "entry_price": f"${current_price + (range_size * 0.3):.2f}",
                    "stop_loss": f"${current_price + (range_size * 0.6):.2f}",
                    "target": f"${current_price - (range_size * 1.5):.2f}",
                    "holding_period": "Days to weeks"
                }
            },
            "volume_spread_analysis": [
                "VSA SIGNALS TO WATCH:",
                "• No Supply: Up bar, narrow spread, low volume = bullish",
                "• No Demand: Down bar, narrow spread, low volume = bearish",
                "• Stopping Volume: Down bar, wide spread, high volume = bottom",
                "• Climax: Wide spread, very high volume = exhaustion",
                "• Test: Down bar, narrow spread, low volume after climax = bullish",
                "• Weakness: Up bar, wide spread, low volume = top forming"
            ],
            "three_laws": [
                "1. LAW OF SUPPLY & DEMAND",
                "   • High demand, low supply = prices rise",
                "   • Low demand, high supply = prices fall",
                "",
                "2. LAW OF CAUSE & EFFECT",
                "   • Larger accumulation = larger markup",
                "   • Time in range predicts extent of move",
                "",
                "3. LAW OF EFFORT VS RESULT",
                "   • High volume (effort) should produce price change (result)",
                "   • Low volume (low effort) producing large moves = following smart money",
                "   • High volume with no price change = absorption (distribution or accumulation)"
            ],
            "max_trades": 1,  # Wyckoff is patient, fewer trades
            "max_daily_loss": 200,
            "notes": [
                "📚 WYCKOFF WISDOM:",
                "• \"Determine the trend and trade with it, not against it\"",
                "• \"Wait for the right moment, then strike with force\"",
                "• \"The market is controlled by the Composite Operator\"",
                "",
                "⏰ PATIENCE IS KEY:",
                "• Full Wyckoff cycle can take weeks or months",
                "• Don't rush - wait for clear phases",
                "• Best entries: After spring or after UTAD",
                "",
                "📊 CHART READING:",
                "• Use 4H and Daily charts for phase identification",
                "• Use 1H for entry timing",
                "• Volume is CRITICAL - without volume, it's not Wyckoff",
                "",
                "⚠️ WARNINGS:",
                "• Don't trade in middle of range (wait for edges)",
                "• Fake springs exist - wait for SOS confirmation",
                "• Not every range is Wyckoff - need volume characteristics"
            ]
        }

    @staticmethod
    def generate_multi_method_confluence_plan(
        current_price: float,
        market_condition: MarketCondition
    ) -> Dict[str, Any]:
        """Generate plan using multiple methodologies for maximum confluence"""

        atr = current_price * 0.015

        return {
            "plan_type": PlanType.SWING,
            "methodology": "Multi-Method Confluence (ICT + Fibonacci + S/D + Price Action)",
            "confluence_zones": [
                "ZONE IDENTIFICATION - ALL METHODS MUST ALIGN:",
                "",
                "1. SMART MONEY CONCEPTS:",
                "   □ Fair Value Gap (FVG) or Order Block identified",
                "   □ BOS or ChoCh confirmed",
                "   □ Within discount zone (below 50% of range for buys)",
                "",
                "2. FIBONACCI ANALYSIS:",
                "   □ 0.618 or 0.786 retracement level",
                "   □ Previous swing low to swing high measured",
                "   □ Fib level aligns with FVG/OB zone",
                "",
                "3. SUPPLY & DEMAND:",
                "   □ Fresh demand zone (for buys) or supply zone (for sells)",
                "   □ Rally-Base-Rally or Drop-Base-Drop pattern",
                "   □ Zone not tested more than once",
                "",
                "4. PRICE ACTION:",
                "   □ Support/Resistance level confirmed",
                "   □ Pin bar, engulfing, or inside bar at level",
                "   □ Structure break and retest",
                "",
                "✅ REQUIRED CONFLUENCE: Minimum 3 out of 4 methods confirming same zone"
            ],
            "setup_requirements": {
                "maximum_confluence": {
                    "description": "All 4 methods agree - highest probability",
                    "requirements": [
                        "FVG/Order Block present",
                        "0.618-0.786 Fibonacci level",
                        "Fresh S/D zone",
                        "Key S/R level + candlestick pattern"
                    ],
                    "example_entry": f"${current_price - (atr * 0.8):.2f}",
                    "example_stop": f"${current_price - (atr * 1.3):.2f}",
                    "example_target": f"${current_price + (atr * 2.5):.2f}",
                    "position_size": "Full size (2-3% risk)",
                    "win_rate": "70-80%",
                    "rr_ratio": "1:3 minimum"
                },
                "high_confluence": {
                    "description": "3 out of 4 methods agree",
                    "requirements": [
                        "Any 3 methods confirming same zone",
                        "Timeframe confluence (HTF + LTF alignment)"
                    ],
                    "position_size": "75% of full size",
                    "win_rate": "65-75%",
                    "rr_ratio": "1:2.5 minimum"
                },
                "moderate_confluence": {
                    "description": "2 out of 4 methods - avoid or very small size",
                    "recommendation": "Skip unless highly experienced",
                    "position_size": "25% if taken",
                    "win_rate": "55-65%"
                }
            },
            "step_by_step_process": [
                "STEP 1: MULTI-TIMEFRAME ANALYSIS",
                "□ Monthly/Weekly: Identify major trend and key levels",
                "□ Daily: Mark swing highs/lows, draw Fibonacci",
                "□ 4H: Identify S/D zones, FVGs, Order Blocks",
                "□ 1H: Wait for price to approach confluence zone",
                "□ 15M: Look for entry trigger (candlestick pattern)",
                "",
                "STEP 2: ZONE MARKING",
                "□ Mark all FVGs and Order Blocks (ICT)",
                "□ Draw Fibonacci from last major swing (0.382, 0.5, 0.618, 0.786)",
                "□ Identify fresh S/D zones (Supply/Demand)",
                "□ Mark key horizontal S/R levels (Price Action)",
                "□ Highlight zones where 3-4 methods overlap",
                "",
                "STEP 3: CONFLUENCE VERIFICATION",
                f"□ Price approaches confluence zone: ${current_price - atr:.2f} - ${current_price - (atr * 0.6):.2f}",
                "□ Verify zone freshness (not tested multiple times)",
                "□ Check session timing (prefer London/NY for gold)",
                "□ Assess market condition (avoid choppy, low volume periods)",
                "",
                "STEP 4: ENTRY TRIGGER",
                "□ Wait for price to enter confluence zone",
                "□ Look for rejection: Pin bar, engulfing pattern, or inside bar",
                "□ Can use limit order at zone OR wait for confirmation",
                "□ Entry preference: Confirmation candle (safer) vs limit (better RR)",
                "",
                "STEP 5: TRADE MANAGEMENT",
                "□ Stop loss: 5-10 points beyond zone (below/above all confluence factors)",
                "□ Target 1 (50%): Next FVG, S/D zone, or Fib extension (1.272)",
                "□ Target 2 (50%): Major structure, opposite liquidity, or Fib 1.618",
                "□ Trail stop: Use ATR-based trail or move to break-even after T1",
                "",
                "STEP 6: POST-TRADE REVIEW",
                "□ Did all methods confirm?",
                "□ What was win rate for this confluence setup?",
                "□ Note for future: Which method was strongest predictor?",
                "□ Journal: Screenshot setup and outcome"
            ],
            "example_bullish_trade": {
                "scenario": "Bullish confluence zone setup",
                "confluence_zone": f"${current_price - (atr * 0.9):.2f} - ${current_price - (atr * 0.7):.2f}",
                "methods_confirming": [
                    f"✓ Bullish FVG at ${current_price - (atr * 0.8):.2f}",
                    f"✓ 0.618 Fib retracement at ${current_price - (atr * 0.75):.2f}",
                    f"✓ Fresh demand zone from ${current_price - (atr * 0.9):.2f} to ${current_price - (atr * 0.7):.2f}",
                    f"✓ Daily support level at ${current_price - (atr * 0.8):.2f}"
                ],
                "entry": f"${current_price - (atr * 0.75):.2f} (limit order in zone OR on pin bar confirmation)",
                "stop_loss": f"${current_price - (atr * 1.3):.2f} (below all confluence factors)",
                "target_1": f"${current_price + (atr * 0.5):.2f} (next minor resistance/FVG)",
                "target_2": f"${current_price + (atr * 2.0):.2f} (major structure/opposite S/D zone)",
                "risk_reward": "1:3.5",
                "position_management": "Close 50% at T1, trail remaining 50% with ATR(14) * 1.5"
            },
            "max_trades": 2,
            "max_daily_loss": 300,
            "notes": [
                "🎯 CONFLUENCE TRADING RULES:",
                "• MINIMUM 3 methods must confirm same zone",
                "• More confluence = higher probability = larger position",
                "• Never force a trade - wait for perfect setup",
                "• These setups are rare (1-3 per week on gold) - be patient!",
                "",
                "⏰ TIMING:",
                "• Best during London/NY sessions (liquidity)",
                "• Avoid: Asian session, major news events, Friday afternoons",
                "• Prefer Monday-Thursday for best follow-through",
                "",
                "📊 EXPECTATION:",
                "• Win rate: 70-80% with proper confluence",
                "• Average RR: 1:3 to 1:5",
                "• Frequency: 1-3 high-quality setups per week",
                "• This is a QUALITY over quantity approach",
                "",
                "⚠️ DISCIPLINE CHECKLIST:",
                "• ❌ Don't trade without minimum 3-method confluence",
                "• ❌ Don't increase risk on 'gut feeling'",
                "• ❌ Don't chase price if it leaves the zone",
                "• ✅ Wait for price to return to confluence zone",
                "• ✅ Journal every setup (even if you don't take it)",
                "• ✅ Review weekly: Which confluences worked best?",
                "",
                "💎 PROFESSIONAL EDGE:",
                "• Institutions look for same confluences - you're trading WITH smart money",
                "• Multiple confirmations = reduced false signals",
                "• Patient traders win - this method rewards discipline",
                "• Track your confluence setups: Over time, you'll find your highest-probability patterns"
            ]
        }

    @staticmethod
    def generate_session_based_plan(
        current_price: float,
        target_session: str = "london_ny_overlap"
    ) -> Dict[str, Any]:
        """Generate session-specific trading plan for gold"""

        atr = current_price * 0.015

        sessions = {
            "asian": {
                "time": "6 PM - 3 AM EST",
                "characteristics": "Low volatility, range-bound, choppy",
                "strategy": "Range trading or avoid",
                "avg_range": f"${atr * 0.5:.2f} - ${atr * 0.8:.2f}"
            },
            "london": {
                "time": "3 AM - 12 PM EST",
                "characteristics": "High volatility, trend moves, breakouts",
                "strategy": "Breakout or trend continuation",
                "avg_range": f"${atr * 1.2:.2f} - ${atr * 1.8:.2f}",
                "killzone": "3 AM - 5 AM EST"
            },
            "ny": {
                "time": "8 AM - 5 PM EST",
                "characteristics": "Highest volatility, strong directional moves",
                "strategy": "Continuation of London or reversal",
                "avg_range": f"${atr * 1.5:.2f} - ${atr * 2.0:.2f}",
                "killzone": "8 AM - 11 AM EST"
            },
            "london_ny_overlap": {
                "time": "8 AM - 12 PM EST",
                "characteristics": "Maximum liquidity, most volume, best opportunities",
                "strategy": "All strategies valid, highest probability",
                "avg_range": f"${atr * 1.8:.2f} - ${atr * 2.5:.2f}"
            }
        }

        session_info = sessions.get(target_session, sessions["london_ny_overlap"])

        return {
            "plan_type": PlanType.INTRADAY,
            "methodology": f"{target_session.upper().replace('_', ' ')} Session Trading",
            "session_details": session_info,
            "daily_playbook": [
                "GOLD TRADING SESSION PLAYBOOK:",
                "",
                "🌏 ASIAN SESSION (6 PM - 3 AM EST):",
                "• Price action: Consolidation, range-bound",
                "• Volume: Lowest of the day",
                "• Strategy: Mark Asian range high/low for breakouts",
                "• Approach: Generally avoid or trade mean reversion in range",
                f"• Expected range: {sessions['asian']['avg_range']}",
                "",
                "🇬🇧 LONDON SESSION (3 AM - 12 PM EST):",
                "• Price action: Breakouts, trend establishment",
                "• Volume: High (60% of daily gold volume)",
                "• Strategy: Trade breakouts of Asian range",
                "• Killzone: 3-5 AM EST (highest probability)",
                f"• Expected range: {sessions['london']['avg_range']}",
                "• Watch for: Judas Swing (false move 3-4 AM, real move 5-8 AM)",
                "",
                "🇺🇸 NY SESSION (8 AM - 5 PM EST):",
                "• Price action: Continuation or reversal",
                "• Volume: Highest (overlap with London 8 AM-12 PM)",
                "• Strategy: Follow London direction or trade reversals",
                "• Killzone: 8-11 AM EST (absolute best time)",
                f"• Expected range: {sessions['ny']['avg_range']}",
                "• Watch for: US economic data releases (8:30 AM, 10 AM)",
                "",
                "🏆 LONDON/NY OVERLAP (8 AM - 12 PM EST):",
                "• Price action: Maximum movement, strong trends",
                "• Volume: Peak liquidity",
                "• Strategy: ALL strategies valid, focus here",
                f"• Expected range: {sessions['london_ny_overlap']['avg_range']}",
                "• This is THE WINDOW for gold day trading"
            ],
            "intraday_scenarios": {
                "scenario_1_breakout": {
                    "name": "Asian Range Breakout (Most Common)",
                    "setup": [
                        "1. Mark Asian session high and low (6 PM - 3 AM)",
                        f"2. Asian range: typically ${atr * 0.5:.2f} - ${atr * 0.8:.2f}",
                        "3. Wait for London open (3 AM EST)",
                        "4. Watch for breakout of range + close outside",
                        "5. Enter on retest of broken level OR on break candle"
                    ],
                    "entry_long": f"${current_price + (atr * 0.3):.2f} (break above Asian high)",
                    "stop_long": f"${current_price - (atr * 0.4):.2f} (below Asian low)",
                    "target_long": f"${current_price + (atr * 1.5):.2f} (1.5x Asian range)",
                    "timing": "3-5 AM EST (London killzone)"
                },
                "scenario_2_judas_swing": {
                    "name": "Judas Swing (ICT Concept)",
                    "setup": [
                        "1. London opens with move in one direction (3-4 AM)",
                        "2. Move is FALSE - designed to trap traders",
                        "3. Price reverses sharply (4-6 AM)",
                        "4. Real move happens opposite to initial direction",
                        "5. Enter on reversal confirmation"
                    ],
                    "example": "Gold breaks up at 3 AM → Reverses down 4 AM → Continues down rest of session",
                    "entry": "After reversal candle, when false high is broken back down",
                    "stop": "Above false high + buffer",
                    "target": f"${atr * 1.5:.2f} - ${atr * 2.0:.2f} move in true direction"
                },
                "scenario_3_continuation": {
                    "name": "NY Continuation (Follows London)",
                    "setup": [
                        "1. London session establishes clear direction",
                        "2. NY open (8 AM) continues same direction",
                        "3. Pullback to FVG or Order Block during overlap",
                        "4. Enter on continuation"
                    ],
                    "entry": f"${current_price:.2f} (at pullback zone)",
                    "stop": f"${current_price - (atr * 0.8):.2f} (beyond retracement)",
                    "target": f"${current_price + (atr * 1.5):.2f} (session extension)",
                    "timing": "8 AM - 11 AM EST"
                },
                "scenario_4_reversal": {
                    "name": "NY Reversal (Opposite London)",
                    "setup": [
                        "1. London session exhausts in one direction",
                        "2. Signs of exhaustion: Wicks, slowing momentum, volume decrease",
                        "3. NY open triggers reversal",
                        "4. Enter on confirmed reversal pattern"
                    ],
                    "entry": f"${current_price:.2f} (on reversal candle close)",
                    "stop": f"${current_price + (atr * 0.8):.2f} (beyond reversal level)",
                    "target": f"${current_price - (atr * 1.5):.2f} (back to Asian range or key level)",
                    "timing": "8 AM - 10 AM EST",
                    "note": "Less common than continuation, wait for strong confirmation"
                }
            },
            "time_based_rules": [
                "⏰ TIME-BASED TRADING RULES:",
                "",
                "DO NOT TRADE:",
                "• Before 3 AM EST (Asian session - too choppy)",
                "• After 12 PM EST (liquidity dries up, whipsaws increase)",
                "• During major US news releases (wait 15-30 min after)",
                "• Friday after 10 AM EST (early close, low volume)",
                "",
                "BEST TRADING WINDOWS:",
                "• 3-5 AM EST: London killzone (breakouts)",
                "• 8-11 AM EST: NY killzone (strongest moves)",
                "• 8-10 AM EST: Absolute prime time (London/NY overlap peak)",
                "",
                "VOLUME PROFILE:",
                "• 3-8 AM: Building volume, establishing direction",
                "• 8-11 AM: Peak volume, maximum movement",
                "• 11 AM-12 PM: Reduced volatility, range trading",
                "• After 12 PM: Avoid or tight ranges only"
            ],
            "daily_routine": [
                "📋 SESSION TRADER DAILY ROUTINE:",
                "",
                "2:30 AM EST - Pre-London Preparation:",
                "□ Review overnight news and economic calendar",
                "□ Mark Asian session high/low",
                "□ Identify key levels from previous day",
                "□ Check DXY, yields, and market correlations",
                "□ Plan: What will you do if price breaks up? Breaks down?",
                "",
                "3:00 AM EST - London Open:",
                "□ Watch for initial direction",
                "□ Is it breaking Asian range or staying within?",
                "□ Look for Judas Swing setup (false move)",
                "□ Mark any FVGs or Order Blocks forming",
                "",
                "7:30 AM EST - Pre-NY Prep:",
                "□ Assess London session direction (up/down/ranging)",
                "□ Check for US economic releases at 8:30 AM",
                "□ Identify: Will NY continue or reverse?",
                "□ Plan entry zones for both scenarios",
                "",
                "8:00 AM EST - NY Open (Prime Time):",
                "□ Execute plan based on setup",
                "□ Take trades ONLY if setup is perfect",
                "□ Maximum 2 trades during this window",
                "□ Focus on quality over quantity",
                "",
                "11:00 AM EST - Session Wind-Down:",
                "□ Close or protect any open positions",
                "□ Move stops to break-even minimum",
                "□ Avoid new entries after 11 AM",
                "",
                "12:00 PM EST - Day Complete:",
                "□ Close all positions or trail stops",
                "□ Journal trades and setups",
                "□ No more trading for the day - walk away",
                "□ Review: What worked? What didn't?"
            ],
            "max_trades": 3,
            "max_daily_loss": 250,
            "notes": [
                "🌟 SESSION TRADING WISDOM:",
                "",
                "• \"The best trades happen in the first 3 hours of London and NY sessions\"",
                "• \"Asian session is for planning, not trading (for most retail traders)\"",
                "• \"The Judas Swing is real - London often fakes a move before the real direction\"",
                "• \"When London and NY agree on direction, moves are powerful\"",
                "",
                "📊 STATISTICS (Approximate for Gold):",
                "• 60% of daily range happens during London session",
                "• 30% happens during NY session",
                "• 10% happens during Asian session",
                "• Highest probability trades: 8-10 AM EST (80%+ of best setups)",
                "",
                "⚠️ COMMON MISTAKES:",
                "• Trading too early (before 3 AM EST)",
                "• Trading too late (after 12 PM EST)",
                "• Not respecting the Judas Swing (getting trapped)",
                "• Overtrading during low-probability times",
                "• Ignoring session characteristics (trying to breakout trade in Asian session)",
                "",
                "💡 PRO TIPS:",
                "• Set alarms: 2:45 AM (London prep), 7:45 AM (NY prep)",
                "• Most profitable gold traders trade ONLY 8-11 AM EST",
                "• If you miss the killzones, skip the day (there's always tomorrow)",
                "• Friday: Close all positions by 10 AM EST, weekend risk not worth it"
            ]
        }

    @staticmethod
    def get_all_plan_types() -> Dict[str, str]:
        """Get all available plan types"""
        return {
            "ict_smc": "ICT / Smart Money Concepts",
            "wyckoff": "Wyckoff Method",
            "elliott_wave": "Elliott Wave Theory",
            "supply_demand": "Supply & Demand Zones",
            "fibonacci": "Fibonacci Trading",
            "multi_confluence": "Multi-Method Confluence",
            "session_trading": "London/NY Session Trading",
            "price_action": "Pure Price Action",
            "fundamental": "Fundamental Analysis",
            "scalping": "Scalping (1-5 min)",
            "swing": "Swing Trading (Days)",
            "position": "Position Trading (Weeks+)"
        }


# Global instance
plan_templates = PlanTemplates()
