# -*- coding: utf-8 -*-
from pydantic import BaseModel, Field


WORKER_PROGRESS_SUMMARY = (
    "## Instruction\n"
    "Review the execution trace above and generate a comprehensive summary "
    "report in Markdown format that addresses the original task/query. "
    "Your report must include:\n\n"
    "1. **Task Overview**\n"
    "   - Include the original query/task verbatim;\n"
    "   - Briefly state the main objective.\n"
    "2. **Comprehensive Analysis**"
    "   - Provide a detailed, structured answer to the original query/task;\n"
    "   - Include all relevant information requested in the original task;\n"
    "   - Support your findings with specific references from your execution "
    "trace;\n"
    "   - Organize content into logical sections with appropriate headings;\n"
    "   - Include data visualizations, tables, or formatted lists when "
    "applicable.\n\n"
    "3. **Completion Checklist**\n"
    "   - Reproduce the original 'Expected Output' checklist of required "
    "tasks/information; **NEVER** makeup additional expected output items "
    "in the checklist\n"
    "   - Mark each item as [x] Completed or [ ] Incomplete;\n"
    "   - For each completed item, reference where in your report this "
    "information appears;\n"
    "   - For incomplete items, explain briefly why they remain unaddressed;\n"
    "4. **Conclusion**\n"
    "   - If the task is fully complete, provide a brief conclusion "
    "summarizing key findings;\n"
    "   - If the task remains incomplete, outline a specific plan to "
    "address remaining items, including:\n"
    "     - Which tools would be used;\n"
    "     - What information is still needed;\n"
    "     - Sequence of planned actions.\n\n"
    "Format your report professionally with consistent heading levels, "
    "proper spacing, and appropriate emphasis for key information."
)


WORKER_NEXT_STEP_INSTRUCTION = """
If the subtask remains incomplete, outline a specific plan to address remaining
items, including:
     - Which tools would be used
     - What information is still needed
     - Sequence of planned actions
Leave it as an empty string is the subtask has been done successfully.
"""

WORKER_FILE_COLLECTION_INSTRUCTION = (
    "Collect all files generated in the execution process, "
    "such as the files generated by `write_file` and `edit_file`."
    "This field MUST be in dictionary, where"
    "the keys are the paths of generated files "
    "(e.g. '/FULL/PATH/OF/FILE_1.md') and the values are short "
    "descriptions about the generated files."
)


class WorkerResponse(BaseModel):
    """
    Represents the response structure from a worker agent after task execution.

    This class defines the expected format for worker responses, including
    progress summaries, next steps, tool usage information, and task
    completion status.

    Attributes:
        subtask_progress_summary (str):
            Comprehensive summary report of task execution.
        generated_files (dict):
            Dictionary mapping file paths to descriptions of generated files.
        task_done (bool):
            Flag indicating whether the task has been completed.
    """

    subtask_progress_summary: str = Field(
        ...,
        description=WORKER_PROGRESS_SUMMARY,
    )
    generated_files: dict = Field(
        ...,
        description=WORKER_FILE_COLLECTION_INSTRUCTION,
    )
    task_done: bool = Field(
        ...,
        description="Whether task is done or it require addition effort",
    )
