"""Trades Analysis Module.

This module provides hierarchical analysis and visualization tools for trades data.

Workflow:
    1. Create analyzer from BatchResults
    2. Explore available options (strategies, blueprints, periods)
    3. Build scope (select data range)
    4. Run analysis (performance, plots, 5-step workflow)

Example:
    >>> # From BatchResults
    >>> analyzer = batch.analyzer()
    >>>
    >>> # Explore options
    >>> blueprints = analyzer.available_blueprints()
    >>> blueprints.to_dataframe()
    >>>
    >>> # Build scope
    >>> scope = analyzer.build_scope(blueprints.options[0])
    >>>
    >>> # View scope summary (Jupyter)
    >>> scope
    >>>
    >>> # Performance metrics
    >>> scope.performance()
    >>>
    >>> # Visualizations
    >>> scope.plot_scatter(x="mae", y="mfe")
    >>> scope.plot_equity()
    >>> scope.plot_box(group_by="exit_reason")
    >>> scope.plot_distribution("pnl")
    >>>
    >>> # 5-Step MAE/MFE Workflow
    >>> scope.volatility_stability()    # A: 波動穩定性
    >>> scope.entry_timing()            # B: 進場時機
    >>> scope.exit_placement()          # C: 停損停利
    >>> scope.trailing_breakeven()      # D: 追蹤停損
    >>> scope.position_sizing()         # E: 加減碼
    >>> scope.full_workflow().dashboard()  # Complete A-E
"""

from .analyzer import (
    TradesAnalyzer,
    calculate_performance,
)
from .intent import (
    FullWorkflowReport,
    IntentReport,
    StepInsight,
)
from .scope import (
    AvailableOptions,
    OptionSummary,
    ScopeConfig,
    ScopeResult,
)
from .types import (
    ENTRY_REASON_LABELS,
    EXIT_REASON_LABELS,
    AnalysisScope,
    AxisExpr,
    ColorBy,
    PeriodType,
)

__all__ = [
    # Main class
    "TradesAnalyzer",
    # Scope
    "ScopeResult",
    "ScopeConfig",
    "AvailableOptions",
    "OptionSummary",
    # Intent types
    "IntentReport",
    "FullWorkflowReport",
    "StepInsight",
    # Performance
    "calculate_performance",
    # Type definitions
    "AnalysisScope",
    "AxisExpr",
    "ColorBy",
    "PeriodType",
    # Labels
    "EXIT_REASON_LABELS",
    "ENTRY_REASON_LABELS",
]
