{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "schemaVersion": {
      "const": "1.0.0"
    },
    "platform": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "platformId": {
          "type": [
            "string",
            "null"
          ]
        },
        "customLabel": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 120
        },
        "version": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "platformId",
        "customLabel",
        "version"
      ],
      "oneOf": [
        {
          "properties": {
            "platformId": {
              "type": "string",
              "minLength": 1
            },
            "customLabel": {
              "type": "null"
            }
          }
        },
        {
          "properties": {
            "platformId": {
              "type": "null"
            },
            "customLabel": {
              "type": "string",
              "minLength": 1,
              "pattern": "\\S"
            }
          }
        }
      ]
    },
    "model": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "kind": {
          "enum": [
            "catalog",
            "custom",
            "auto",
            "unknown"
          ]
        },
        "modelId": {
          "type": [
            "string",
            "null"
          ]
        },
        "rawLabel": {
          "type": [
            "string",
            "null"
          ],
          "maxLength": 256
        },
        "revision": {
          "type": [
            "string",
            "null"
          ]
        },
        "fileName": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "kind",
        "modelId",
        "rawLabel",
        "revision",
        "fileName"
      ],
      "allOf": [
        {
          "if": {
            "properties": {
              "kind": {
                "const": "catalog"
              }
            }
          },
          "then": {
            "properties": {
              "modelId": {
                "type": "string",
                "minLength": 1
              }
            }
          },
          "else": {
            "properties": {
              "modelId": {
                "type": "null"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "kind": {
                "const": "custom"
              }
            }
          },
          "then": {
            "properties": {
              "rawLabel": {
                "type": "string",
                "minLength": 1,
                "maxLength": 256,
                "pattern": "\\S"
              }
            }
          }
        }
      ]
    },
    "execution": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "providerId": {
          "type": [
            "string",
            "null"
          ]
        },
        "providerModelId": {
          "type": [
            "string",
            "null"
          ]
        },
        "mode": {
          "enum": [
            "local",
            "hosted",
            "unknown"
          ]
        },
        "compatibility": {
          "enum": [
            "hf_mapping_observed",
            "user_reported",
            "unknown"
          ]
        }
      },
      "required": [
        "providerId",
        "providerModelId",
        "mode",
        "compatibility"
      ]
    },
    "catalogVersion": {
      "type": [
        "string",
        "null"
      ]
    },
    "recordedAt": {
      "type": "string",
      "format": "date-time"
    }
  },
  "required": [
    "schemaVersion",
    "platform",
    "model",
    "execution",
    "catalogVersion",
    "recordedAt"
  ]
}
