{
  "namespace": "com.pacbio.common.models.reports",
  "type": "record",
  "name": "Report",
  "doc": "PacBio Report data model. Except where specified all `id` values must be of the form [A-z][0-9]_ (e.g., `mapping_stats`)",
  "fields": [
    {
      "name": "id",
      "type": "string",
      "doc": "Pbreports style id, must only have [A-z][0-9]_"
    },
     {
      "name": "version",
      "type": "string",
      "doc": "Version of the Report Schema Spec"
    },
     {
      "name": "uuid",
      "type": "string",
      "doc": "Report UUID"
    },
     {
      "name": "title",
      "type": ["string", "null"],
      "default": null,
      "doc": "Report Display name"
    },
    {
      "name": "attributes",
      "type": {
        "type": "array",
        "items": {
          "type": "record",
          "name": "ReportAttribute",
          "fields": [
            {
              "doc": "Report Attribute id",
              "name": "id",
              "type": "string"
            },
            {
              "doc": "Report Attribute display name",
              "name": "name",
              "type": "string"
            },
            {
              "doc": "Report Attribute value",
              "name": "value",
              "type": [
                "string",
                "int",
                "float"
              ]
            }
          ]
        }
      }
    },
    {
      "name": "plotGroups",
      "type": {
        "type": "array",
        "items": {
          "type": "record",
          "name": "PlotGroup",
          "fields": [
            {
              "doc": "Plot group Id",
              "name": "id",
              "type": "string"
            },
            {
              "doc": "The display name of plot group",
              "name": "title",
              "type": "string"
            },
            {
              "name": "legend",
              "type": [
                "string",
                "null"
              ],
              "doc": "Not clear what the usecase is of this"
            },
            {
              "doc": "Thumbnail image path for the entire PlotGroup",
              "name": "thumbnail",
              "type": [
                "string",
                "null"
              ]
            },
            {
              "doc": "List of Plots",
              "name": "plots",
              "type": {
                "type": "array",
                "items": {
                  "doc": "PacBio Report Plot",
                  "type": "record",
                  "name": "ReportPlot",
                  "fields": [
                    {
                      "name": "id",
                      "type": "string",
                      "doc": "Plot Id"
                    },
                    {
                      "name": "image",
                      "type": "string",
                      "doc": "Png Path to Image (must be relative to the path of report.json file)"
                    },
                     {
                      "name": "title",
                      "type": ["string", "null"],
                      "doc": "Display Name of Plot"
                    },
                    {
                      "name": "caption",
                      "doc": "Caption of the Plot",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    {
                      "name": "thumbnail",
                      "doc": "Relative path to thumbnail of the Plot (must be relative to the path of report.json file)",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    {
                      "name": "plotType",
                      "doc": "Specifies plot type, either `image` or `plotly`",
                      "type": ["string", "null"],
                      "default": "image"
                    },
                    {
                      "name": "plotlyVersion",
                      "doc": "Version of plotly.js used, if type=plotly",
                      "type": ["string", "null"]
                    }
                  ]
                }
              }
            }
          ]
        }
      }
    },
    {
      "name": "tables",
      "type": {
        "type": "array",
        "items": {
          "type": "record",
          "name": "ReportTable",
          "fields": [
            {
              "doc": "Report Table Id",
              "name": "id",
              "type": "string"
            },
            {
              "name": "title",
              "type": "string",
              "doc": "Display name of the Table"
            },
            {
              "name": "columns",
              "doc": "List of Columns",
              "type": {
                "type": "array",
                "items": {
                  "type": "record",
                  "name": "ReportTableColumn",
                  "fields": [
                    {
                      "doc": "Unique id of column (must be report id format style)",
                      "name": "id",
                      "type": "string"
                    },
                    {
                      "doc": "Display name of Column",
                      "name": "header",
                      "type": "string"
                    },
                    {
                      "name": "value",
                      "_comment": "This is a quite unclear interface",
                      "doc": "Column values. Attention to mixed-types attempting to represent 'NA'",
                      "type": {
                        "type": "array",
                        "items": [
                          "int",
                          "float",
                          "string",
                          "null"
                        ]
                      }
                    }
                  ]
                }
              }
            }
          ]
        }
      }
    }
  ]
}
