{
  "$id": "https://garphield.com/schemas/state-doc-v1.schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "artifacts": {
      "items": {
        "additionalProperties": false,
        "properties": {
          "artifactId": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          },
          "format": {
            "enum": [
              "gph",
              "png",
              "html",
              "graphml",
              "gexf",
              "gml",
              "node-link",
              "node-csv",
              "edge-csv",
              "analysis-bundle"
            ],
            "type": "string"
          },
          "historyOperationId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "projectFingerprint": {
            "pattern": "^project:v1:sha256:[0-9a-f]{64}$",
            "type": "string"
          },
          "semanticFingerprint": {
            "pattern": "^semantic:v1:sha256:[0-9a-f]{64}$",
            "type": "string"
          },
          "version": {
            "const": 1,
            "type": "number"
          }
        },
        "required": [
          "version",
          "artifactId",
          "format",
          "semanticFingerprint",
          "projectFingerprint",
          "historyOperationId",
          "createdAt"
        ],
        "type": "object"
      },
      "type": "array"
    },
    "bindings": {
      "items": {
        "additionalProperties": false,
        "properties": {
          "channel": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "intensity": {
            "maximum": 1,
            "minimum": 0,
            "type": "number"
          },
          "resultType": {
            "type": "string"
          },
          "source": {
            "additionalProperties": false,
            "properties": {
              "id": {
                "type": "string"
              },
              "kind": {
                "enum": [
                  "algorithm",
                  "field",
                  "transform",
                  "set"
                ],
                "type": "string"
              },
              "params": {
                "additionalProperties": {},
                "propertyNames": {
                  "type": "string"
                },
                "type": "object"
              },
              "target": {
                "enum": [
                  "node",
                  "edge"
                ],
                "type": "string"
              },
              "temporal": {
                "additionalProperties": false,
                "properties": {
                  "kind": {
                    "const": "instant",
                    "type": "string"
                  }
                },
                "required": [
                  "kind"
                ],
                "type": "object"
              }
            },
            "required": [
              "kind",
              "id"
            ],
            "type": "object"
          }
        },
        "required": [
          "channel",
          "source",
          "resultType"
        ],
        "type": "object"
      },
      "type": "array"
    },
    "camera": {
      "anyOf": [
        {
          "additionalProperties": false,
          "properties": {
            "angle": {
              "type": "number"
            },
            "ratio": {
              "type": "number"
            },
            "x": {
              "type": "number"
            },
            "y": {
              "type": "number"
            }
          },
          "required": [
            "x",
            "y",
            "ratio",
            "angle"
          ],
          "type": "object"
        },
        {
          "type": "null"
        }
      ]
    },
    "dataset": {
      "anyOf": [
        {
          "additionalProperties": false,
          "properties": {
            "id": {
              "type": "string"
            },
            "kind": {
              "const": "sample",
              "type": "string"
            }
          },
          "required": [
            "kind",
            "id"
          ],
          "type": "object"
        },
        {
          "additionalProperties": false,
          "properties": {
            "kind": {
              "const": "generator",
              "type": "string"
            },
            "spec": {
              "oneOf": [
                {
                  "additionalProperties": false,
                  "properties": {
                    "n": {
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991,
                      "type": "integer"
                    },
                    "p": {
                      "maximum": 1,
                      "minimum": 0,
                      "type": "number"
                    },
                    "seed": {
                      "maximum": 9007199254740991,
                      "minimum": -9007199254740991,
                      "type": "integer"
                    },
                    "type": {
                      "const": "erdos_renyi",
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "n",
                    "p",
                    "seed"
                  ],
                  "type": "object"
                },
                {
                  "additionalProperties": false,
                  "properties": {
                    "m": {
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991,
                      "type": "integer"
                    },
                    "n": {
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991,
                      "type": "integer"
                    },
                    "seed": {
                      "maximum": 9007199254740991,
                      "minimum": -9007199254740991,
                      "type": "integer"
                    },
                    "type": {
                      "const": "barabasi_albert",
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "n",
                    "m",
                    "seed"
                  ],
                  "type": "object"
                },
                {
                  "additionalProperties": false,
                  "properties": {
                    "k": {
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991,
                      "type": "integer"
                    },
                    "n": {
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991,
                      "type": "integer"
                    },
                    "p": {
                      "maximum": 1,
                      "minimum": 0,
                      "type": "number"
                    },
                    "seed": {
                      "maximum": 9007199254740991,
                      "minimum": -9007199254740991,
                      "type": "integer"
                    },
                    "type": {
                      "const": "watts_strogatz",
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "n",
                    "k",
                    "p",
                    "seed"
                  ],
                  "type": "object"
                },
                {
                  "additionalProperties": false,
                  "properties": {
                    "n": {
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991,
                      "type": "integer"
                    },
                    "type": {
                      "const": "complete",
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "n"
                  ],
                  "type": "object"
                },
                {
                  "additionalProperties": false,
                  "properties": {
                    "n": {
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991,
                      "type": "integer"
                    },
                    "type": {
                      "const": "cycle",
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "n"
                  ],
                  "type": "object"
                },
                {
                  "additionalProperties": false,
                  "properties": {
                    "n": {
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991,
                      "type": "integer"
                    },
                    "type": {
                      "const": "star",
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "n"
                  ],
                  "type": "object"
                },
                {
                  "additionalProperties": false,
                  "properties": {
                    "n": {
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991,
                      "type": "integer"
                    },
                    "type": {
                      "const": "wheel",
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "n"
                  ],
                  "type": "object"
                },
                {
                  "additionalProperties": false,
                  "properties": {
                    "cols": {
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991,
                      "type": "integer"
                    },
                    "rows": {
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991,
                      "type": "integer"
                    },
                    "type": {
                      "const": "grid",
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "rows",
                    "cols"
                  ],
                  "type": "object"
                },
                {
                  "additionalProperties": false,
                  "properties": {
                    "h": {
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991,
                      "type": "integer"
                    },
                    "r": {
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991,
                      "type": "integer"
                    },
                    "type": {
                      "const": "balanced_tree",
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "r",
                    "h"
                  ],
                  "type": "object"
                },
                {
                  "additionalProperties": false,
                  "properties": {
                    "m1": {
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991,
                      "type": "integer"
                    },
                    "m2": {
                      "maximum": 9007199254740991,
                      "minimum": 0,
                      "type": "integer"
                    },
                    "type": {
                      "const": "barbell",
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "m1",
                    "m2"
                  ],
                  "type": "object"
                },
                {
                  "additionalProperties": false,
                  "properties": {
                    "n1": {
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991,
                      "type": "integer"
                    },
                    "n2": {
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991,
                      "type": "integer"
                    },
                    "type": {
                      "const": "complete_bipartite",
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "n1",
                    "n2"
                  ],
                  "type": "object"
                }
              ]
            }
          },
          "required": [
            "kind",
            "spec"
          ],
          "type": "object"
        },
        {
          "additionalProperties": false,
          "properties": {
            "kind": {
              "const": "file",
              "type": "string"
            },
            "name": {
              "type": "string"
            },
            "url": {
              "type": "string"
            }
          },
          "required": [
            "kind"
          ],
          "type": "object"
        }
      ]
    },
    "edgeDirectionStyle": {
      "enum": [
        "line",
        "tapered",
        "arrow",
        "flow"
      ],
      "type": "string"
    },
    "edgeGradient": {
      "type": "boolean"
    },
    "filterStack": {
      "items": {
        "additionalProperties": false,
        "properties": {
          "channel": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "id": {
            "type": "string"
          },
          "mode": {
            "enum": [
              "fade",
              "hide"
            ],
            "type": "string"
          },
          "resultType": {
            "type": "string"
          },
          "source": {
            "additionalProperties": false,
            "properties": {
              "id": {
                "type": "string"
              },
              "kind": {
                "enum": [
                  "algorithm",
                  "field",
                  "transform",
                  "set"
                ],
                "type": "string"
              },
              "params": {
                "additionalProperties": {},
                "propertyNames": {
                  "type": "string"
                },
                "type": "object"
              },
              "target": {
                "enum": [
                  "node",
                  "edge"
                ],
                "type": "string"
              },
              "temporal": {
                "additionalProperties": false,
                "properties": {
                  "kind": {
                    "const": "instant",
                    "type": "string"
                  }
                },
                "required": [
                  "kind"
                ],
                "type": "object"
              }
            },
            "required": [
              "kind",
              "id"
            ],
            "type": "object"
          },
          "state": {
            "anyOf": [
              {
                "additionalProperties": false,
                "properties": {
                  "hi": {
                    "type": "number"
                  },
                  "kind": {
                    "const": "range",
                    "type": "string"
                  },
                  "lo": {
                    "type": "number"
                  }
                },
                "required": [
                  "kind",
                  "lo",
                  "hi"
                ],
                "type": "object"
              },
              {
                "additionalProperties": false,
                "properties": {
                  "active": {
                    "items": {
                      "type": "string"
                    },
                    "type": "array"
                  },
                  "kind": {
                    "const": "categories",
                    "type": "string"
                  }
                },
                "required": [
                  "kind",
                  "active"
                ],
                "type": "object"
              },
              {
                "additionalProperties": false,
                "properties": {
                  "at": {
                    "maximum": 8640000000000000,
                    "minimum": -8640000000000000,
                    "type": "number"
                  },
                  "from": {
                    "maximum": 8640000000000000,
                    "minimum": -8640000000000000,
                    "type": "number"
                  },
                  "includeMissing": {
                    "type": "boolean"
                  },
                  "kind": {
                    "const": "time",
                    "type": "string"
                  }
                },
                "required": [
                  "kind",
                  "at"
                ],
                "type": "object"
              }
            ]
          }
        },
        "required": [
          "id",
          "source",
          "resultType",
          "mode"
        ],
        "type": "object"
      },
      "type": "array"
    },
    "geo": {
      "anyOf": [
        {
          "additionalProperties": false,
          "properties": {
            "lat": {
              "type": "string"
            },
            "lng": {
              "type": "string"
            }
          },
          "required": [
            "lat",
            "lng"
          ],
          "type": "object"
        },
        {
          "type": "null"
        }
      ]
    },
    "labels": {
      "type": "boolean"
    },
    "layout": {
      "enum": [
        "force",
        "levels",
        "geo"
      ],
      "type": "string"
    },
    "levels": {
      "additionalProperties": false,
      "properties": {
        "levelAttribute": {
          "type": "string"
        },
        "roots": {
          "items": {
            "type": "string"
          },
          "type": "array"
        }
      },
      "type": "object"
    },
    "nodeSurfaceStyle": {
      "enum": [
        "flat",
        "lumen",
        "sphere",
        "prism",
        "sketchy"
      ],
      "type": "string"
    },
    "onion": {
      "additionalProperties": false,
      "properties": {
        "context": {
          "enum": [
            "faded",
            "hidden"
          ],
          "type": "string"
        },
        "depth": {
          "oneOf": [
            {
              "additionalProperties": false,
              "properties": {
                "mode": {
                  "const": "auto",
                  "type": "string"
                }
              },
              "required": [
                "mode"
              ],
              "type": "object"
            },
            {
              "additionalProperties": false,
              "properties": {
                "mode": {
                  "const": "manual",
                  "type": "string"
                },
                "ordinal": {
                  "type": "number"
                }
              },
              "required": [
                "mode",
                "ordinal"
              ],
              "type": "object"
            }
          ]
        },
        "preference": {
          "enum": [
            "auto",
            "full",
            "overview"
          ],
          "type": "string"
        },
        "strength": {
          "enum": [
            "backbone",
            "onion"
          ],
          "type": "string"
        }
      },
      "required": [
        "preference",
        "strength",
        "depth",
        "context"
      ],
      "type": "object"
    },
    "panel": {
      "additionalProperties": false,
      "properties": {
        "bottom": {
          "type": "number"
        },
        "bottomOpen": {
          "type": "boolean"
        },
        "floating": {
          "type": "boolean"
        },
        "left": {
          "type": "number"
        },
        "leftOpen": {
          "type": "boolean"
        },
        "right": {
          "type": "number"
        },
        "rightOpen": {
          "type": "boolean"
        }
      },
      "required": [
        "bottomOpen",
        "bottom",
        "floating"
      ],
      "type": "object"
    },
    "positions": {
      "additionalProperties": {
        "items": false,
        "maxItems": 2,
        "minItems": 2,
        "prefixItems": [
          {
            "type": "number"
          },
          {
            "type": "number"
          }
        ],
        "type": "array"
      },
      "propertyNames": {
        "type": "string"
      },
      "type": "object"
    },
    "selection": {
      "additionalProperties": false,
      "properties": {
        "mode": {
          "enum": [
            "pointer",
            "marquee",
            "lasso"
          ],
          "type": "string"
        },
        "primary": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "set": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "target": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "primary",
        "set",
        "target"
      ],
      "type": "object"
    },
    "sets": {
      "items": {
        "additionalProperties": false,
        "properties": {
          "created": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "members": {
            "additionalProperties": false,
            "properties": {
              "edges": {
                "default": [],
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "nodes": {
                "default": [],
                "items": {
                  "type": "string"
                },
                "type": "array"
              }
            },
            "required": [
              "nodes",
              "edges"
            ],
            "type": "object"
          },
          "note": {
            "type": "string"
          },
          "provenance": {
            "additionalProperties": false,
            "properties": {
              "authorKind": {
                "enum": [
                  "human",
                  "agent",
                  "rule"
                ],
                "type": "string"
              },
              "basis": {
                "type": "string"
              },
              "confidence": {
                "maximum": 1,
                "minimum": 0,
                "type": "number"
              },
              "dataVersion": {
                "type": "number"
              },
              "status": {
                "default": "accepted",
                "enum": [
                  "proposed",
                  "accepted",
                  "superseded"
                ],
                "type": "string"
              },
              "supersedes": {
                "type": "string"
              }
            },
            "required": [
              "authorKind",
              "status"
            ],
            "type": "object"
          },
          "visibility": {
            "additionalProperties": false,
            "properties": {
              "hiddenNodes": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              }
            },
            "required": [
              "hiddenNodes"
            ],
            "type": "object"
          }
        },
        "required": [
          "id",
          "label",
          "members",
          "created"
        ],
        "type": "object"
      },
      "type": "array"
    },
    "style": {
      "additionalProperties": false,
      "properties": {
        "arrowSize": {
          "type": "number"
        },
        "curvature": {
          "type": "number"
        },
        "fisheye": {
          "additionalProperties": false,
          "properties": {
            "enabled": {
              "type": "boolean"
            },
            "magnification": {
              "type": "number"
            },
            "radiusScale": {
              "type": "number"
            }
          },
          "required": [
            "enabled",
            "magnification",
            "radiusScale"
          ],
          "type": "object"
        },
        "labelBudget": {
          "type": "number"
        },
        "labelPlacement": {
          "enum": [
            "beside",
            "center"
          ],
          "type": "string"
        },
        "labelSizeAdaptive": {
          "type": "boolean"
        },
        "linkOpacity": {
          "type": "number"
        },
        "linkOutline": {
          "type": "number"
        },
        "linkWidth": {
          "type": "number"
        },
        "nodeGap": {
          "type": "number"
        },
        "nodeSize": {
          "type": "number"
        },
        "nodeSurface": {
          "enum": [
            "flat",
            "lumen",
            "sphere",
            "prism",
            "sketchy"
          ],
          "type": "string"
        }
      },
      "required": [
        "nodeSurface",
        "nodeSize",
        "nodeGap",
        "linkWidth",
        "linkOpacity",
        "curvature",
        "fisheye"
      ],
      "type": "object"
    },
    "tapered": {
      "type": "boolean"
    },
    "theme": {
      "enum": [
        "light",
        "dark",
        "seafoam"
      ],
      "type": "string"
    },
    "v": {
      "const": 1,
      "type": "number"
    }
  },
  "required": [
    "v",
    "dataset",
    "layout",
    "tapered",
    "theme",
    "bindings",
    "filterStack",
    "selection",
    "camera",
    "panel"
  ],
  "type": "object"
}
