{
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "$id": "https://silly-puppyy.github.io/pencilmark/schema/sudoku-grade-1.json",
 "title": "sudoku-grade format_version 1",
 "description": "pencilmark grade card (docs/formats/grade-card.md).",
 "type": "object",
 "required": [
  "format",
  "format_version",
  "grader"
 ],
 "additionalProperties": false,
 "properties": {
  "format": {
   "const": "sudoku-grade"
  },
  "format_version": {
   "const": 1
  },
  "grader": {
   "type": "object",
   "required": [
    "name",
    "version"
   ],
   "additionalProperties": false,
   "properties": {
    "name": {
     "type": "string"
    },
    "version": {
     "type": "string"
    }
   }
  },
  "difficulty": {
   "type": [
    "number",
    "null"
   ]
  },
  "time": {
   "type": [
    "number",
    "null"
   ]
  },
  "band": {
   "enum": [
    "Very Easy",
    "Easy",
    "Medium",
    "Hard",
    "Very Hard",
    "Expert",
    "Extreme",
    "Unknown"
   ]
  },
  "band_index": {
   "type": [
    "integer",
    "null"
   ],
   "minimum": 0,
   "maximum": 6
  },
  "contains": {
   "type": "array",
   "items": {
    "type": "object",
    "required": [
     "code",
     "chip",
     "name",
     "band"
    ],
    "additionalProperties": false,
    "properties": {
     "code": {
      "type": "string"
     },
     "chip": {
      "type": "string"
     },
     "name": {
      "type": "string"
     },
     "band": {
      "type": "integer",
      "minimum": 0,
      "maximum": 6
     },
     "uses": {
      "type": "integer",
      "minimum": 1
     },
     "alternatives": {
      "type": [
       "array",
       "null"
      ],
      "items": {
       "type": "string"
      },
      "minItems": 1,
      "description": "Omitted when there are none; null when the producer did not search."
     }
    }
   }
  },
  "stopped_at_step": {
   "type": "integer",
   "minimum": 1
  },
  "issues": {
   "type": "array",
   "items": {
    "type": "object",
    "required": [
     "code",
     "severity",
     "text"
    ],
    "additionalProperties": false,
    "properties": {
     "code": {
      "enum": [
       "spike",
       "decorative",
       "barely_used",
       "redundant",
       "trivial",
       "tedious",
       "uniqueness",
       "trial"
      ]
     },
     "severity": {
      "enum": [
       "reject",
       "warning"
      ]
     },
     "text": {
      "type": "string"
     },
     "rules": {
      "type": "array",
      "items": {
       "type": "integer",
       "minimum": 0
      },
      "minItems": 1
     }
    }
   }
  },
  "reject": {
   "type": "boolean"
  },
  "se": {
   "oneOf": [
    {
     "type": "null"
    },
    {
     "type": "object",
     "required": [
      "er",
      "ep",
      "ed",
      "scale"
     ],
     "additionalProperties": false,
     "properties": {
      "er": {
       "type": "number"
      },
      "ep": {
       "type": "number"
      },
      "ed": {
       "type": "number"
      },
      "scale": {
       "const": "classic"
      }
     }
    }
   ]
  },
  "steps": {
   "type": "array",
   "items": {
    "type": "object",
    "required": [
     "n",
     "code",
     "name",
     "band"
    ],
    "additionalProperties": false,
    "properties": {
     "n": {
      "type": "integer",
      "minimum": 1
     },
     "code": {
      "type": "string"
     },
     "name": {
      "type": "string"
     },
     "band": {
      "type": "integer",
      "minimum": 0,
      "maximum": 6
     },
     "placement": {
      "type": "string",
      "pattern": "^r[1-9][0-9]*c[1-9][0-9]*=[0-9]+$"
     },
     "eliminations": {
      "type": "array",
      "items": {
       "type": "string",
       "pattern": "^r[1-9][0-9]*c[1-9][0-9]*#[0-9]+$"
      }
     },
     "explanation": {
      "type": "object",
      "additionalProperties": false,
      "minProperties": 1,
      "properties": {
       "notation": {
        "type": "string"
       },
       "short": {
        "type": "string"
       },
       "teach": {
        "type": "string"
       }
      }
     }
    }
   }
  },
  "describe": {
   "type": [
    "object",
    "null"
   ],
   "required": [
    "type",
    "rules"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "rules": {
     "type": "object",
     "additionalProperties": {
      "type": "string"
     }
    }
   }
  },
  "symmetry": {
   "type": "array",
   "items": {
    "type": "object",
    "required": [
     "kind",
     "of"
    ],
    "additionalProperties": false,
    "properties": {
     "kind": {
      "enum": [
       "rot180",
       "rot90",
       "mirror"
      ]
     },
     "axis": {
      "enum": [
       "horizontal",
       "vertical",
       "diagonal",
       "antidiagonal"
      ]
     },
     "of": {
      "const": "givens"
     }
    }
   }
  },
  "time_dist": {
   "type": [
    "object",
    "null"
   ],
   "description": "On request: parameters of the log-normal time distribution around the median (minutes).",
   "properties": {
    "type": {
     "const": "lognormal"
    },
    "sigma_players": {
     "type": "number"
    },
    "sigma_model": {
     "type": [
      "number",
      "null"
     ]
    }
   },
   "required": [
    "type",
    "sigma_players"
   ],
   "additionalProperties": false
  },
  "completed": {
   "type": "boolean",
   "description": "Grading finished within max_seconds (always true without a limit); false: band may be Unknown with difficulty / time null, or the technique list truncated (docs/formats/grade-card.md)."
  },
  "elapsed": {
   "type": "number",
   "description": "On request: wall-clock seconds the grader took (machine-dependent, not part of the grade)."
  },
  "warning": {
   "type": "boolean",
   "description": "On request: true when any issue has severity warning."
  }
 },
 "patternProperties": {
  "^time_(mean|p[1-9][0-9]?)$": {
   "type": [
    "number",
    "null"
   ],
   "description": "On request: time_mean, or time_pNN = the NN-th percentile of solve times over today's players (minutes)."
  }
 }
}
