{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/architectfx/latest.json",
  "title": "ArchitectFX Documents Schema",
  "x-lintel": {
    "source": "https://www.schemastore.org/architectfx.json",
    "sourceSha256": "6fc59b16613d8ee72e046bb41af654dd794b1b24ba8cc8acf8c466b7429e6ae6",
    "fileMatch": [
      "*.jdsl"
    ]
  },
  "type": "object",
  "properties": {
    ".controller": {
      "type": "string",
      "description": "A class which may hold injected fields to handle them"
    },
    ".deps": {
      "type": "array",
      "uniqueItems": true,
      "items": {
        "type": "string",
        "description": "Maven coordinates used for third-party libraries that are needed to load the document"
      }
    },
    ".imports": {
      "type": "array",
      "uniqueItems": true,
      "items": {
        "type": "string",
        "description": "Java imports for resolving commonly used classes in the Document"
      }
    },
    ".config": {
      "type": "array",
      "description": "A series of generic steps to configure global state or specific objects",
      "items": {
        "$ref": "#/$defs/config"
      }
    }
  },
  "$defs": {
    "config": {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            ".field": {
              "type": "string",
              "description": "Field configurations"
            },
            ".value": {
              "description": "Value to be assigned to the field"
            }
          },
          "required": [
            ".field",
            ".value"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            ".method": {
              "type": "string",
              "description": "Name of the method to be invoked"
            },
            ".args": {
              "type": "array",
              "description": "Arguments for the method"
            },
            ".varargs": {
              "type": "array",
              "description": "Specifically to be used for method which use varargs"
            },
            ".transform": {
              "type": "boolean",
              "description": "Indicates whether the output of the method should be used as input for the next config or as the return type"
            }
          },
          "required": [
            ".method"
          ],
          "additionalProperties": false
        }
      ]
    },
    "entity": {
      "description": "Entity or tree node",
      "type": "object",
      "properties": {
        ".args": {
          "type": "array",
          "description": "Arguments for the constructor"
        },
        ".varargs": {
          "type": "array",
          "description": "Specifically to be used for constructors which use varargs"
        },
        ".factory": {
          "type": "array",
          "description": "Allows building this entity through the factory/builder pattern using configs",
          "items": {
            "$ref": "#/$defs/config"
          }
        },
        ".config": {
          "type": "array",
          "description": "A series of generic steps to configure global state or specific objects",
          "items": {
            "$ref": "#/$defs/config"
          }
        },
        "children": {
          "type": "array",
          "description": "Entities may or may not contain other entities inside them",
          "items": {
            "$ref": "#/$defs/entity"
          }
        }
      }
    }
  },
  "patternProperties": {
    "^[A-Za-z_][A-Za-z0-9_]*$": {
      "$ref": "#/$defs/entity"
    }
  }
}
