{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "description": "The form block (input). Reads: in update mode, the row of `table` whose id the address's `?id=` names. Shape: a row with every field's column.",
  "properties": {
    "form": {
      "additionalProperties": false,
      "properties": {
        "fields": {
          "description": "The fields, in order.",
          "items": {
            "additionalProperties": false,
            "properties": {
              "hint": {
                "description": "A line under the field.",
                "maxLength": 200,
                "minLength": 1,
                "type": "string"
              },
              "kind": {
                "default": "text",
                "description": "The field's control.",
                "enum": [
                  "text",
                  "textarea",
                  "number",
                  "date",
                  "email",
                  "password",
                  "select",
                  "switch",
                  "checkbox",
                  "lookup"
                ],
                "type": "string"
              },
              "label": {
                "description": "The field's label.",
                "maxLength": 60,
                "minLength": 1,
                "type": "string"
              },
              "lookup": {
                "additionalProperties": false,
                "description": "A lookup's table and columns (lookup only).",
                "properties": {
                  "label": {
                    "description": "The column a person sees.",
                    "pattern": "^[a-z][a-z0-9_]{0,62}$",
                    "type": "string"
                  },
                  "table": {
                    "description": "The table the choices come from.",
                    "pattern": "^[a-z][a-z0-9_]{0,62}$",
                    "type": "string"
                  },
                  "value": {
                    "description": "The column the field stores.",
                    "pattern": "^[a-z][a-z0-9_]{0,62}$",
                    "type": "string"
                  }
                },
                "required": [
                  "table",
                  "label",
                  "value"
                ],
                "type": "object"
              },
              "max": {
                "description": "The largest value (number) or length (text).",
                "type": "number"
              },
              "min": {
                "description": "The smallest value (number) or length (text).",
                "type": "number"
              },
              "name": {
                "description": "The column the field writes.",
                "pattern": "^[a-z][a-z0-9_]{0,62}$",
                "type": "string"
              },
              "options": {
                "description": "A select's choices (select only).",
                "items": {
                  "type": [
                    "string",
                    "number",
                    "boolean",
                    "null"
                  ]
                },
                "maxItems": 100,
                "minItems": 1,
                "type": "array"
              },
              "pattern": {
                "description": "A regular expression the value must match.",
                "maxLength": 200,
                "minLength": 1,
                "type": "string"
              },
              "required": {
                "default": false,
                "description": "The form refuses an empty value.",
                "type": "boolean"
              }
            },
            "required": [
              "name",
              "label"
            ],
            "type": "object"
          },
          "maxItems": 20,
          "minItems": 1,
          "type": "array"
        },
        "id": {
          "description": "The block's id: its Markdown anchor and its actions' route (`/act/<id>/<action>`). Default `<type>-<n>`, n counting blocks of this type depth-first from 1.",
          "pattern": "^[a-z][a-z0-9-]{1,38}$",
          "type": "string"
        },
        "mode": {
          "default": "insert",
          "description": "insert adds a row; update edits the row `?id=` names.",
          "enum": [
            "insert",
            "update"
          ],
          "type": "string"
        },
        "submit": {
          "additionalProperties": false,
          "description": "The submit button.",
          "properties": {
            "approval": {
              "default": false,
              "description": "Through the confirm page first.",
              "type": "boolean"
            },
            "label": {
              "default": "Save",
              "description": "The button's words.",
              "maxLength": 40,
              "minLength": 1,
              "type": "string"
            },
            "then": {
              "description": "The screen shown after a successful submit; default this one.",
              "pattern": "^[a-z][a-z0-9-]{1,38}$",
              "type": "string"
            }
          },
          "type": "object"
        },
        "table": {
          "description": "The table it writes.",
          "pattern": "^[a-z][a-z0-9_]{0,62}$",
          "type": "string"
        }
      },
      "required": [
        "table",
        "fields"
      ],
      "type": "object"
    }
  },
  "required": [
    "form"
  ],
  "title": "form",
  "type": "object"
}