{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:orbiplex:schema:panel-command.local:v1",
  "title": "panel-command.local.v1",
  "description": "Draft local fixture contract. Shape validation confers no admission, mandate, application receipt or normative ELL2 qualification.",
  "x-dia-status": "draft",
  "x-dia-workflow": "project",
  "x-dia-basis": [
    "doc/project/40-proposals/051-swarm-membership-and-reputation-bootstrap.md",
    "doc/normative/50-constitutional-ops/pl/PANEL-SELECTION-PROTOCOL.pl.md"
  ],
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "schema": {
      "const": "panel-command.local.v1"
    },
    "command/id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 256
    },
    "actor/id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 256,
      "pattern": "^participant:did:key:z[1-9A-HJ-NP-Za-km-z]+$"
    },
    "context": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "host/id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256,
          "pattern": "^node:did:key:z[1-9A-HJ-NP-Za-km-z]+$"
        },
        "host/incarnation": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "case": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "id": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "revision": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "digest": {
              "type": "string",
              "pattern": "^sha256:[A-Za-z0-9_-]{43}$"
            }
          },
          "required": [
            "id",
            "revision",
            "digest"
          ]
        },
        "subject/id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256,
          "pattern": "^participant:did:key:z[1-9A-HJ-NP-Za-km-z]+$"
        },
        "object": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "id": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "kind": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            "digest": {
              "type": "string",
              "pattern": "^sha256:[A-Za-z0-9_-]{43}$"
            }
          },
          "required": [
            "id",
            "kind",
            "digest"
          ]
        },
        "policy": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "id": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "revision": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "digest": {
              "type": "string",
              "pattern": "^sha256:[A-Za-z0-9_-]{43}$"
            }
          },
          "required": [
            "id",
            "revision",
            "digest"
          ]
        },
        "decision": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "id": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256
            },
            "revision": {
              "type": "integer",
              "minimum": 1,
              "maximum": 9007199254740991
            },
            "digest": {
              "type": "string",
              "pattern": "^sha256:[A-Za-z0-9_-]{43}$"
            }
          },
          "required": [
            "id",
            "revision",
            "digest"
          ]
        },
        "summary/digest": {
          "type": "string",
          "pattern": "^sha256:[A-Za-z0-9_-]{43}$"
        }
      },
      "required": [
        "host/id",
        "host/incarnation",
        "case",
        "subject/id",
        "object",
        "policy",
        "decision",
        "summary/digest"
      ]
    },
    "procedure": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "revision": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "digest": {
          "type": "string",
          "pattern": "^sha256:[A-Za-z0-9_-]{43}$"
        }
      },
      "required": [
        "id",
        "revision",
        "digest"
      ]
    },
    "panel-policy": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "revision": {
          "type": "integer",
          "minimum": 1,
          "maximum": 9007199254740991
        },
        "digest": {
          "type": "string",
          "pattern": "^sha256:[A-Za-z0-9_-]{43}$"
        }
      },
      "required": [
        "id",
        "revision",
        "digest"
      ]
    },
    "round": {
      "type": "integer",
      "minimum": 1,
      "maximum": 9007199254740991
    },
    "issued-at": {
      "type": "string",
      "format": "date-time",
      "maxLength": 64
    },
    "action": {
      "oneOf": [
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "kind": {
              "const": "open-round"
            },
            "inputs": {
              "$ref": "panel-round-inputs.local.v1.schema.json"
            }
          },
          "required": [
            "kind",
            "inputs"
          ]
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "kind": {
              "const": "resume-round"
            },
            "inputs": {
              "$ref": "panel-round-inputs.local.v1.schema.json"
            }
          },
          "required": [
            "kind",
            "inputs"
          ]
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "kind": {
              "const": "declare-coi"
            },
            "declaration": {
              "$ref": "coi-declaration.v1.schema.json"
            }
          },
          "required": [
            "kind",
            "declaration"
          ]
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "kind": {
              "const": "advance"
            }
          },
          "required": [
            "kind"
          ]
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "kind": {
              "const": "commit"
            },
            "commitment": {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$"
            }
          },
          "required": [
            "kind",
            "commitment"
          ]
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "kind": {
              "const": "reveal"
            },
            "nonce": {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$"
            }
          },
          "required": [
            "kind",
            "nonce"
          ]
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "kind": {
              "const": "draw"
            },
            "proof": {
              "type": "string",
              "pattern": "^[0-9a-f]{160}$"
            }
          },
          "required": [
            "kind",
            "proof"
          ]
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "kind": {
              "const": "veto"
            },
            "participant": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256,
              "pattern": "^participant:did:key:z[1-9A-HJ-NP-Za-km-z]+$"
            },
            "reason": {
              "type": "string",
              "minLength": 1,
              "maxLength": 4096
            }
          },
          "required": [
            "kind",
            "participant",
            "reason"
          ]
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "kind": {
              "const": "recuse"
            },
            "participant": {
              "type": "string",
              "minLength": 1,
              "maxLength": 256,
              "pattern": "^participant:did:key:z[1-9A-HJ-NP-Za-km-z]+$"
            },
            "cause": {
              "type": "string",
              "enum": [
                "voluntary",
                "conflict-of-interest",
                "inactivity"
              ]
            },
            "reason": {
              "type": "string",
              "minLength": 1,
              "maxLength": 4096
            }
          },
          "required": [
            "kind",
            "participant",
            "cause",
            "reason"
          ]
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "kind": {
              "const": "replace"
            }
          },
          "required": [
            "kind"
          ]
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "kind": {
              "const": "propose"
            },
            "proposal": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "composition/revision": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 9007199254740991
                },
                "outcome": {
                  "oneOf": [
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "kind": {
                          "const": "uphold"
                        }
                      },
                      "required": [
                        "kind"
                      ]
                    },
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "kind": {
                          "const": "overturn"
                        },
                        "effects": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 256
                          },
                          "maxItems": 32,
                          "uniqueItems": true,
                          "minItems": 1
                        }
                      },
                      "required": [
                        "kind",
                        "effects"
                      ]
                    },
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "kind": {
                          "const": "remand"
                        },
                        "recipient": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 256,
                          "pattern": "^participant:did:key:z[1-9A-HJ-NP-Za-km-z]+$"
                        }
                      },
                      "required": [
                        "kind",
                        "recipient"
                      ]
                    }
                  ]
                },
                "reason": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 4096
                }
              },
              "required": [
                "id",
                "composition/revision",
                "outcome",
                "reason"
              ]
            }
          },
          "required": [
            "kind",
            "proposal"
          ]
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "kind": {
              "const": "vote"
            },
            "proposal": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 256
                },
                "revision": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 9007199254740991
                },
                "digest": {
                  "type": "string",
                  "pattern": "^sha256:[A-Za-z0-9_-]{43}$"
                }
              },
              "required": [
                "id",
                "revision",
                "digest"
              ]
            },
            "approve": {
              "type": "boolean"
            }
          },
          "required": [
            "kind",
            "proposal",
            "approve"
          ]
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "kind": {
              "const": "conclude"
            }
          },
          "required": [
            "kind"
          ]
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "kind": {
              "const": "inspect"
            }
          },
          "required": [
            "kind"
          ]
        }
      ]
    }
  },
  "required": [
    "schema",
    "command/id",
    "actor/id",
    "context",
    "procedure",
    "panel-policy",
    "round",
    "issued-at",
    "action"
  ]
}
