{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://openssom.org/schema/profile-origin-free-release-manifest.json",
  "title": "SSOM Origin-free Release Profile: Release Manifest",
  "description": "The statement a releasing party makes about one release. It states the conformance level, the base-level facts (the holding window, the token rule, every release group with the number of independent contributing parties behind it, and what each metric follows), and, for each reserve option, whether it is applied and with what setting. It names no contributing party.",
  "type": "object",
  "required": [
    "release_ref",
    "profile",
    "profile_version",
    "ssom_version",
    "released_at",
    "conformance_level",
    "vocabulary",
    "holding",
    "tokens",
    "groups",
    "metric_rules",
    "reserve_options",
    "policy_decision_ref"
  ],
  "properties": {
    "release_ref": {
      "type": "string",
      "pattern": "^urn:ssom:release:tok:[0-9a-f]{32,64}$"
    },
    "profile": {
      "const": "ssom-origin-free-release"
    },
    "profile_version": {
      "type": "string",
      "pattern": "^[A-Za-z0-9][A-Za-z0-9._+-]*$"
    },
    "ssom_version": {
      "type": "string",
      "pattern": "^[A-Za-z0-9][A-Za-z0-9._+-]*$"
    },
    "released_at": {
      "type": "string",
      "format": "date-time"
    },
    "conformance_level": {
      "enum": [
        "base",
        "reserve"
      ],
      "description": "base: no reserve option is applied. reserve: at least one reserve option is applied. A release at base level is a conforming release."
    },
    "vocabulary": {
      "type": "object",
      "required": [
        "registry_id",
        "registry_version"
      ],
      "properties": {
        "registry_id": {
          "type": "string",
          "pattern": "^[a-z][a-z0-9-]*$"
        },
        "registry_version": {
          "type": "string",
          "pattern": "^[A-Za-z0-9][A-Za-z0-9._+-]*$"
        }
      },
      "additionalProperties": false
    },
    "holding": {
      "type": "object",
      "required": [
        "holding_window_days",
        "withdrawn_contributions_excluded"
      ],
      "properties": {
        "holding_window_days": {
          "type": "integer",
          "minimum": 1
        },
        "withdrawn_contributions_excluded": {
          "type": "boolean",
          "description": "The releasing party states that every contribution withdrawn by its contributor within the holding window is left out of this release."
        }
      },
      "additionalProperties": false
    },
    "tokens": {
      "type": "object",
      "required": [
        "tokenization_version",
        "reversible_by_receiver",
        "shared_with_other_uses"
      ],
      "properties": {
        "tokenization_version": {
          "type": "string",
          "pattern": "^[A-Za-z0-9][A-Za-z0-9._+-]*$"
        },
        "reversible_by_receiver": {
          "const": false
        },
        "shared_with_other_uses": {
          "const": false
        }
      },
      "additionalProperties": false
    },
    "groups": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": [
          "asset_class",
          "version_detail",
          "attributes",
          "contributing_parties",
          "contributing_parties_to_date",
          "largest_party_share",
          "asset_count"
        ],
        "properties": {
          "asset_class": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]*$"
          },
          "equipment_model_ref": {
            "type": "string",
            "pattern": "^urn:ssom:equipment-model:[a-z0-9-]+$"
          },
          "version_detail": {
            "enum": [
              "exact",
              "major",
              "withheld"
            ]
          },
          "attributes": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "attribute_code",
                "value"
              ],
              "properties": {
                "attribute_code": {
                  "type": "string",
                  "pattern": "^[a-z][a-z0-9_]*$"
                },
                "value": {
                  "oneOf": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "boolean"
                    },
                    {
                      "type": "null"
                    },
                    {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9_]*$"
                    }
                  ]
                },
                "unit": {
                  "type": "object",
                  "required": [
                    "unit_code",
                    "vocabulary_id"
                  ],
                  "properties": {
                    "unit_code": {
                      "type": "string",
                      "pattern": "^[A-Z][A-Z0-9_]*$"
                    },
                    "vocabulary_id": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9-]*$"
                    }
                  },
                  "additionalProperties": false
                }
              },
              "additionalProperties": false
            }
          },
          "contributing_parties": {
            "type": "integer",
            "minimum": 1,
            "description": "The number of independent parties that contribute to this group in this release. A count only; no party is named."
          },
          "contributing_parties_to_date": {
            "type": "integer",
            "minimum": 1,
            "description": "The number of independent parties that have contributed to this group in this release and every earlier release of the same releasing party. A count only; no party is named."
          },
          "largest_party_share": {
            "type": "number",
            "exclusiveMinimum": 0,
            "maximum": 1,
            "description": "The largest share of the group's assets in this release that comes from one party."
          },
          "asset_count": {
            "type": "integer",
            "minimum": 1
          }
        },
        "additionalProperties": false
      }
    },
    "metric_rules": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": [
          "metric",
          "origin_coupling"
        ],
        "properties": {
          "metric": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]*$"
          },
          "origin_coupling": {
            "enum": [
              "none",
              "environment",
              "shared_network",
              "position",
              "not_assessed"
            ],
            "description": "What the metric follows outside the asset. Stated at every level, so that the reserve option coupled_series_withheld can act on records already released."
          },
          "quantity_kind": {
            "$ref": "common.json#/$defs/quantityKind"
          },
          "unit": {
            "type": "object",
            "required": [
              "unit_code",
              "vocabulary_id"
            ],
            "properties": {
              "unit_code": {
                "type": "string",
                "pattern": "^[A-Z][A-Z0-9_]*$"
              },
              "vocabulary_id": {
                "type": "string",
                "pattern": "^[a-z][a-z0-9-]*$"
              }
            },
            "additionalProperties": false
          },
          "resolution": {
            "type": "number",
            "exclusiveMinimum": 0
          }
        },
        "allOf": [
          {
            "if": {
              "required": [
                "quantity_kind"
              ]
            },
            "then": {
              "required": [
                "unit"
              ]
            }
          }
        ],
        "additionalProperties": false
      }
    },
    "reserve_options": {
      "type": "object",
      "description": "One entry for every reserve option. Each states whether the option is applied to this release and, if so, with what setting.",
      "required": [
        "group_threshold",
        "time_grid_and_shift",
        "label_renewal",
        "coupled_series_withheld",
        "rounding_and_source_measurement_removal",
        "structure_size_cap",
        "reidentification_test"
      ],
      "properties": {
        "group_threshold": {
          "type": "object",
          "description": "A release group is released only at or above a stated number of independent contributing parties, at or below a stated largest share of one party, and at or above a stated asset count. Below that, detail is given up or the asset is withheld.",
          "required": [
            "applied"
          ],
          "properties": {
            "applied": {
              "type": "boolean"
            },
            "minimum_contributing_parties": {
              "type": "integer",
              "minimum": 3
            },
            "maximum_party_share": {
              "type": "number",
              "exclusiveMinimum": 0,
              "maximum": 0.5
            },
            "minimum_assets_per_group": {
              "type": "integer",
              "minimum": 1
            }
          },
          "if": {
            "properties": {
              "applied": {
                "const": true
              }
            }
          },
          "then": {
            "required": [
              "minimum_contributing_parties",
              "maximum_party_share",
              "minimum_assets_per_group"
            ]
          },
          "else": {
            "maxProperties": 1
          },
          "additionalProperties": false
        },
        "time_grid_and_shift": {
          "type": "object",
          "description": "Every event time is on a stated grid, and every structure is moved into the past by one amount drawn from a stated range and kept by no one.",
          "required": [
            "applied"
          ],
          "properties": {
            "applied": {
              "type": "boolean"
            },
            "time_grid_seconds": {
              "type": "integer",
              "minimum": 1
            },
            "shift_scope": {
              "enum": [
                "per_structure"
              ]
            },
            "shift_direction": {
              "const": "backward"
            },
            "minimum_shift_days": {
              "type": "integer",
              "minimum": 1
            },
            "maximum_shift_days": {
              "type": "integer",
              "minimum": 1
            }
          },
          "if": {
            "properties": {
              "applied": {
                "const": true
              }
            }
          },
          "then": {
            "required": [
              "time_grid_seconds",
              "shift_scope",
              "shift_direction",
              "minimum_shift_days",
              "maximum_shift_days"
            ]
          },
          "else": {
            "maxProperties": 1
          },
          "additionalProperties": false
        },
        "label_renewal": {
          "type": "object",
          "description": "Tokens are renewed: no token appears in two releases (per_release), or an asset token continues for at most a stated number of days (bounded_window).",
          "required": [
            "applied"
          ],
          "properties": {
            "applied": {
              "type": "boolean"
            },
            "token_scope": {
              "enum": [
                "per_release",
                "bounded_window"
              ]
            },
            "linkage_window_days": {
              "type": "integer",
              "minimum": 1
            }
          },
          "if": {
            "properties": {
              "applied": {
                "const": true
              }
            }
          },
          "then": {
            "required": [
              "token_scope"
            ]
          },
          "else": {
            "maxProperties": 1
          },
          "additionalProperties": false,
          "allOf": [
            {
              "if": {
                "properties": {
                  "token_scope": {
                    "const": "bounded_window"
                  }
                },
                "required": [
                  "token_scope"
                ]
              },
              "then": {
                "required": [
                  "linkage_window_days"
                ]
              }
            }
          ]
        },
        "coupled_series_withheld": {
          "type": "object",
          "description": "Only a metric whose origin_coupling is none is released as a series. A metric that follows the environment, a shared network or a position, or that has not been assessed, is withheld.",
          "required": [
            "applied"
          ],
          "properties": {
            "applied": {
              "type": "boolean"
            }
          },
          "if": {
            "properties": {
              "applied": {
                "const": true
              }
            }
          },
          "then": {
            "required": []
          },
          "else": {
            "maxProperties": 1
          },
          "additionalProperties": false
        },
        "rounding_and_source_measurement_removal": {
          "type": "object",
          "description": "Every numeric value is a multiple of the resolution stated for its metric, and the original measurement restates the released value and unit in place of the value and unit the source gave.",
          "required": [
            "applied"
          ],
          "properties": {
            "applied": {
              "type": "boolean"
            }
          },
          "if": {
            "properties": {
              "applied": {
                "const": true
              }
            }
          },
          "then": {
            "required": []
          },
          "else": {
            "maxProperties": 1
          },
          "additionalProperties": false
        },
        "structure_size_cap": {
          "type": "object",
          "description": "A released structure (the assets joined by released relationships) joins at most a stated number of assets.",
          "required": [
            "applied"
          ],
          "properties": {
            "applied": {
              "type": "boolean"
            },
            "maximum_assets_per_structure": {
              "type": "integer",
              "minimum": 1
            }
          },
          "if": {
            "properties": {
              "applied": {
                "const": true
              }
            }
          },
          "then": {
            "required": [
              "maximum_assets_per_structure"
            ]
          },
          "else": {
            "maxProperties": 1
          },
          "additionalProperties": false
        },
        "reidentification_test": {
          "type": "object",
          "description": "The release records a re-identification test by a party independent of the releasing party, with planted weak cases, all of them found, and no record attributed.",
          "required": [
            "applied"
          ],
          "properties": {
            "applied": {
              "type": "boolean"
            },
            "test_ref": {
              "type": "string",
              "pattern": "^urn:ssom:test:tok:[0-9a-f]{32,64}$"
            },
            "performed_by": {
              "enum": [
                "independent_party",
                "releasing_party"
              ]
            },
            "controls_version": {
              "type": "string",
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._+-]*$"
            },
            "attack_classes": {
              "type": "array",
              "minItems": 1,
              "items": {
                "type": "string",
                "pattern": "^[a-z][a-z0-9_]*$"
              }
            },
            "planted_cases": {
              "type": "integer",
              "minimum": 0
            },
            "planted_cases_found": {
              "type": "integer",
              "minimum": 0
            },
            "records_attributed": {
              "type": "integer",
              "minimum": 0
            },
            "result": {
              "enum": [
                "pass",
                "fail"
              ]
            }
          },
          "if": {
            "properties": {
              "applied": {
                "const": true
              }
            }
          },
          "then": {
            "required": [
              "test_ref",
              "performed_by",
              "controls_version",
              "attack_classes",
              "planted_cases",
              "planted_cases_found",
              "records_attributed",
              "result"
            ]
          },
          "else": {
            "maxProperties": 1
          },
          "additionalProperties": false
        }
      },
      "additionalProperties": false
    },
    "policy_decision_ref": {
      "type": "string",
      "pattern": "^urn:ssom:decision:tok:[0-9a-f]{32,64}$"
    }
  },
  "additionalProperties": false
}
