{
  "$schema": "http://json-schema.org/schema",
  "$id": "ndc-module",
  "title": "NDC Module",
  "type": "object",
  "properties": {
    "name": {
      "description": "The name of the component",
      "type": "string"
    },
    "filename": {
      "description": "Where is the excel file",
      "type": "string",
      "format": "path",
      "x-prompt": "Where is the excel file :",
      "default": "ndc.xlsx"
    },
    "page": {
      "description": "Page name",
      "type": "string"
    },
    "apiConfig": {
      "description": "Whether to let some variable empty or not",
      "type": "boolean",
      "default": false
    },
    "partial": {
      "description": "Whether the page is part of a group",
      "type": "boolean",
      "default": false
    },
    "noteName": {
      "description": "The note name, use for pages other than the first one and not in a group",
      "type": "string"
    },
    "groupName": {
      "description": "The group name, use this flag when --partial is used",
      "type": "string"
    },
    "group": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "An array of pages to group",
      "default": []
    },
    "version": {
      "description": "Version of the note",
      "type": "string",
      "default": "NOTE_VERSION"
    },
    "update": {
      "description": "Date",
      "type": "string"
    },
    "exportPrefix": {
      "description": "Prefix for the export",
      "type": "string",
      "default": "AppName"
    },
    "slave": {
      "description": "Whether or not page can add case",
      "type": "boolean",
      "default": false
    }
  },
  "allOf": [
    {
      "if": {
        "properties": { "group": { "type": "array" }},
        "required": ["group"]
      },
      "then": {"properties": {"groupName": {"type": "string", "description": "--group-name property required if group is provided"}},
        "required": ["groupName"]
      }
    },
    {
      "if": {
        "properties": { "partial": { "const": true } },
        "required": ["partial"]
      },
      "then": {
        "required": ["groupName", "page"]
      }
    },
    {
      "if": {
        "properties": { "slave": { "const": false } },
        "required": ["slave"]
      },
      "then": {
        "required": ["exportPrefix", "version"]
      }
    },
    {
      "if": {
        "properties": { "page": { "type": "string" } },
        "required": ["page"]
      },
      "then": {
        "required": ["apiConfig"]
      }
    }
  ],
  "required": ["name"]
}