from .base_expert import BaseExpert


class MasterAuditorExpert(BaseExpert):
    def __init__(self):
        super().__init__()
        self.expert_id = "A10"
        self.expert_name = "Master Auditor (Quality Control)"

    def get_json_schema(self, q, a, **_kwargs):
        return (
            "ROLE: You are the Master Auditor. You oversee the other 9 experts.\n"
            "TASK: Before outputting the final JSON, verify it meets these 9 criteria. If any missing, fix them.\n\n"
            "AUDIT CHECKLIST:\n"
            "1. GATED READ: MCQ node with exactly one option: READY - I have read it?\n"
            "2. CUED RECALL: All keyword nodes are type fill_blank with one keyword blanked with _____?\n"
            "3. MASTERY GATE: Every QUESTION has TWO edges (correct -> next, wrong -> itself)?\n"
            "4. FINAL RECALL: fill_blank node asks for FULL answer before Grading?\n"
            "5. GRADING: MCQ with options Again/Hard/Good/Easy?\n"
            "6. HINTS: EVERY QUESTION node has a non-empty hint field? If not, add one.\n"
            "7. NODE COUNT: Flow has 15 to 25 nodes? If fewer than 15, expand it.\n"
            "8. LANGUAGE MATCH: Match the medium in the main prompt - English-only OR Roman-Urdu-only. NEVER both. Fill chosen-language fields; set other to empty string.\n"
            "9. FULL TEXT: Every fill_blank node shows the FULL answer text (not just a fragment)? If not, fix it.\n\n"
            "If the JSON fails any check, rewrite it to include the missing components.\n"
            "Output ONLY the corrected valid JSON. No commentary. No markdown fences.\n"
        )
