"""
Prompt templates for Claude AI decision-making
"""


class PromptTemplates:
    """
    Collection of prompt templates for Claude AI interactions

    These templates are used to structure requests to Claude for performance
    analysis, issue identification, and improvement plan generation.
    """

    PERFORMANCE_ANALYSIS = """
You are a professional quantitative trading strategy analyst. Please analyze the following strategy performance data:

Strategy Configuration:
{strategy_config}

Performance Metrics:
- Total Trades: {total_trades}
- Win Rate: {win_rate}%
- Profit Factor: {profit_factor}
- Maximum Drawdown: {max_drawdown}%
- Sharpe Ratio: {sharpe_ratio}

Trade History (last 10 trades):
{trade_history}

Please provide:
1. Overall rating (excellent/good/poor/critical)
2. Strategy strengths (at least 3 points)
3. Strategy weaknesses (at least 3 points)
4. Key metrics analysis
5. Trend analysis

Return the analysis in JSON format with the following structure:
{{
    "overall_rating": "excellent|good|poor|critical",
    "strengths": ["strength1", "strength2", "strength3"],
    "weaknesses": ["weakness1", "weakness2", "weakness3"],
    "key_metrics": {{
        "metric_name": value
    }},
    "trend_analysis": "detailed trend analysis text",
    "confidence": 0.0-1.0
}}
"""

    ISSUE_IDENTIFICATION = """
Based on the following performance analysis, identify issues with the strategy:

{performance_analysis}

Please identify:
1. Issue severity (critical/high/medium/low)
2. Issue category (risk/performance/logic/parameter)
3. Issue description
4. Affected components
5. Suggested fix
6. Priority (1-10)

Return the issues as a JSON array with the following structure:
[
    {{
        "severity": "critical|high|medium|low",
        "category": "risk|performance|logic|parameter",
        "description": "detailed issue description",
        "affected_components": ["component1", "component2"],
        "suggested_fix": "suggested fix description",
        "priority": 1-10
    }}
]

If no significant issues are found, return an empty array [].
"""

    IMPROVEMENT_PLAN = """
Based on the following issue list, create a strategy improvement plan:

Issues:
{issues}

Current Strategy Configuration:
{current_strategy}

Please create an improvement plan including:
1. Files and components to modify
2. Modification type (parameter/logic/structure)
3. Current value and new value
4. Modification description and rationale
5. Expected impact (on each metric)
6. Risk level (low/medium/high)
7. Whether human review is required

Return the improvement plan in JSON format with the following structure:
{{
    "modifications": [
        {{
            "file_path": "path/to/file.py",
            "modification_type": "parameter|logic|structure",
            "target_component": "component_name",
            "current_value": "current value or code",
            "new_value": "new value or code",
            "description": "modification description"
        }}
    ],
    "expected_impact": {{
        "sharpe_ratio": 0.1,
        "win_rate": 0.05,
        "profit_factor": 0.2,
        "max_drawdown": -0.03
    }},
    "risk_level": "low|medium|high",
    "requires_review": true|false,
    "rationale": "detailed rationale for the improvement plan"
}}

Guidelines:
- For parameter modifications, specify exact parameter names and values
- For logic modifications, provide clear descriptions of the changes
- For structure modifications, explain the architectural changes
- Set requires_review to true for high-risk modifications
- Provide realistic expected impact values (can be positive or negative)
- Consider the trade-offs between different metrics
"""
