{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://preparedboard.com/standard/v1/drafts/written-consent.schema.json",
  "title": "prepared-board.written-consent.v1",
  "description": "DRAFT. A board action taken by written consent instead of at a meeting. Nothing is sealed in this format yet. Docs: https://preparedboard.com/standard#drafts",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema",
    "decisionId",
    "boardId",
    "version",
    "title",
    "resolutionText",
    "requiresUnanimous",
    "eligible",
    "signatures",
    "outcome",
    "effectiveAt",
    "evidence"
  ],
  "properties": {
    "schema": {
      "const": "prepared-board.written-consent.v1"
    },
    "decisionId": {
      "type": "string",
      "minLength": 1
    },
    "boardId": {
      "type": "string",
      "minLength": 1
    },
    "version": {
      "type": "integer",
      "minimum": 1
    },
    "title": {
      "type": "string"
    },
    "resolutionText": {
      "type": "string",
      "minLength": 1
    },
    "requiresUnanimous": {
      "type": "boolean"
    },
    "eligible": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1
      },
      "minItems": 1,
      "uniqueItems": true
    },
    "signatures": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "memberId",
          "status",
          "signedAt"
        ],
        "properties": {
          "memberId": {
            "type": "string",
            "minLength": 1
          },
          "status": {
            "enum": [
              "SIGNED",
              "DECLINED",
              "NOT_SIGNED"
            ]
          },
          "signedAt": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "type": "string",
                "format": "date-time"
              }
            ]
          }
        }
      }
    },
    "outcome": {
      "enum": [
        "ADOPTED",
        "FAILED",
        "WITHDRAWN"
      ]
    },
    "effectiveAt": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "type": "string",
          "format": "date-time"
        }
      ]
    },
    "evidence": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "documentId",
          "sha256"
        ],
        "properties": {
          "documentId": {
            "type": "string"
          },
          "sha256": {
            "type": "string",
            "pattern": "^sha256:[0-9a-f]{64}$"
          }
        }
      }
    }
  }
}
