{
  "$defs": {
    "AccessPolicy": {
      "description": "Access control policy for a MARS entry.\n\nWhen `public` is `true` the entry is discoverable by any resolver. When\n`false`, only DIDs listed in `allowed_dids` (or those presenting a required\nattestation type) may resolve it.",
      "properties": {
        "allowedDids": {
          "description": "Explicit DID allow-list (relevant when `public` is `false`).",
          "items": {
            "type": "string"
          },
          "type": [
            "array",
            "null"
          ]
        },
        "public": {
          "default": true,
          "description": "Whether the entry is publicly discoverable.",
          "type": "boolean"
        },
        "requiredAttestationTypes": {
          "description": "Attestation type URIs that grant access (relevant when `public` is\n`false`).",
          "items": {
            "type": "string"
          },
          "type": [
            "array",
            "null"
          ]
        }
      },
      "type": "object"
    },
    "AnchorState": {
      "description": "Registry-managed lifecycle of an anchor intent or entry projection.",
      "oneOf": [
        {
          "const": "unanchored",
          "description": "No anchor has been requested for the current entry snapshot.",
          "type": "string"
        },
        {
          "const": "pending",
          "description": "Durable work exists and is ready for a worker.",
          "type": "string"
        },
        {
          "const": "submitted",
          "description": "A provider accepted the submission but has not confirmed it.",
          "type": "string"
        },
        {
          "const": "confirmed",
          "description": "The provider reported final confirmation.",
          "type": "string"
        },
        {
          "const": "failed",
          "description": "The latest attempt failed and is eligible for a bounded retry.",
          "type": "string"
        },
        {
          "const": "abandoned",
          "description": "Retry policy or an administrator ended processing permanently.",
          "type": "string"
        }
      ]
    },
    "BondAmount": {
      "description": "Exact, non-negative decimal amount used by every bond money field.\n\nThe wire form is always a JSON string in canonical plain-decimal notation.\nValues are constrained to PostgreSQL `NUMERIC(38,18)`: at most 20 integer\ndigits and 18 fractional digits, with no sign or exponent. This keeps\nsignature bytes, threshold checks, and database values identical.",
      "pattern": "^(0|[1-9][0-9]{0,19})(\\.[0-9]{1,18})?$",
      "type": "string"
    },
    "BondReference": {
      "description": "A reference to a bond stored in a MARS entry.\nPer MARS Specification Section 7.2.",
      "properties": {
        "amount": {
          "$ref": "#/$defs/BondAmount",
          "description": "Amount staked in MINTS."
        },
        "bondId": {
          "description": "Unique bond identifier.",
          "type": "string"
        },
        "currency": {
          "description": "Currency — always \"MINTS\".",
          "type": "string"
        },
        "status": {
          "$ref": "#/$defs/BondStatus",
          "description": "Current bond status."
        }
      },
      "required": [
        "bondId",
        "amount",
        "currency",
        "status"
      ],
      "type": "object"
    },
    "BondStatus": {
      "description": "Status of a publisher bond.\nPer MARS Specification Appendix A (bondReference schema).",
      "oneOf": [
        {
          "const": "active",
          "description": "Bond is active and fully collateralized.",
          "type": "string"
        },
        {
          "const": "partially_slashed",
          "description": "Bond has been partially slashed but still covers minimum.",
          "type": "string"
        },
        {
          "const": "fully_slashed",
          "description": "Bond has been fully slashed — entry should be revoked.",
          "type": "string"
        },
        {
          "const": "released",
          "description": "Bond has been released back to the publisher.",
          "type": "string"
        }
      ]
    },
    "EntrySignature": {
      "description": "Cryptographic signature over a MARS entry's canonical content.\n\nThe signature uses `MARS-PUBLISHER-SIGNING-V1`: JCS (RFC 8785) over\npublisher-authored fields after removing only `signature`, `sequence`,\n`updatedAt`, `lifecycleStatus`, `verifiableAttestations`, `shardAssignment`,\n`anchorProjection`, `anchorState`, `anchorTxHash`, `anchorBlockHeight`, and\n`anchorProof`.",
      "properties": {
        "algorithm": {
          "description": "Signature algorithm. Always \"Ed25519\".",
          "pattern": "^Ed25519$",
          "type": "string"
        },
        "created": {
          "description": "ISO 8601 timestamp of when the signature was created.",
          "type": [
            "string",
            "null"
          ]
        },
        "keyId": {
          "description": "DID URL of the signing key (e.g. `\"did:oas:l1fe:ao:org#key-1\"`).",
          "pattern": "^did:oas:.+#.+$",
          "type": "string"
        },
        "value": {
          "description": "Strict URL-safe, unpadded base64url signature bytes.\n\nStandard-base64 characters (`+`, `/`) and `=` padding are rejected.",
          "type": "string"
        }
      },
      "required": [
        "algorithm",
        "keyId",
        "value"
      ],
      "type": "object"
    },
    "EntryType": {
      "description": "The 10 OAS-aligned entry types plus 4 MAP plugin types (14 total).\n\nEach variant maps to an [`oas_did::EntityKind`] value via the\n[`oas_kind`](Self::oas_kind) method.\n\n# Serialization\n\nVariants serialize to their PascalCase name (e.g. `\"AgentDefinition\"`).",
      "oneOf": [
        {
          "const": "AgentDefinition",
          "description": "A registered autonomous agent.",
          "type": "string"
        },
        {
          "const": "ToolDefinition",
          "description": "A tool that agents can invoke.",
          "type": "string"
        },
        {
          "const": "SkillDefinition",
          "description": "A composable skill unit.",
          "type": "string"
        },
        {
          "const": "WorkflowDefinition",
          "description": "A multi-step workflow definition.",
          "type": "string"
        },
        {
          "const": "ModelDefinition",
          "description": "A machine learning model with provenance.",
          "type": "string"
        },
        {
          "const": "DatasetDefinition",
          "description": "A dataset with verified lineage.",
          "type": "string"
        },
        {
          "const": "ServiceDefinition",
          "description": "An infrastructure or API service.",
          "type": "string"
        },
        {
          "const": "OrganizationDefinition",
          "description": "An autonomous organization record.",
          "type": "string"
        },
        {
          "const": "HumanRootRecord",
          "description": "A single verified human root (HMR).",
          "type": "string"
        },
        {
          "const": "MultiHumanRootRecord",
          "description": "A threshold-group multi-human root (MHR).",
          "type": "string"
        },
        {
          "const": "MapPlugin",
          "description": "A MAP plugin definition + metadata.",
          "type": "string"
        },
        {
          "const": "MapPluginRelease",
          "description": "A specific version binary + config for a MAP plugin.",
          "type": "string"
        },
        {
          "const": "MapIntegrationSchema",
          "description": "A reusable integration type definition for MAP plugins.",
          "type": "string"
        },
        {
          "const": "MapPluginCollection",
          "description": "A curated bundle of MAP plugins.",
          "type": "string"
        }
      ]
    },
    "LifecycleStatus": {
      "description": "The lifecycle status of a MARS registry entry.",
      "oneOf": [
        {
          "const": "draft",
          "description": "Entry submitted but not yet bonded/anchored.",
          "type": "string"
        },
        {
          "const": "active",
          "description": "Entry bonded, anchored, and serving.",
          "type": "string"
        },
        {
          "const": "deprecated",
          "description": "Superseded by newer version; still resolvable.",
          "type": "string"
        },
        {
          "const": "archived",
          "description": "No longer actively served; preserved for history.",
          "type": "string"
        },
        {
          "const": "revoked",
          "description": "Permanently deactivated; irreversible.",
          "type": "string"
        },
        {
          "const": "experimental",
          "description": "Published for testing; lower bond requirements.",
          "type": "string"
        }
      ]
    },
    "LineageReference": {
      "description": "A reference to the human lineage chain of a MARS entry's publisher.\n\nEvery non-root entry traces back to a human root DID through a chain of\ndelegations.",
      "properties": {
        "generation": {
          "description": "The generation distance from the root (0 = direct child).",
          "format": "uint32",
          "minimum": 0,
          "type": "integer"
        },
        "humanRootDid": {
          "description": "The DID of the originating human root.",
          "pattern": "^did:oas:",
          "type": "string"
        },
        "lineageChain": {
          "description": "Ordered chain of DIDs from root to publisher.",
          "items": {
            "pattern": "^did:oas:",
            "type": "string"
          },
          "type": "array"
        }
      },
      "required": [
        "humanRootDid",
        "generation"
      ],
      "type": "object"
    },
    "MarsEntry": {
      "description": "A complete MARS registry entry (MARS Specification Section 5).\n\nThis is the canonical on-wire and at-rest representation of every artifact\nregistered in the MARS ecosystem. Required fields are always present;\noptional fields are omitted from JSON when `None` or empty.\n\n# Validation\n\nCall [`validate`](Self::validate) to check structural invariants before\nsigning or persisting.\n\n# Examples\n\n```no_run\nuse mars_protocol::entry::{MarsEntry, EntryType};\n\nlet entry: MarsEntry = serde_json::from_str(r#\"{ ... }\"#)?;\nentry.validate()?;\n# Ok::<(), Box<dyn std::error::Error>>(())\n```",
      "properties": {
        "accessPolicy": {
          "anyOf": [
            {
              "$ref": "#/$defs/AccessPolicy"
            },
            {
              "type": "null"
            }
          ],
          "description": "Access control policy."
        },
        "anchorState": {
          "$ref": "#/$defs/AnchorState",
          "default": "unanchored",
          "description": "Registry-managed anchor projection for the current immutable snapshot.\n\nThis field is excluded from the publisher signing payload and can only\nbe advanced by the registry's durable anchor outbox."
        },
        "bondReference": {
          "anyOf": [
            {
              "$ref": "#/$defs/BondReference"
            },
            {
              "type": "null"
            }
          ],
          "description": "Associated economic bond."
        },
        "customMetadata": {
          "additionalProperties": true,
          "description": "Arbitrary extension metadata.",
          "type": [
            "object",
            "null"
          ]
        },
        "description": {
          "description": "Human-readable description (max 4096 characters).",
          "maxLength": 4096,
          "type": [
            "string",
            "null"
          ]
        },
        "entryDid": {
          "description": "The OAS DID uniquely identifying this entry.",
          "pattern": "^did:oas:",
          "type": "string"
        },
        "entryType": {
          "$ref": "#/$defs/EntryType",
          "description": "The primary entry type (one of 10 OAS kinds)."
        },
        "itemData": {
          "description": "The entry payload conforming to `item_schema_uri`."
        },
        "itemDataHash": {
          "description": "Content hash of `item_data` in `sha256:<hex>` format.",
          "pattern": "^sha256:[a-f0-9]{64}$",
          "type": "string"
        },
        "itemSchemaUri": {
          "description": "URI of the JSON Schema that `item_data` conforms to.",
          "type": "string"
        },
        "lifecycleStatus": {
          "$ref": "#/$defs/LifecycleStatus",
          "default": "active",
          "description": "Current lifecycle status (defaults to `Active`)."
        },
        "lineageReference": {
          "anyOf": [
            {
              "$ref": "#/$defs/LineageReference"
            },
            {
              "type": "null"
            }
          ],
          "description": "Lineage chain to the originating human root."
        },
        "marsVersion": {
          "description": "MARS protocol version. Must be `\"1.0.0\"`.",
          "pattern": "^1\\.0\\.0$",
          "type": "string"
        },
        "name": {
          "description": "Human-readable name (max 256 characters).",
          "maxLength": 256,
          "minLength": 1,
          "type": "string"
        },
        "publishedAt": {
          "description": "Timestamp of initial publication.",
          "format": "date-time",
          "type": "string"
        },
        "publisherDid": {
          "description": "DID of the publishing entity.",
          "pattern": "^did:oas:",
          "type": "string"
        },
        "relationships": {
          "description": "Typed relationships to other entries.",
          "items": {
            "$ref": "#/$defs/Relationship"
          },
          "type": "array"
        },
        "semanticAnnotations": {
          "description": "RDF-style semantic annotations.",
          "items": {
            "$ref": "#/$defs/SemanticAnnotation"
          },
          "type": "array"
        },
        "sequence": {
          "default": 0,
          "description": "Monotonically increasing counter for replay protection.",
          "format": "uint64",
          "minimum": 0,
          "type": "integer"
        },
        "serviceEndpoints": {
          "description": "Service endpoints for OpenAgent resolution.\n\nPer the MARS/OpenAgent Endpoint Contract (v1.0.0), entries MAY declare\ntransport endpoints. Day-one clients consume only `https` endpoints;\n`weave` and `wss` entries are stored for forward compatibility.",
          "items": {
            "$ref": "#/$defs/ServiceEndpoint"
          },
          "type": "array"
        },
        "shardAssignment": {
          "description": "MARS shard assignment (from gal topology map).",
          "type": [
            "string",
            "null"
          ]
        },
        "signature": {
          "$ref": "#/$defs/EntrySignature",
          "description": "Cryptographic signature over the canonical entry content."
        },
        "tags": {
          "description": "Discovery tags.",
          "items": {
            "maxLength": 64,
            "type": "string"
          },
          "maxItems": 50,
          "type": "array"
        },
        "updatedAt": {
          "description": "Timestamp of the most recent update.",
          "format": "date-time",
          "type": [
            "string",
            "null"
          ]
        },
        "verifiableAttestations": {
          "description": "Verifiable attestations (opaque JSON; validated at a higher layer).",
          "items": true,
          "type": "array"
        },
        "version": {
          "$ref": "#/$defs/SemVer",
          "description": "Semantic version of this entry."
        }
      },
      "required": [
        "marsVersion",
        "entryDid",
        "entryType",
        "name",
        "version",
        "publisherDid",
        "publishedAt",
        "itemSchemaUri",
        "itemData",
        "itemDataHash",
        "signature"
      ],
      "type": "object"
    },
    "Relationship": {
      "description": "A typed directional relationship between two MARS entries.",
      "properties": {
        "label": {
          "description": "Optional human-readable label for the relationship.",
          "type": [
            "string",
            "null"
          ]
        },
        "relationshipType": {
          "$ref": "#/$defs/RelationshipType",
          "description": "The kind of relationship."
        },
        "targetDid": {
          "description": "The DID of the target entry.",
          "type": "string"
        }
      },
      "required": [
        "relationshipType",
        "targetDid"
      ],
      "type": "object"
    },
    "RelationshipType": {
      "description": "Supported relationship types between MARS entries.",
      "oneOf": [
        {
          "const": "dependsOn",
          "description": "The source entry depends on the target entry.",
          "type": "string"
        },
        {
          "const": "composes",
          "description": "The source entry composes (includes) the target entry.",
          "type": "string"
        },
        {
          "const": "extends",
          "description": "The source entry extends the target entry.",
          "type": "string"
        },
        {
          "const": "replaces",
          "description": "The source entry replaces the target entry.",
          "type": "string"
        },
        {
          "const": "instanceOf",
          "description": "The source entry is an instance of the target entry.",
          "type": "string"
        },
        {
          "const": "publishedBy",
          "description": "The source entry is published by the target organization/human.",
          "type": "string"
        },
        {
          "const": "relatedTo",
          "description": "The source entry is related to the target entry (generic).",
          "type": "string"
        }
      ]
    },
    "SemVer": {
      "pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$",
      "type": "string"
    },
    "SemanticAnnotation": {
      "description": "RDF-style semantic annotation attached to a MARS entry.\n\nAnnotations express facts about an entry in predicate-object form. At least\none of `object_literal` or `object_uri` must be provided; supplying both is\nvalid and indicates the literal is a label/display form of the referenced\nresource.\n\n# Serialization\n\nAll fields use camelCase when serialized to JSON.\n\n# Examples\n\n```\nuse mars_protocol::types::SemanticAnnotation;\n\nlet ann = SemanticAnnotation {\n    predicate_uri: \"https://schema.org/author\".into(),\n    object_literal: Some(\"Ada Lovelace\".into()),\n    object_uri: Some(\"did:oas:hmr:abc123\".into()),\n};\nassert!(ann.validate().is_ok());\n```",
      "properties": {
        "objectLiteral": {
          "description": "A literal value for the object (plain text, number-as-string, etc.).",
          "type": [
            "string",
            "null"
          ]
        },
        "objectUri": {
          "description": "A URI reference for the object (another DID, schema URL, etc.).",
          "type": [
            "string",
            "null"
          ]
        },
        "predicateUri": {
          "description": "The predicate URI identifying the relationship (e.g. `https://schema.org/author`).",
          "type": "string"
        }
      },
      "required": [
        "predicateUri"
      ],
      "type": "object"
    },
    "ServiceEndpoint": {
      "description": "A service endpoint declared in a MARS entry.\n\nPer the MARS/OpenAgent Endpoint Contract (v1.0.0), each endpoint declares\na transport type, a URL, and a selection priority. Day-one only `https`\nendpoints are consumed; `weave` and `wss` endpoints are stored for\nforward compatibility.\n\n# Forward Compatibility\n\nClients MUST ignore endpoint types they do not support. The `properties`\nfield provides a transport-specific extension point so future metadata\ndoes not require schema-level changes.\n\n# Serialization\n\nAll fields use camelCase. `properties` is omitted when empty/None.\n\n# Examples\n\n```\nuse mars_protocol::types::ServiceEndpoint;\n\nlet ep = ServiceEndpoint {\n    id: \"primary-https\".into(),\n    endpoint_type: \"https\".into(),\n    url: \"https://api.example.com\".into(),\n    priority: 0,\n    properties: None,\n};\nassert!(ep.validate().is_ok());\n```",
      "properties": {
        "id": {
          "description": "Unique identifier within a DID's endpoint set.",
          "type": "string"
        },
        "priority": {
          "description": "Selection priority. 0 = highest. Lower values preferred.",
          "format": "uint32",
          "minimum": 0,
          "type": "integer"
        },
        "properties": {
          "additionalProperties": true,
          "description": "Transport-specific metadata (extensible, optional).",
          "type": [
            "object",
            "null"
          ]
        },
        "type": {
          "description": "Transport type: `\"https\"` (day-one), `\"weave\"`, `\"wss\"` (phase-2).",
          "type": "string"
        },
        "url": {
          "description": "Transport-specific address (URL, peer ID, etc.).",
          "type": "string"
        }
      },
      "required": [
        "id",
        "type",
        "url",
        "priority"
      ],
      "type": "object"
    }
  },
  "$id": "urn:mars:schema:v1:transfer-accept-request",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "description": "Request body for accepting a transfer offer.\n\n`entry` must preserve every publisher-authored field from the offered\nsnapshot, bind `publisherDid` and its signature key controller to the\nauthenticated recipient, advance the registry sequence, and omit\nregistry-managed `verifiableAttestations`. The recipient must re-sign the\ncomplete canonical publisher payload; the owner's offer signature never\nsubstitutes for the recipient entry signature.",
  "properties": {
    "entry": {
      "$ref": "#/$defs/MarsEntry",
      "description": "Complete replacement entry signed by the recipient."
    }
  },
  "required": [
    "entry"
  ],
  "title": "TransferAcceptRequest",
  "type": "object"
}
