{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/proactions-ai-kit-configuration-for-steps/_shared/latest--partial-step.form.schema.json",
  "title": "ProActions AI-Kit Form Schema",
  "description": "Schema for FORM step and form components in ProActions AI-Kit",
  "x-lintel": {
    "source": "https://raw.githubusercontent.com/em-al-wi/proactions-schema/main/schema/partial-step.form.schema.json",
    "sourceSha256": "32e3957c1849a431fc167c97c9409f100d14a7ef927fe897bceda1cb8a293c56"
  },
  "$defs": {
    "formComponent": {
      "type": "object",
      "required": [
        "type"
      ],
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "text",
            "password",
            "select",
            "radio",
            "checkbox",
            "date",
            "datetime",
            "range",
            "color",
            "textarea",
            "number",
            "file",
            "headline",
            "hr",
            "html",
            "diff",
            "markdown"
          ],
          "description": "Type of form component"
        },
        "label": {
          "type": "string",
          "description": "Label for the field"
        },
        "placeholder": {
          "type": "string",
          "description": "Placeholder text for input fields"
        },
        "options": {
          "description": "Options for select, radio components",
          "oneOf": [
            {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "description": "The key for the option"
                  },
                  "value": {
                    "type": "string",
                    "description": "The value for the option"
                  }
                },
                "required": [
                  "key",
                  "value"
                ]
              }
            }
          ]
        },
        "default": {
          "type": [
            "string",
            "boolean",
            "number"
          ],
          "description": "Default value for the field"
        },
        "required": {
          "type": "boolean",
          "description": "Whether the field is required"
        },
        "multiple": {
          "type": "boolean",
          "description": "Whether multiple selection is allowed (for select and file inputs)"
        },
        "requiredMessage": {
          "type": "string",
          "description": "Custom message to display if required field is empty"
        },
        "min": {
          "type": "number",
          "description": "Minimum value for number inputs"
        },
        "max": {
          "type": "number",
          "description": "Maximum value for number inputs"
        },
        "step": {
          "type": "number",
          "description": "Step size for the range input"
        },
        "validation": {
          "type": "object",
          "description": "Validation rules for the field",
          "properties": {
            "pattern": {
              "type": "string",
              "description": "Regular expression pattern for validation"
            },
            "errorMessage": {
              "type": "string",
              "description": "Error message to display when validation fails"
            }
          }
        },
        "tooltip": {
          "type": "string",
          "description": "Tooltip text for the field"
        },
        "visibleIf": {
          "type": "object",
          "description": "Conditional visibility rules for the field",
          "additionalProperties": {
            "type": [
              "string",
              "number",
              "boolean"
            ]
          }
        },
        "accept": {
          "type": "string",
          "description": "Accepted file types for file input"
        },
        "maxSize": {
          "type": "number",
          "description": "Maximum file size in bytes for file input"
        },
        "maxSizeMessage": {
          "type": "string",
          "description": "Error message for file size exceeding maxSize"
        },
        "text": {
          "type": "string",
          "description": "Text content for headline, markdown, or diff components"
        },
        "html": {
          "type": "string",
          "description": "HTML content for html component"
        },
        "prevText": {
          "type": "string",
          "description": "Previous text for diff component"
        },
        "showDeletions": {
          "type": "boolean",
          "description": "Whether to show deletions in diff component"
        },
        "mode": {
          "type": "string",
          "enum": [
            "chars",
            "words",
            "lines",
            "sentences"
          ],
          "description": "Mode for diff component"
        },
        "interactive": {
          "type": "boolean",
          "description": "Interactive mode for diff component"
        }
      }
    },
    "formGroup": {
      "type": "object",
      "required": [
        "label",
        "fields"
      ],
      "properties": {
        "label": {
          "type": "string",
          "description": "Label for the field group"
        },
        "fields": {
          "type": "object",
          "description": "Fields in the group",
          "additionalProperties": {
            "$ref": "#/$defs/formComponent"
          }
        }
      }
    }
  }
}
