{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://openhydro.org/schemas/v1/submission.schema.json",
  "title": "Results submitted by a solver's developer or user",
  "description": "submissions/<slug>/submission.json: who ran which solver, on which cases, with which results files. The suite scores the files itself (scripts/score_submissions.py); a submission never carries its own pass/fail.",
  "type": "object",
  "additionalProperties": false,
  "required": ["schema_version", "solver", "submitted_by", "date", "results_licence", "cases"],
  "properties": {
    "schema_version": {"type": "string", "const": "1.0.0"},
    "solver": {
      "type": "object",
      "additionalProperties": false,
      "required": ["name", "version"],
      "properties": {
        "name": {"type": "string", "minLength": 1, "description": "Product and engine, e.g. 'TUFLOW HPC'."},
        "version": {"type": "string", "minLength": 1, "description": "Exact build or release, e.g. '2025.1.2'."},
        "options": {"type": "string", "description": "Solver options used for every case unless a case says otherwise (scheme, wet/dry depth, time-step control)."}
      }
    },
    "submitted_by": {"type": "string", "minLength": 1, "description": "Organisation that ran the solver. Shown on the site."},
    "date": {"type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$"},
    "results_licence": {"type": "string", "enum": ["CC-BY-4.0", "CC0-1.0"], "description": "Licence under which the results files and score cards are published."},
    "cases": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["test_id", "case_version", "results"],
        "properties": {
          "test_id": {"type": "string", "pattern": "^(A1P|A1F|A1D|A2A|A2C|A2L|A2F|A12|B)-[A-Za-z0-9.-]+$", "description": "Short id, e.g. A1F-010."},
          "case_version": {"type": "string", "description": "The case version the run used; a submission for an older version is not scored."},
          "results": {"type": "array", "minItems": 1, "items": {"type": "string"}, "description": "Results files (Parquet or CSV in the results contract), relative to the submission folder. For cases with grid refinement, one file per level; the finest is scored and all are used for the convergence check."},
          "options": {"type": "string", "description": "Case-specific options, if any."},
          "notes": {"type": "string"}
        }
      }
    },
    "notes": {"type": "string"}
  }
}
