{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  
  "title" : "Clinical data template to create a listing",
  
  "description" : "This report displays a listing of the variables and data of interest, displayed in an interactive table. This table can contains comparison with a previous batch ('comparisonTable' parameters).",
  
  "type": "object",
  
  "properties": {
  
    "template": {
      "const": "listingTemplate.Rmd",
      "doc": "name of the template report"
    },
    "templatePackage": {
      "const": "clinDataReview",
      "doc": "package from which the template should be extracted"
     },
    "reportTitle": {
      "type": "string",
      "doc": "header title"
    },
    "reportTitleLevel": {
      "type": "integer",
      "doc": "header level, 1 by default (1: 'chapter', '2': 'section', '3': subsection, ...)"
    },
    "parallel": {
      "type": "boolean",
      "doc": "does this chapter use parallel execution? If the entire report is run in parallel, this ensures that this specific chapter is created outside of the report parallelization."
    },
    "split_by": {
      "oneOf": [
        {"type": "integer", "minimum": 0, "maximum": 7},
        {"type": "string", "enum": ["none", "chapter", "section"]}
      ],
      "doc": "split the chapter at the specified level: 1 (for 'chapter'), 2 (for 'section') until 7. This overwrites the 'split_by' parameter defined in the output format of the report."
    },
    
    "dataFileName" : {
      "type": ["string", "array"],
      "doc": "name of the data file(s) of interest. If multiple files are specified, the data are combined by rows ('row bind'), with a column: 'DATASET' containing the name of the file (in upper case and without extension) the data originate from."
    },
    "dataProcessing": {
      "type": "array",
      "doc": "data processing parameters, passed to \\link[clinDataReview]{processData}"
    },
    "dataTotalFileName": {
      "type": "string",
      "doc": "filename of the total dataset"
    },
    "dataTotalProcessing": {
      "type": "array",
      "doc": "data processing parameters for 'dataTotalFileName', passed to \\link[clinDataReview]{processData}"
    },
    "tableParams": {
      "type": "object",
      "doc": "parameters to create the table, passed to \\link[clinDataReview]{tableClinData}"
    },
    "comparisonTableType": {
      "type": "string",
      "doc": "output type of the comparison table",
      "enum": ["none", "newData-diff-interactive", "table-comparison-interactive"]
    },
    "comparisonTableParams": {
      "type": "object",
      "doc": "parameters for the comparison table, passed to \\link[clinUtils]{compareTables}"
    },
    "loopingVar": {
      "type": ["array", "string"],
      "doc": "data variable(s) to loop over. Each group of the variable(s) is displayed in a separated section of the report."
    },
    "loopingNMax": {
      "type": "integer",
      "doc": "maximum number of elements of \\code{loopingVar} to include in the report"
    },
    "listingDocx": {
      "type": "boolean",
      "doc": "export listing to Word"
    }
  },
  
  "required": ["template", "templatePackage", "reportTitle", "dataFileName"],
  
/*   doesn't allow extra parameters in the config files */
  "additionalProperties": false 
  
}
