{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://standards.msadsnetwork.com/downloads/schemas/sdkcert-result.schema.json",
  "title": "SDK self-test result v0.1 (public draft)",
  "type": "object",
  "required": [
    "ver",
    "suite",
    "sdk",
    "run",
    "results",
    "summary",
    "overall",
    "expires"
  ],
  "additionalProperties": false,
  "properties": {
    "ver": {
      "const": "0.1"
    },
    "suite": {
      "type": "string",
      "pattern": "^sdkcert-0\\.1(\\.\\d+)?$"
    },
    "sdk": {
      "type": "object",
      "required": [
        "name",
        "version",
        "platform",
        "package"
      ],
      "properties": {
        "name": {
          "type": "string"
        },
        "version": {
          "type": "string"
        },
        "platform": {
          "enum": [
            "android",
            "ios",
            "web",
            "unity",
            "flutter"
          ]
        },
        "package": {
          "type": "string"
        }
      },
      "additionalProperties": false
    },
    "run": {
      "type": "object",
      "required": [
        "at",
        "runner",
        "runner_version",
        "log_sha256"
      ],
      "properties": {
        "at": {
          "type": "string",
          "pattern": "^\\d{4}-\\d{2}-\\d{2}T"
        },
        "runner": {
          "enum": [
            "self",
            "msads"
          ]
        },
        "runner_version": {
          "type": "string"
        },
        "log_sha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        }
      },
      "additionalProperties": false
    },
    "results": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": [
          "id",
          "status"
        ],
        "properties": {
          "id": {
            "enum": [
              "T-REQ-01",
              "T-REQ-02",
              "T-REQ-03",
              "T-LITE-01",
              "T-LANG-01",
              "T-EVT-01",
              "T-EVT-02",
              "T-SC-01",
              "T-SEC-01",
              "T-SIZE-01"
            ]
          },
          "status": {
            "enum": [
              "pass",
              "fail",
              "not_applicable"
            ]
          },
          "reason": {
            "type": "string",
            "maxLength": 300
          }
        },
        "additionalProperties": false
      }
    },
    "summary": {
      "type": "object",
      "required": [
        "passed",
        "failed",
        "not_applicable"
      ],
      "properties": {
        "passed": {
          "type": "integer",
          "minimum": 0
        },
        "failed": {
          "type": "integer",
          "minimum": 0
        },
        "not_applicable": {
          "type": "integer",
          "minimum": 0
        }
      },
      "additionalProperties": false
    },
    "overall": {
      "enum": [
        "pass",
        "fail"
      ]
    },
    "expires": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    }
  },
  "if": {
    "properties": {
      "summary": {
        "properties": {
          "failed": {
            "minimum": 1
          }
        }
      }
    }
  },
  "then": {
    "properties": {
      "overall": {
        "const": "fail"
      }
    }
  }
}