{
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "id",
    "title",
    "brief",
    "scene",
    "course"
  ],
  "properties": {
    "schema_version": {
      "const": 1
    },
    "id": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_.-]{1,96}$"
    },
    "title": {
      "type": "string",
      "minLength": 1
    },
    "brief": {
      "type": "string"
    },
    "scene": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "instances"
      ],
      "properties": {
        "instances": {
          "type": "array",
          "minItems": 1,
          "maxItems": 64,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "asset_id",
              "asset_version",
              "label",
              "position",
              "rotation_y"
            ],
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[A-Za-z0-9_.-]{1,96}$"
              },
              "asset_id": {
                "type": "string",
                "pattern": "^[A-Za-z0-9_.-]{1,96}$"
              },
              "asset_version": {
                "type": "string",
                "pattern": "^[A-Za-z0-9_.-]{1,96}$"
              },
              "label": {
                "type": "string",
                "minLength": 1
              },
              "position": {
                "type": "array",
                "prefixItems": [
                  {
                    "type": "number"
                  },
                  {
                    "const": 0
                  },
                  {
                    "type": "number"
                  }
                ],
                "items": false,
                "minItems": 3,
                "maxItems": 3
              },
              "rotation_y": {
                "type": "number",
                "description": "Y-axis rotation in degrees"
              }
            }
          }
        }
      }
    },
    "course": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "initial",
        "steps",
        "scoring"
      ],
      "properties": {
        "initial": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "instance",
              "state"
            ],
            "properties": {
              "instance": {
                "type": "string",
                "pattern": "^[A-Za-z0-9_.-]{1,96}$"
              },
              "state": {
                "type": "object",
                "additionalProperties": {
                  "type": [
                    "boolean",
                    "number",
                    "string"
                  ]
                }
              }
            }
          }
        },
        "steps": {
          "type": "array",
          "minItems": 1,
          "maxItems": 200,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "label",
              "instruction",
              "instance",
              "action",
              "points"
            ],
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[A-Za-z0-9_.-]{1,96}$"
              },
              "label": {
                "type": "string",
                "minLength": 1
              },
              "instruction": {
                "type": "string",
                "minLength": 1
              },
              "instance": {
                "type": "string",
                "pattern": "^[A-Za-z0-9_.-]{1,96}$"
              },
              "action": {
                "type": "string",
                "pattern": "^[A-Za-z0-9_.-]{1,96}$"
              },
              "points": {
                "type": "number",
                "exclusiveMinimum": 0,
                "maximum": 1000
              },
              "expect": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "state",
                    "eq"
                  ],
                  "properties": {
                    "state": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9_.-]{1,96}$"
                    },
                    "eq": {
                      "type": [
                        "boolean",
                        "number",
                        "string"
                      ]
                    }
                  }
                }
              },
              "reading": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "min",
                  "max"
                ],
                "properties": {
                  "min": {
                    "type": "number"
                  },
                  "max": {
                    "type": "number"
                  }
                }
              },
              "choices": {
                "type": "array",
                "minItems": 2,
                "uniqueItems": true,
                "items": {
                  "type": "string",
                  "pattern": "^[A-Za-z0-9_.-]{1,96}$"
                },
                "description": "Full trusted diagnosis/treatment choice_group; action is the unique correct option for the configured teaching situation. Never include effects or correctness rules in a plan."
              }
            }
          }
        },
        "scoring": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "wrong_action_penalty",
            "pass_score"
          ],
          "properties": {
            "wrong_action_penalty": {
              "type": "number",
              "minimum": 0,
              "maximum": 100
            },
            "pass_score": {
              "type": "number",
              "minimum": 0,
              "maximum": 100
            }
          }
        }
      }
    }
  },
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://myth.panxinmiao.com/power-course-studio/schema/plan.schema.json",
  "title": "Scene and course plan v1",
  "description": "Agent-authored plan. No behaviors, effects, script, model URLs or arbitrary code. Semantic validation checks immutable asset versions, instance uniqueness, typed states, rotated footprint overlap, action guards and full sequential reachability."
}
