{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://hsimc.tech/reality-compute/schemas/contract-network.schema.json",
  "title": "HSIMC Opportunity/Contract Network",
  "type": "object",
  "required": [
    "graph_id",
    "layer",
    "nodes",
    "edges"
  ],
  "properties": {
    "graph_id": {
      "type": "string"
    },
    "layer": {
      "enum": [
        "OPPORTUNITY_GRAPH_NON_BINDING",
        "CONTRACT_CANDIDATE_GRAPH_NON_BINDING",
        "EXECUTABLE_CONTRACT_NETWORK"
      ]
    },
    "nodes": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "type"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "type": {
            "enum": [
              "SUBJECT",
              "REALITY",
              "TASK_ROLE",
              "EPERSON",
              "HUMAN_SUPERVISOR",
              "CAPABILITY",
              "RESOURCE",
              "PLACE",
              "EVIDENCE",
              "ACCEPTANCE",
              "CONTRIBUTION"
            ]
          },
          "state": {
            "type": "string"
          },
          "ref": {
            "type": "string"
          }
        }
      }
    },
    "edges": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "from",
          "to",
          "type",
          "state",
          "provenance",
          "effective_time"
        ],
        "properties": {
          "from": {
            "type": "string"
          },
          "to": {
            "type": "string"
          },
          "type": {
            "enum": [
              "OBSERVED_IN",
              "NEEDS",
              "OFFERS",
              "PROPOSES",
              "DELEGATES",
              "GRANTS_AUTHORITY",
              "SUPERVISES",
              "DEPENDS_ON",
              "COMMITS",
              "ACCEPTS",
              "CONTRIBUTES",
              "SETTLES"
            ]
          },
          "state": {
            "type": "string"
          },
          "provenance": {
            "type": "string"
          },
          "effective_time": {
            "type": "string"
          }
        }
      }
    }
  }
}
