{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://opentine.com/schemas/opentine-uplift-export-1.schema.json",
  "title": "opentine-uplift-export/1 file",
  "description": "Every counted record of one suite in a fixed order; `tine uplift horizon|compare --from FILE` recompute their reports from it byte for byte. A file format, not an object kind.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "format",
    "suite",
    "definition",
    "records",
    "findings"
  ],
  "properties": {
    "format": {
      "const": "opentine-uplift-export/1"
    },
    "suite": {
      "type": "string",
      "pattern": "^sha256:[0-9a-f]{64}$"
    },
    "definition": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "name",
        "version",
        "scoring",
        "tasks"
      ],
      "properties": {
        "name": {
          "type": "string"
        },
        "version": {
          "type": "string"
        },
        "scoring": {
          "type": "string"
        },
        "tasks": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "minutes"
            ],
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[A-Za-z0-9_.:-]{1,128}$"
              },
              "minutes": {
                "type": "string",
                "pattern": "^(0|[1-9][0-9]{0,8})(\\.[0-9]{1,6})?$"
              }
            }
          }
        }
      }
    },
    "records": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "oid",
          "record",
          "task",
          "subject",
          "condition",
          "success",
          "minutes",
          "perceived_minutes",
          "generation"
        ],
        "properties": {
          "oid": {
            "type": "string",
            "pattern": "^attestation:sha256:[0-9a-f]{64}$"
          },
          "record": {
            "enum": [
              "baseline",
              "run",
              "speed"
            ]
          },
          "task": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_.:-]{1,128}$"
          },
          "subject": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_.:-]{1,128}$"
          },
          "condition": {
            "enum": [
              "human",
              "ai",
              "ai-assisted",
              "unassisted"
            ]
          },
          "success": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ]
          },
          "minutes": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(0|[1-9][0-9]{0,8})(\\.[0-9]{1,6})?$"
              },
              {
                "type": "null"
              }
            ]
          },
          "perceived_minutes": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(0|[1-9][0-9]{0,8})(\\.[0-9]{1,6})?$"
              },
              {
                "type": "null"
              }
            ]
          },
          "generation": {
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0
              },
              {
                "type": "null"
              }
            ]
          }
        }
      }
    },
    "findings": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "level",
          "code",
          "oid",
          "message"
        ],
        "properties": {
          "level": {
            "enum": [
              "fail",
              "advisory"
            ]
          },
          "code": {
            "type": "string",
            "pattern": "^(fail|advisory):uplift\\.[a-z-]+$"
          },
          "oid": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        }
      }
    }
  }
}
