import json

__all__ = ["OnboardingPrompts"]

class OnboardingPrompts:

    @staticmethod
    def default_system_prompt():
        return ( 
            "You are a helpful onboarding assistant that helps new employees get onboarded to their new company." 
            "You may use relevant tools to assist you to provide the best support." 
        )
    
    @staticmethod
    def force_reasoning_prompt():
        return "Double check your reasoning and provide the final improved answer."

    @staticmethod
    def curriculum_generation_prompt():
        return (
            "Based on available documentation, create an onboarding curriculum for this role. "
            "Output ONLY a valid JSON array of 3-5 strings representing module titles. "
            "Example: [\"Introduction\", \"Safety\", \"Operations\"]"
        )

    @staticmethod
    def knowledge_generation_prompt(topic, context_markdown):
        return (
            f"Write a practical onboarding training guide for the topic '{topic}'. "
            "Think step-by-step internally before writing the final answer. "
            "Use the MCP search context below as your primary source, and call additional tools if needed. "
            "If no indexed documents are available, provide a concise best-practice overview and clearly say no indexed documents were found. "
            "Use Markdown formatting and do NOT include a table of contents in this section. "
            "Generate substantial depth: target 900-1400 words. "
            "Include these sections in order: Overview, Core Concepts, Role-Specific Workflow, Practical Examples, Common Pitfalls, and Action Checklist. "
            "In Practical Examples, provide at least 2 concrete examples relevant to this role/topic. "
            "In Action Checklist, provide at least 8 actionable checklist items.\n\n"
            f"Topic: {topic}\n"
            f"MCP search context:\n{context_markdown}"
        )

    @staticmethod
    def quiz_generation_prompt(question_count, module_briefs):
        return (
            "Create a final onboarding quiz that assesses all generated modules. "
            f"Output ONLY a valid JSON array of exactly {question_count} question objects. "
            "Use a mix of question types: at least 2 short-answer questions and at least 2 multiple-choice questions. "
            "For multiple-choice objects: field_type='select', options (4 unique strings), and validation.correct_option. "
            "For short-answer objects: field_type='textarea' (or 'text') and validation.accepted_answers (array of valid answers/keywords). "
            "Each object MUST include key, label, field_type, required=true, and validation.explanation. "
            "Cover all topics with balanced difficulty and avoid ambiguous wording.\n\n"
            f"Modules JSON:\n{json.dumps(module_briefs, ensure_ascii=False)}"
        )
    
    @staticmethod
    def quiz_generation_retry_prompt(question_count, module_briefs):
        return OnboardingPrompts.quiz_generation_prompt(question_count, module_briefs) + (
            "Return ONLY raw JSON. Do not use markdown fences. Do not include explanations outside JSON."
        )

    @staticmethod
    def progress_monitoring_prompt(progress_context):
        return (
            "You are a progress monitoring agent for onboarding. "
            "Analyze the role onboarding data below and provide concise feedback with:\n"
            "1) current status\n2) strengths\n3) gaps\n4) next actions\n"
            "Use prior learner question/answer evidence and any saved marking details when available. "
            "If evidence is insufficient, explicitly state what is missing.\n"
            "Keep it short and practical.\n\n"
            f"Progress context JSON:\n{json.dumps(progress_context)}"
        )