{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "C 연습실 문제 파일 v1",
  "oneOf": [
    {
      "$ref": "#/$defs/problem"
    },
    {
      "type": "array",
      "minItems": 1,
      "maxItems": 200,
      "items": {
        "$ref": "#/$defs/problem"
      }
    }
  ],
  "$defs": {
    "problem": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "schemaVersion",
        "id",
        "title",
        "difficulty",
        "description",
        "input",
        "output",
        "starterCode",
        "tags",
        "constraints",
        "examples",
        "tests",
        "timeLimitMs",
        "comparison"
      ],
      "properties": {
        "schemaVersion": {
          "const": 1
        },
        "id": {
          "type": "string",
          "pattern": "^c-[a-z0-9-]{1,50}$"
        },
        "title": {
          "type": "string",
          "minLength": 1,
          "maxLength": 30000
        },
        "difficulty": {
          "type": "string",
          "minLength": 1,
          "maxLength": 30000
        },
        "description": {
          "type": "string",
          "minLength": 1,
          "maxLength": 30000
        },
        "input": {
          "type": "string",
          "minLength": 1,
          "maxLength": 30000
        },
        "output": {
          "type": "string",
          "minLength": 1,
          "maxLength": 30000
        },
        "starterCode": {
          "type": "string",
          "minLength": 1,
          "maxLength": 30000
        },
        "tags": {
          "type": "array",
          "maxItems": 30,
          "items": {
            "type": "string",
            "maxLength": 2000
          }
        },
        "constraints": {
          "type": "array",
          "maxItems": 30,
          "items": {
            "type": "string",
            "maxLength": 2000
          }
        },
        "examples": {
          "type": "array",
          "minItems": 1,
          "maxItems": 10,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "input",
              "output"
            ],
            "properties": {
              "input": {
                "type": "string",
                "maxLength": 65536
              },
              "output": {
                "type": "string",
                "maxLength": 65536
              },
              "explanation": {
                "type": "string",
                "maxLength": 30000
              }
            }
          }
        },
        "tests": {
          "type": "array",
          "minItems": 1,
          "maxItems": 100,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "input",
              "output",
              "points"
            ],
            "properties": {
              "input": {
                "type": "string",
                "maxLength": 65536
              },
              "output": {
                "type": "string",
                "maxLength": 65536
              },
              "points": {
                "type": "integer",
                "minimum": 1,
                "maximum": 100
              }
            }
          },
          "description": "points 합계는 반드시 100. 앱 검증기가 합계도 검증합니다."
        },
        "timeLimitMs": {
          "type": "integer",
          "minimum": 100,
          "maximum": 5000
        },
        "comparison": {
          "enum": [
            "tokens",
            "exact"
          ]
        },
        "source": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "document": {
              "type": "string",
              "maxLength": 2000
            },
            "pages": {
              "type": "string",
              "maxLength": 2000
            },
            "note": {
              "type": "string",
              "maxLength": 2000
            }
          }
        }
      }
    }
  }
}