{
  "$defs": {
    "SyncDirection": {
      "description": "Synchronization direction for a federation agreement.",
      "oneOf": [
        {
          "const": "bidirectional",
          "description": "Both registries sync entries.",
          "type": "string"
        },
        {
          "const": "aFromB",
          "description": "Only registry A pulls from registry B.",
          "type": "string"
        },
        {
          "const": "bFromA",
          "description": "Only registry B pulls from registry A.",
          "type": "string"
        }
      ]
    }
  },
  "$id": "urn:mars:schema:v1:federation-agreement",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "description": "A federation agreement between two MARS registries.\nPer MARS Specification Section 11.5.",
  "properties": {
    "effectiveDate": {
      "description": "When the agreement takes effect.",
      "format": "date-time",
      "type": "string"
    },
    "entryTypes": {
      "description": "Entry types to synchronize.",
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "federationId": {
      "description": "Unique federation agreement identifier.",
      "type": "string"
    },
    "namespaces": {
      "description": "Namespaces to synchronize.",
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "registryA": {
      "description": "DID of registry A.",
      "type": "string"
    },
    "registryB": {
      "description": "DID of registry B.",
      "type": "string"
    },
    "syncDirection": {
      "$ref": "#/$defs/SyncDirection",
      "description": "Synchronization direction."
    },
    "syncInterval": {
      "description": "Sync interval (e.g. \"30s\").",
      "type": "string"
    }
  },
  "required": [
    "federationId",
    "registryA",
    "registryB",
    "entryTypes",
    "namespaces",
    "syncDirection",
    "syncInterval",
    "effectiveDate"
  ],
  "title": "FederationAgreement",
  "type": "object"
}
