{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://openeik.org/schemas/0.4/drawings/signoff-predicate.schema.json",
  "$comment": "OpenEik 0.2: folded by tools/fold-schemas.mjs from the proposal drawings, which 0.2 makes a rule (decision D5). Written by hand from the text, not generated.",
  "title": "Sign-off predicate",
  "description": "The predicate of a sign-off statement, https://openeik.org/attestation/drawing-signoff/v0.1 (Part XIV, 14.1): the revision signed, its status, what the signer did and in which role, the model it was drawn from, and when, by the signer's own clock (the time-stamp is the trusted time). A decision is a code of the profile's decisions; a withdrawal names the sign-off file it withdraws by its hash; a tool's check names the result manifest that holds what it found.",
  "type": "object",
  "properties": {
    "drawing": {
      "$ref": "defs.schema.json#/$defs/number"
    },
    "sequence": {
      "type": "integer",
      "minimum": 1
    },
    "revision": {
      "$ref": "defs.schema.json#/$defs/revisionCode"
    },
    "status": {
      "$ref": "defs.schema.json#/$defs/status"
    },
    "action": {
      "$ref": "defs.schema.json#/$defs/action"
    },
    "role": {
      "description": "The role in which the signer acts (approver).",
      "$ref": "defs.schema.json#/$defs/role"
    },
    "signer": {
      "$ref": "defs.schema.json#/$defs/person"
    },
    "model": {
      "description": "The derivation's source: its version and root.",
      "type": "object",
      "properties": {
        "version": {
          "$ref": "defs.schema.json#/$defs/version"
        },
        "root": {
          "$ref": "defs.schema.json#/$defs/hash"
        }
      },
      "required": [
        "version",
        "root"
      ],
      "x-eik-closed": true
    },
    "at": {
      "$ref": "defs.schema.json#/$defs/time"
    },
    "decision": {
      "$ref": "defs.schema.json#/$defs/code"
    },
    "review": {
      "description": "The closed review round the sign-off concludes, by its id and its hash.",
      "type": "object",
      "properties": {
        "id": {
          "$ref": "defs.schema.json#/$defs/id"
        },
        "hash": {
          "$ref": "defs.schema.json#/$defs/hash"
        }
      },
      "required": [
        "id",
        "hash"
      ],
      "x-eik-closed": true
    },
    "withdraws": {
      "description": "For withdrawn: the hash of the sign-off file it withdraws.",
      "$ref": "defs.schema.json#/$defs/hash"
    },
    "evidence": {
      "description": "For checkedByTool: the path and hash of a result manifest (Part VI, 8) holding what the tool found.",
      "type": "object",
      "properties": {
        "path": {
          "type": "string",
          "minLength": 1,
          "maxLength": 1000
        },
        "hash": {
          "$ref": "defs.schema.json#/$defs/hash"
        }
      },
      "required": [
        "path",
        "hash"
      ],
      "x-eik-closed": true
    }
  },
  "required": [
    "drawing",
    "sequence",
    "revision",
    "status",
    "action",
    "role",
    "signer",
    "model",
    "at"
  ],
  "allOf": [
    {
      "if": {
        "properties": {
          "action": {
            "const": "withdrawn"
          }
        },
        "required": [
          "action"
        ]
      },
      "then": {
        "required": [
          "withdraws"
        ]
      }
    }
  ],
  "x-eik-closed": true
}
