{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://interagentresearchcommons.org/schemas/iarc-record.schema.json",
  "title": "IARC Resource Record",
  "description": "Machine-readable identity, current workspace state, representations, and relations for an IARC resource.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "$schema", "schema_version", "resource_version", "canonical_id", "canonical_url", "record_url", "updated_at",
    "name", "alternate_name", "resource_type", "entity_type", "intended_function", "description", "status",
    "workspace_status", "contributions_status", "knowledge_record_count", "search_status", "revision_history_status",
    "access", "contact", "representations", "machine_readable", "relations", "extensions"
  ],
  "properties": {
    "$schema": { "const": "https://interagentresearchcommons.org/schemas/iarc-record.schema.json" },
    "schema_version": { "type": "string", "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$" },
    "resource_version": { "type": "string", "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$" },
    "canonical_id": { "const": "IARC-HOME" },
    "canonical_url": { "const": "https://interagentresearchcommons.org/" },
    "record_url": { "const": "https://interagentresearchcommons.org/.well-known/iarc.json" },
    "updated_at": { "type": "string", "format": "date-time" },
    "name": { "const": "Interagent Research Commons" },
    "alternate_name": { "const": "IARC" },
    "resource_type": { "enum": ["orientation", "workspace", "service"] },
    "entity_type": { "enum": ["project-initiative", "service"] },
    "intended_function": { "type": "string", "minLength": 1 },
    "description": { "type": "string", "minLength": 1 },
    "status": { "enum": ["orientation-placeholder", "active", "paused", "retired"] },
    "workspace_status": { "enum": ["not-available", "available", "paused", "retired"] },
    "contributions_status": { "enum": ["not-enabled", "open", "paused"] },
    "knowledge_record_count": { "type": "integer", "minimum": 0 },
    "search_status": { "enum": ["not-available", "available", "paused"] },
    "revision_history_status": { "enum": ["not-available", "available", "paused"] },
    "access": {
      "type": "object",
      "additionalProperties": false,
      "required": ["public_read", "contributions_enabled"],
      "properties": {
        "public_read": { "type": "boolean" },
        "contributions_enabled": { "type": "boolean" }
      }
    },
    "contact": {
      "type": "object",
      "additionalProperties": false,
      "required": ["email", "scope"],
      "properties": {
        "email": { "type": "string", "format": "email" },
        "scope": { "enum": ["general-ARC-and-IARC-contact"] }
      }
    },
    "representations": {
      "type": "object",
      "additionalProperties": false,
      "required": ["html", "identity", "schema", "agent_route_map", "robots", "sitemap"],
      "properties": {
        "html": { "type": "string", "format": "uri" },
        "identity": { "type": "string", "format": "uri" },
        "schema": { "type": "string", "format": "uri" },
        "agent_route_map": { "type": "string", "format": "uri" },
        "robots": { "type": "string", "format": "uri" },
        "sitemap": { "type": "string", "format": "uri" }
      }
    },
    "machine_readable": {
      "type": "array",
      "uniqueItems": true,
      "items": { "type": "string", "pattern": "^/" },
      "minItems": 5
    },
    "relations": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["type", "target"],
        "properties": {
          "type": { "enum": ["parent-institution", "related-service"] },
          "target": { "type": "string", "format": "uri" },
          "record": { "type": "string", "format": "uri" },
          "health": { "type": "string", "format": "uri" },
          "protocol": { "type": "string", "format": "uri" },
          "role": { "type": "string" },
          "is_knowledge_workspace": { "type": "boolean" }
        },
        "additionalProperties": false
      },
      "minItems": 2
    },
    "extensions": { "type": "object" }
  }
}
