{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://tune.toys/schemas/platform/common.schema.json",
  "title": "PlatformCommon",
  "description": "Shared scalar formats referenced by the other platform contracts.",
  "$defs": {
    "EntityId": {
      "title": "EntityId",
      "description": "Durable random identity of a platform row; never a label, slug or array position.",
      "type": "string",
      "minLength": 1,
      "maxLength": 128,
      "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$"
    },
    "Sha256Hex": {
      "title": "Sha256Hex",
      "description": "Lowercase hexadecimal SHA-256 digest.",
      "type": "string",
      "minLength": 64,
      "maxLength": 64,
      "pattern": "^[0-9a-f]{64}$"
    },
    "Timestamp": {
      "title": "Timestamp",
      "description": "UTC ISO 8601 timestamp as produced by Date.prototype.toISOString.",
      "type": "string",
      "minLength": 20,
      "maxLength": 30,
      "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]{1,9})?Z$"
    },
    "SemVer": {
      "title": "SemVer",
      "description": "Semantic version 2.0.0 string.",
      "type": "string",
      "minLength": 5,
      "maxLength": 64,
      "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(-(0|[1-9][0-9]*|[0-9]*[A-Za-z-][0-9A-Za-z-]*)(\\.(0|[1-9][0-9]*|[0-9]*[A-Za-z-][0-9A-Za-z-]*))*)?(\\+[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?$"
    },
    "ByteSize": {
      "title": "ByteSize",
      "description": "Byte count of a stored object.",
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991
    },
    "ExternalLink": {
      "title": "ExternalLink",
      "description": "Plain-text label and an https: or mailto: target.",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "label": {
          "type": "string",
          "minLength": 1,
          "maxLength": 80
        },
        "href": {
          "type": "string",
          "minLength": 1,
          "maxLength": 2048,
          "pattern": "^(https://|mailto:)[^\\s]+$"
        }
      },
      "required": ["label", "href"]
    }
  }
}
