{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://reqview.com/schemas/2.7/config.json",
  "title": "ReqView Project Configuration File",

  "type": "object",
  "properties": {
    "id": {
      "description": "A unique project identifier; must be a valid filename",
      "$ref": "common.json#/definitions/fileName"
    },
    "documents": {
      "description": "Array of document filenames",
      "type": "array",
      "minItems": 1,
      "uniqueItems": true,
      "items": {
        "description": "Array of valid filenames with .json extension",
        "type": "string",
        "pattern": "^[^\\<\\>\\:\\\"\\/\\\\\\|\\?\\*]+\\.[Jj][Ss][Oo][Nn]$"
      }
    },
    "lastChangedOn": { "$ref": "common.json#/definitions/timeStamp" },
    "traceability": { "$ref": "#/definitions/traceability" },
    "metadata": { "$ref": "#/definitions/metadata" }
  },

  "required": ["id", "documents", "metadata"],

  "definitions": {
    "metadata": {
      "description": "Project file metadata storing information about the data format version, encryption, etc.",
      "type": "object",
      "properties": {
        "format": {
          "description": "Data format version string",
          "$ref": "common.json#/definitions/nonEmptyString"
        },
        "saveHistory": {
          "description": "Set to true for projects keeping the history of document object changes",
          "type": "boolean"
        },
        "template": {
          "description": "Set for project or document templates",
          "type": "string",
          "enum": ["project", "document"]
        },
        "cipher": {
          "description": "For encrypted files stores the cipher name",
          "const": "aes-256-cbc"
        },
        "iv": {
          "description": "For encrypted files stores the initialization vector",
          "type": "string",
          "pattern": "^[0-9A-Fa-f]{32,}$"
        },
        "salt": {
          "description": "For encrypted files stores the decryption parameter",
          "$ref": "common.json#/definitions/nonEmptyString"
        }
      },
      "required": ["format"]
    },
    "traceability": {
      "description": "Configuration of project traceability links; properties of this object are identifiers of link types",
      "type": "object",
      "additionalProperties": {
        "type": "object",
        "properties": {
          "name": {
            "description": "Link type name",
            "type": "string",
            "examples": ["Reference"]
          },
          "source": {
            "description": "Short text describing the role of the link source",
            "type": "string",
            "examples": ["References"]
          },
          "target": {
            "description": "Short text describing the role of the link target",
            "type": "string",
            "examples": ["Referenced by"]
          },
          "suspect": {
            "type": "array",
            "minItems": 1,
            "uniqueItems": true,
            "items": { "$ref": "common.json#/definitions/nonEmptyString" }
          }
        }
      }
    }
  }
}
