{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "agent-release",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "format",
    "key_id",
    "sequence",
    "version",
    "issued_at",
    "expires_at",
    "rollback",
    "binaries"
  ],
  "properties": {
    "format": {
      "const": "iphub-agent-release-v1"
    },
    "key_id": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_-]{1,64}$"
    },
    "sequence": {
      "type": "integer",
      "minimum": 1,
      "maximum": 9007199254740991
    },
    "version": {
      "type": "string",
      "pattern": "^(0|[1-9][0-9]{0,5})\\.(0|[1-9][0-9]{0,5})\\.(0|[1-9][0-9]{0,5})$"
    },
    "issued_at": {
      "type": "integer",
      "minimum": 1
    },
    "expires_at": {
      "type": "integer",
      "minimum": 1
    },
    "rollback": {
      "type": "boolean"
    },
    "binaries": {
      "type": "array",
      "minItems": 1,
      "maxItems": 16,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "component",
          "os",
          "arch",
          "file",
          "sha256",
          "bytes"
        ],
        "properties": {
          "component": {
            "enum": [
              "hub-agent",
              "iphub-net",
              "iphub-update"
            ]
          },
          "os": {
            "const": "linux"
          },
          "arch": {
            "enum": [
              "amd64",
              "arm64"
            ]
          },
          "file": {
            "type": "string",
            "pattern": "^(hub-agent|iphub-net|iphub-update)-linux-(amd64|arm64)$"
          },
          "sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "bytes": {
            "type": "integer",
            "minimum": 64,
            "maximum": 67108864
          }
        }
      }
    }
  }
}
