{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://bounder.io/contracts/creedspace-bounder-policy-v1.schema.json",
  "title": "Creed Space Bounder Device Policy v1",
  "type": "object",
  "additionalProperties": false,
  "required": ["version", "policy_id", "issuer", "subject", "fleet_id", "sequence", "issued_at", "not_before", "expires_at", "source_policies", "constraints"],
  "properties": {
    "version": { "const": "creedspace-bounder-policy/v1" },
    "policy_id": { "type": "string", "minLength": 1, "maxLength": 160 },
    "issuer": { "const": "creed.space/fleet" },
    "subject": { "type": "string", "minLength": 1, "maxLength": 255 },
    "fleet_id": { "type": "string", "minLength": 1, "maxLength": 255 },
    "sequence": { "type": "integer", "minimum": 1 },
    "issued_at": { "type": "string", "format": "date-time" },
    "not_before": { "type": "string", "format": "date-time" },
    "expires_at": { "type": "string", "format": "date-time" },
    "source_policies": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["id", "version", "level"],
        "properties": {
          "id": { "type": "string", "minLength": 1 },
          "version": { "type": "string", "minLength": 1 },
          "level": { "enum": ["constitutional", "org", "team", "agent"] }
        }
      }
    },
    "constraints": { "$ref": "creedspace-bounder-profile-v1.schema.json#/$defs/constraints" }
  }
}
