#!/usr/bin/env python3
"""Generate core_listening_choose JSON for S10 听力选择 (ID: 1217310)
L1-S2-U17-L3 紧急拜访 - 聆听爷爷的来信
"""
import json

ID = "1217310"

# ============================================================
# taskData
# ============================================================
taskData = {
    "cType": "core_listening_choose",
    "cId": ID,
    "title": "听听爷爷的来信",
    "sceneDesc": "Wood家的爷爷奶奶寄来了一封信。Vicky想知道信里写了什么，快一起听一听吧！",
    "key": [{
        "desc": "",
        "keyList": [
            {"type": "default", "content": "grandfather", "desc": "n. 爷爷"},
            {"type": "default", "content": "grandmother", "desc": "n. 奶奶"},
            {"type": "default", "content": "visit", "desc": "v. 拜访"}
        ]
    }],
    "resourceMapping": {
        "Justin": 705,
        "Vicky": 658
    },
    "cDesc": (
        "You listened to Justin read the letter, and learned that the grandfather was writing to say "
        "he would come to visit. (你听了Justin读信，得知爷爷写信说他会来拜访。) "
        "You then heard that the grandmother would come to visit too, and that they loved the children very much. "
        "(你随后听到奶奶也会一起来拜访，他们很爱孩子们。)"
    )
}

# ============================================================
# questionGroup
# ============================================================
questionGroup = [
    {
        "preDialog": [],
        "dialogList": [
            {
                "type": "npc",
                "npcName": "Justin",
                "content": "Hi, your grandfather is writing this letter.",
                "trans": "嗨，你的爷爷正在写这封信。",
                "isPoint": False
            },
            {
                "type": "npc",
                "npcName": "Justin",
                "content": "I will come to visit you guys.",
                "trans": "我会来拜访你们。",
                "isPoint": True
            }
        ],
        "questionList": [{
            "type": "npc",
            "npcName": "Vicky",
            "content": "Who will come to visit?",
            "optionList": [
                {
                    "option": f"{ID}_option_00.png",
                    "feedback": {"type": "npc", "npcName": "Vicky", "content": "Yes! Grandfather is coming to visit us."}
                },
                {
                    "option": f"{ID}_option_01.png",
                    "feedback": {"type": "npc", "npcName": "Vicky", "content": "No. Listen again. Who said they will come?"}
                },
                {
                    "option": f"{ID}_option_02.png",
                    "feedback": {"type": "npc", "npcName": "Vicky", "content": "Hmm. Look at the letter. Who is coming?"}
                }
            ],
            "answer": [0]
        }],
        "postDialog": []
    },
    {
        "preDialog": [],
        "dialogList": [
            {
                "type": "npc",
                "npcName": "Justin",
                "content": "Your grandmother will visit you too!",
                "trans": "你的奶奶也会来拜访你们！",
                "isPoint": True
            },
            {
                "type": "npc",
                "npcName": "Justin",
                "content": "We love you, see you soon!",
                "trans": "我们爱你们，很快见！",
                "isPoint": False
            }
        ],
        "questionList": [{
            "type": "npc",
            "npcName": "Vicky",
            "content": "Who else is coming to visit?",
            "optionList": [
                {
                    "option": f"{ID}_option_03.png",
                    "feedback": {"type": "npc", "npcName": "Vicky", "content": "No. Listen carefully. Who else is in the letter?"}
                },
                {
                    "option": f"{ID}_option_04.png",
                    "feedback": {"type": "npc", "npcName": "Vicky", "content": "Hmm, I don't think so. Try again."}
                },
                {
                    "option": f"{ID}_option_05.png",
                    "feedback": {"type": "npc", "npcName": "Vicky", "content": "Yes! Grandmother will visit us too."}
                }
            ],
            "answer": [2]
        }],
        "postDialog": []
    }
]

# ============================================================
# kpInfo
# ============================================================
kpInfo = {
    "pushType": "relationKp",
    "cType": "core_listening_choose",
    "cId": ID,
    "kpInfo": [
        {
            "kpId": None,
            "kpType": "vocab",
            "kpTitle": "grandfather",
            "kpSkill": "vocab_meaning",
            "kpSkillName": "词义"
        },
        {
            "kpId": None,
            "kpType": "vocab",
            "kpTitle": "grandmother",
            "kpSkill": "vocab_meaning",
            "kpSkillName": "词义"
        },
        {
            "kpId": None,
            "kpType": "vocab",
            "kpTitle": "visit",
            "kpSkill": "vocab_meaning",
            "kpSkillName": "词义"
        }
    ]
}

# ============================================================
# learningData
# ============================================================
learningData = {
    "learningPart": [
        {
            "type": "npc",
            "npcName": "Brainy",
            "content": "I will come to visit you guys.",
            "learning": [
                {
                    "question": {
                        "content": "刚刚听到的音频中，包含了一个关键单词visit，意思为拜访。正确的发音是visit。",
                        "type": "npc",
                        "npcName": "Brainy"
                    },
                    "extendQuestion": {
                        "content": "仔细听，然后选出你听到的句子。",
                        "type": "npc",
                        "npcName": "Brainy"
                    },
                    "optionList": [
                        {
                            "option": "I will come to help you guys.",
                            "feedback": {
                                "type": "npc",
                                "npcName": "Brainy",
                                "content": "这句话里说的是help，而不是visit哦。再仔细听一听正确的选项吧！"
                            }
                        },
                        {
                            "option": "I will come to visit you guys.",
                            "feedback": {
                                "type": "npc",
                                "npcName": "Brainy",
                                "content": "太棒了！你准确地听出了句子中的重点单词visit！"
                            }
                        }
                    ],
                    "answer": [1]
                },
                {
                    "question": {
                        "content": "I will come to visit you guys.",
                        "type": "npc",
                        "npcName": "Brainy"
                    },
                    "extendQuestion": {
                        "content": "这句话的中文意思是“我会来拜访你们”，对吗？",
                        "type": "npc",
                        "npcName": "Brainy"
                    },
                    "optionList": [
                        {
                            "option": "对/Yes",
                            "feedback": {
                                "type": "npc",
                                "npcName": "Brainy",
                                "content": "完全正确！visit就是“拜访”的意思，你很好地掌握了这个单词！"
                            }
                        },
                        {
                            "option": "错/No",
                            "feedback": {
                                "type": "npc",
                                "npcName": "Brainy",
                                "content": "visit就是“拜访”的意思哦，再想想看，这个意思对吗？"
                            }
                        }
                    ],
                    "answer": [0]
                }
            ]
        },
        {
            "type": "npc",
            "npcName": "Brainy",
            "content": "Your grandmother will visit you too!",
            "learning": [
                {
                    "question": {
                        "content": "刚刚听到的音频中，包含了一个关键单词grandmother，意思为奶奶。正确的发音是grandmother。",
                        "type": "npc",
                        "npcName": "Brainy"
                    },
                    "extendQuestion": {
                        "content": "仔细听，然后选出你听到的句子。",
                        "type": "npc",
                        "npcName": "Brainy"
                    },
                    "optionList": [
                        {
                            "option": "Your grandmother will visit you too!",
                            "feedback": {
                                "type": "npc",
                                "npcName": "Brainy",
                                "content": "太棒了！你准确地听出了句子中的重点单词grandmother！"
                            }
                        },
                        {
                            "option": "Your grandfather will visit you too!",
                            "feedback": {
                                "type": "npc",
                                "npcName": "Brainy",
                                "content": "Oops，这句话说的是grandfather，而不是grandmother哦。再仔细听一听正确的选项吧！"
                            }
                        }
                    ],
                    "answer": [0]
                },
                {
                    "question": {
                        "content": "Your grandmother will visit you too!",
                        "type": "npc",
                        "npcName": "Brainy"
                    },
                    "extendQuestion": {
                        "content": "这句话的中文意思是“你的奶奶也会来拜访你们”，对吗？",
                        "type": "npc",
                        "npcName": "Brainy"
                    },
                    "optionList": [
                        {
                            "option": "对/Yes",
                            "feedback": {
                                "type": "npc",
                                "npcName": "Brainy",
                                "content": "Bingo！你不仅听懂了句子，还掌握了grandmother这个重点单词！"
                            }
                        },
                        {
                            "option": "错/No",
                            "feedback": {
                                "type": "npc",
                                "npcName": "Brainy",
                                "content": "grandmother就是“奶奶”的意思，再仔细想想这句话的意思对不对呢？"
                            }
                        }
                    ],
                    "answer": [0]
                }
            ]
        },
        {
            "type": "npc",
            "npcName": "Brainy",
            "content": "Hi, your grandfather is writing this letter.",
            "learning": [
                {
                    "question": {
                        "content": "刚刚听到的音频中，包含了一个关键单词grandfather，意思为爷爷。正确的发音是grandfather。",
                        "type": "npc",
                        "npcName": "Brainy"
                    },
                    "extendQuestion": {
                        "content": "仔细听，然后选出你听到的句子。",
                        "type": "npc",
                        "npcName": "Brainy"
                    },
                    "optionList": [
                        {
                            "option": "Hi, your grandfather is writing this letter.",
                            "feedback": {
                                "type": "npc",
                                "npcName": "Brainy",
                                "content": "太好了！你准确地听出了句子中的重点单词grandfather！"
                            }
                        },
                        {
                            "option": "Hi, your father is writing this letter.",
                            "feedback": {
                                "type": "npc",
                                "npcName": "Brainy",
                                "content": "这句话里说的是father，而不是grandfather哦。爷爷是grandfather！再仔细听听吧！"
                            }
                        }
                    ],
                    "answer": [0]
                },
                {
                    "question": {
                        "content": "Hi, your grandfather is writing this letter.",
                        "type": "npc",
                        "npcName": "Brainy"
                    },
                    "extendQuestion": {
                        "content": "这句话的中文意思是“嗨，你的爸爸在写这封信”，对吗？",
                        "type": "npc",
                        "npcName": "Brainy"
                    },
                    "optionList": [
                        {
                            "option": "对/Yes",
                            "feedback": {
                                "type": "npc",
                                "npcName": "Brainy",
                                "content": "不对哦，grandfather是“爷爷”的意思，不是“爸爸”哦。爸爸是father。"
                            }
                        },
                        {
                            "option": "错/No",
                            "feedback": {
                                "type": "npc",
                                "npcName": "Brainy",
                                "content": "没错！grandfather是“爷爷”，和father（爸爸）不一样，你分得很清楚！"
                            }
                        }
                    ],
                    "answer": [1]
                }
            ]
        }
    ],
    "closing": {
        "type": "npc",
        "npcName": "Brainy",
        "content": "很好！你已经回答完了全部问题，相信你已经听懂了这个任务中所有的重点句子。现在让我们来查看结果吧!"
    }
}

# ============================================================
# All fields for bitable insert
# ============================================================
fields = {
    "ID": ID,
    "dataStatus": "0",
    "kpInfo": json.dumps(kpInfo, ensure_ascii=False),
    "kpListSentence": [],
    "kpListVocab": [],
    "kpStatus": "0",
    "learningData": json.dumps(learningData, ensure_ascii=False),
    "questionGroup": json.dumps(questionGroup, ensure_ascii=False),
    "taskData": json.dumps(taskData, ensure_ascii=False),
    "互动描述": (
        "You listened to Justin read his letter and found out that the grandfather would come to visit the Wood children. "
        "(你听了Justin念信，得知爷爷会来拜访Wood家的孩子们。) "
        "You also heard that the grandmother would come to visit too, and that they loved the children very much. "
        "(你还听到奶奶也会一起来拜访，他们很爱孩子们。)"
    ),
    "关联知识点": "grandfather grandmother visit",
    "单元 Unit": "1217",
    "学习过程": "句子1 I will come to visit you guys.【visit】\n句子2 Your grandmother will visit you too!【grandmother】\n句子3 Hi, your grandfather is writing this letter.【grandfather】",
    "用户任务描述": "【任务标题】听听爷爷的来信\n【任务背景】Wood家的爷爷奶奶寄来了一封信。Vicky想知道信里写了什么，快一起听一听吧！",
    "用户任务知识": "grandfather n. 爷爷\ngrandmother n. 奶奶\nvisit v. 拜访",
    "角色配置": "Justin: 705 Vicky: 658",
    "教研配置-导览配置": (
        "【任务标题】听听爷爷的来信\n"
        "【任务背景】Wood家的爷爷奶奶寄来了一封信。Vicky想知道信里写了什么，快一起听一听吧！\n"
        "【通关知识】\n"
        "visit v. 拜访\n"
        "grandmother n. 奶奶\n"
        "grandfather n. 爷爷"
    ),
    "教研配置-互动配置": (
        "【题目组1】\n"
        "#开场语 无\n"
        "#听力文本\n"
        "Justin: Hi, your grandfather is writing this letter.\n"
        "Justin: I will come to visit you guys. (重点句)\n"
        "【题目1】\n"
        "题目类型：图片\n"
        "题目内容：\n"
        "Vicky: Who will come to visit?\n"
        f"A. {ID}_option_00.png 正确 Vicky: Yes! Grandfather is coming to visit us.\n"
        f"B. {ID}_option_01.png 错误 Vicky: No. Listen again. Who said they will come?\n"
        f"C. {ID}_option_02.png 错误 Vicky: Hmm. Look at the letter. Who is coming?\n"
        "#结束语 无\n\n"
        "【题目组2】\n"
        "#开场语 无\n"
        "#听力文本\n"
        "Justin: Your grandmother will visit you too! (重点句)\n"
        "Justin: We love you, see you soon!\n"
        "【题目2】\n"
        "题目类型：图片\n"
        "题目内容：\n"
        "Vicky: Who else is coming to visit?\n"
        f"A. {ID}_option_03.png 错误 Vicky: No. Listen carefully. Who else is in the letter?\n"
        f"B. {ID}_option_04.png 错误 Vicky: Hmm, I don't think so. Try again.\n"
        f"C. {ID}_option_05.png 正确 Vicky: Yes! Grandmother will visit us too.\n"
        "#结束语 无\n\n"
        "【学习过程】\n"
        "句子1 I will come to visit you guys.\n"
        "句子2 Your grandmother will visit you too!\n"
        "句子3 Hi, your grandfather is writing this letter."
    ),
    "学习过程配置": (
        "# 重点句子1\n"
        "音频文本：I will come to visit you guys.\n"
        "讲解文本：刚刚听到的音频中，包含了一个关键单词visit，意思为拜访。正确的发音是visit。\n"
        "1. 听音选句\n"
        "Brainy：仔细听，然后选出你听到的句子。\n"
        "- I will come to help you guys.\n"
        "  - Brainy：这句话里说的是help，而不是visit哦。再仔细听一听正确的选项吧！\n"
        "- I will come to visit you guys. [正确]\n"
        "  - Brainy：太棒了！你准确地听出了句子中的重点单词visit！\n"
        "2. 听音选意\n"
        "Brainy：这句话的中文意思是\"我会来拜访你们\"，对吗？\n"
        "- 对/Yes [正确]\n"
        "  - Brainy：完全正确！visit就是\"拜访\"的意思，你很好地掌握了这个单词！\n"
        "- 错/No\n"
        "  - Brainy：visit就是\"拜访\"的意思哦，再想想看，这个意思对吗？\n"
        "---\n"
        "# 重点句子2\n"
        "音频文本：Your grandmother will visit you too!\n"
        "讲解文本：刚刚听到的音频中，包含了一个关键单词grandmother，意思为奶奶。正确的发音是grandmother。\n"
        "1. 听音选句\n"
        "Brainy：仔细听，然后选出你听到的句子。\n"
        "- Your grandmother will visit you too! [正确]\n"
        "  - Brainy：太棒了！你准确地听出了句子中的重点单词grandmother！\n"
        "- Your grandfather will visit you too!\n"
        "  - Brainy：Oops，这句话说的是grandfather，而不是grandmother哦。再仔细听一听正确的选项吧！\n"
        "2. 听音选意\n"
        "Brainy：这句话的中文意思是\"你的奶奶也会来拜访你们\"，对吗？\n"
        "- 对/Yes [正确]\n"
        "  - Brainy：Bingo！你不仅听懂了句子，还掌握了grandmother这个重点单词！\n"
        "- 错/No\n"
        "  - Brainy：grandmother就是\"奶奶\"的意思，再仔细想想这句话的意思对不对呢？\n"
        "---\n"
        "# 重点句子3\n"
        "音频文本：Hi, your grandfather is writing this letter.\n"
        "讲解文本：刚刚听到的音频中，包含了一个关键单词grandfather，意思为爷爷。正确的发音是grandfather。\n"
        "1. 听音选句\n"
        "Brainy：仔细听，然后选出你听到的句子。\n"
        "- Hi, your grandfather is writing this letter. [正确]\n"
        "  - Brainy：太好了！你准确地听出了句子中的重点单词grandfather！\n"
        "- Hi, your father is writing this letter.\n"
        "  - Brainy：这句话里说的是father，而不是grandfather哦。爷爷是grandfather！再仔细听听吧！\n"
        "2. 听音选意\n"
        "Brainy：这句话的中文意思是\"嗨，你的爸爸在写这封信\"，对吗？\n"
        "- 对/Yes\n"
        "  - Brainy：不对哦，grandfather是\"爷爷\"的意思，不是\"爸爸\"哦。爸爸是father。\n"
        "- 错/No [正确]\n"
        "  - Brainy：没错！grandfather是\"爷爷\"，和father（爸爸）不一样，你分得很清楚！\n"
        "---\n"
        "# 完成反馈\n"
        "Brainy：很好！你已经回答完了全部问题，相信你已经听懂了这个任务中所有的重点句子。现在让我们来查看结果吧!"
    ),
    "题目组": (
        "【题目组1】\n"
        "#开场语 无\n"
        "#听力文本\n"
        "Justin: Hi, your grandfather is writing this letter.\n"
        "Justin: I will come to visit you guys. (重点句)\n"
        "【题目1】\n"
        "题目类型：图片\n"
        "题目内容：\n"
        "Vicky: Who will come to visit?\n"
        f"A. {ID}_option_00.png 正确 Vicky: Yes! Grandfather is coming to visit us.\n"
        f"B. {ID}_option_01.png 错误 Vicky: No. Listen again. Who said they will come?\n"
        f"C. {ID}_option_02.png 错误 Vicky: Hmm. Look at the letter. Who is coming?\n"
        "#结束语 无\n\n"
        "【题目组2】\n"
        "#开场语 无\n"
        "#听力文本\n"
        "Justin: Your grandmother will visit you too! (重点句)\n"
        "Justin: We love you, see you soon!\n"
        "【题目2】\n"
        "题目类型：图片\n"
        "题目内容：\n"
        "Vicky: Who else is coming to visit?\n"
        f"A. {ID}_option_03.png 错误 Vicky: No. Listen carefully. Who else is in the letter?\n"
        f"B. {ID}_option_04.png 错误 Vicky: Hmm, I don't think so. Try again.\n"
        f"C. {ID}_option_05.png 正确 Vicky: Yes! Grandmother will visit us too.\n"
        "#结束语 无"
    )
}

# ============================================================
# Output
# ============================================================
output = {
    "app_token": "C7e9bzA1GaZ61FsTz87cEM8Ynoe",
    "table_id": "tblH4xNpAmKJ7gEq",
    "fields": fields
}

print(json.dumps(output, ensure_ascii=False, indent=2))
