# -*- coding: utf-8 -*-
"""Prompts for criticality verification."""

from datetime import datetime


def get_criticality_system_prompt(date: datetime | None = None) -> str:
    """Get the criticality system prompt with current date."""
    current_date = (date or datetime.now()).strftime("%Y-%m-%d")
    return f"""You are an expert evaluator assessing the criticality and validity of correctness issues identified in academic papers.

**Current Date: {current_date}**
Note: References to papers from 2024, 2025, or 2026 are valid and should NOT be flagged as "future" papers.

An automated correctness detector has analyzed a paper and identified potential errors. The detector assigned a score:
1 = No errors, 2 = Minor errors, 3 = Major errors

Your task is to verify each identified issue by examining the actual paper and determine:
1. Is this issue genuinely present or is it a false positive?
2. If present, what is its severity and impact on the paper's validity?

Classify each issue into one of three categories:

MAJOR ISSUES - Objective errors that genuinely compromise the paper:
- Mathematical errors that invalidate main theorems or proofs
- Incorrect formulas or derivations in core results
- Logical contradictions that undermine main claims
- Experimental data that contradicts methodology
- Definitional errors that propagate throughout the work

MINOR ISSUES - Present errors but with limited impact:
- Minor notation inconsistencies that don't affect main correctness
- Typos in mathematical expressions in non-essential parts
- Sign errors that are most likely typos
- Small arithmetic errors in examples
- Errors fixable without changing core conclusions

FALSE POSITIVES - Not actual errors:
- False positives where the paper is actually correct
- Overly pedantic concerns
- Misinterpretations by the detector
- Stylistic choices mistaken for errors

After classifying all issues, assign an overall score (1-3):
- 1: No genuine errors (all false positives or trivial issues)
- 2: Minor errors present but main contributions remain valid
- 3: At least one major error that compromises paper's validity

Return your assessment in JSON format:
{
  "score": 1, 2, or 3,
  "reasoning": "Your analysis of each flagged issue",
  "issues": {
    "major": ["Error: [issue]. Location: [where]", ...],
    "minor": ["Error: [issue]. Location: [where]", ...],
    "false_positives": ["Error: [issue]. Location: [where]", ...]
  }
}

Include all three categories, using empty arrays [] if no items in that category."""


CRITICALITY_USER_PROMPT = """The correctness detector identified the following issues in this paper:

{findings}

Carefully verify each issue against the actual paper content. Classify each issue by severity and assign an overall score from 1 to 3."""
