{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://sec.hypermedia.au/schemas/license/v1.schema.json",
  "title": "CyberBench License v1 Schema",
  "description": "Validates the decoded payload of a .cblicense envelope. Dates are ISO-8601. Capability strings are open by design: a build that does not recognise one ignores it rather than rejecting the licence. Normative requirements: https://sec.hypermedia.au/standards/license/v1",
  "type": "object",
  "required": ["schema", "licenseId", "licensee", "issuedAt", "capabilities"],
  "properties": {
    "schema": { "type": "string", "const": "cyberbench/license/v1" },
    "licenseId": {
      "type": "string",
      "pattern": "^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$"
    },
    "licensee": {
      "type": "object",
      "required": ["org"],
      "properties": {
        "org": { "type": "string", "minLength": 1 },
        "contact": { "type": ["string", "null"] }
      }
    },
    "issuedAt": { "type": "string", "format": "date-time" },
    "expiresAt": {
      "type": ["string", "null"],
      "format": "date-time",
      "description": "Absent or null means perpetual. Present means the licence is expired at and after this instant."
    },
    "capabilities": {
      "type": "array",
      "items": { "type": "string", "minLength": 1 }
    }
  }
}