{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://json.schemastore.org/img-catapult-psp-1.0.0.json",
  "$defs": {
    "supportPackFile": {
      "description": "File within support pack",
      "type": "object",
      "additionalProperties": false,
      "required": ["builtin", "path"],
      "properties": {
        "builtin": {
          "description": "builtin=\"true\" means that a file path is relative to the platform directory within the SDK installation.builtin=\"false\" means the file path is relative to the top level of the unzipped package",
          "type": "boolean"
        },
        "path": {
          "description": "file path within zip file",
          "type": "string"
        }
      }
    },
    "supportPackDirectory": {
      "description": "Directory within support pack",
      "type": "object",
      "additionalProperties": false,
      "required": ["path"],
      "properties": {
        "path": {
          "description": "directory path within zip file",
          "type": "string"
        }
      }
    }
  },
  "additionalProperties": false,
  "description": "Used to validate Catapult Platform Support Pack (PSP) contents.yaml file, which provides an index of the files within the PSP",
  "properties": {
    "platform": {
      "description": "Catapult platform support file contents",
      "type": "object",
      "additionalProperties": false,
      "required": [
        "vendor",
        "name",
        "description",
        "buildConfig",
        "version",
        "license",
        "documentationFile",
        "coreDescriptionFile",
        "launchConfig"
      ],
      "properties": {
        "vendor": {
          "type": "string",
          "description": "Platform/device vendor name"
        },
        "name": {
          "type": "string",
          "description": "Name of platform - used to identify platform in IDE",
          "maxLength": 30
        },
        "description": {
          "type": "string",
          "description": "Full description of support pack"
        },
        "buildConfig": {
          "type": "string",
          "description": "Value of the PLATFORM macro definition used during build",
          "pattern": "^([A-Z]|[0-9]|_)+$"
        },
        "version": {
          "type": "string",
          "description": "Support pack version"
        },
        "license": {
          "type": "string",
          "description": "License text"
        },
        "documentationFile": {
          "$ref": "#/$defs/supportPackFile",
          "description": "Documentation file(s) - can be HTML or PDF"
        },
        "coreDescriptionFile": {
          "$ref": "#/$defs/supportPackFile",
          "description": "File containing description of core using IMG proprietary YAML format"
        },
        "peripheralRegisterDescriptionFile": {
          "$ref": "#/$defs/supportPackFile",
          "description": "File containing peripheral register information using CMSIS SVD XML format (see https://www.keil.com/pack/doc/CMSIS/SVD/html/svd_Format_pg.html)"
        },
        "openOCDConfigurationFile": {
          "$ref": "#/$defs/supportPackFile",
          "description": "File containing OpenOCD configuration (see https://openocd.org/doc-release/html/Config-File-Guidelines.html#Config-File-Guidelines)"
        },
        "launchConfig": {
          "type": "string",
          "description": "Launch configuration for platform",
          "pattern": "^(Alpine Model|Catapult Model|OpenOCD|Whisper|RemoteLinux)$"
        },
        "gdbAutoRunCommandString": {
          "type": "string",
          "description": "String with additional gdb commands to run to initiate connection to target"
        },
        "networkPortNumberForOCDConnections": {
          "type": "string",
          "description": "TCP/IP port number for OpenOCD connections.  Set to \"auto\" to automatically use any free port"
        },
        "isPlatformFPGA": {
          "type": "boolean",
          "description": "True only for FPGA platforms"
        },
        "fpgaBitFile": {
          "$ref": "#/$defs/supportPackFile",
          "description": "Bitfile for programming FPGA"
        },
        "fpgaProgConfigFile": {
          "$ref": "#/$defs/supportPackFile",
          "description": "OpenOCD config file for programming FPGA"
        },
        "traceSettingsString": {
          "type": "string",
          "description": "String with processor trace encoder settings required by the decoder"
        },
        "libsDirectory": {
          "$ref": "#/$defs/supportPackDirectory",
          "description": "Directory containing library files for use with the platform"
        },
        "headersDirectory": {
          "$ref": "#/$defs/supportPackDirectory",
          "description": "Directory containing header files for use with the platform"
        },
        "remoteHost": {
          "type": "string",
          "description": "Hostname or IP address for debug connection to remote machines"
        },
        "remoteUsername": {
          "type": "string",
          "description": "Username for debug connection to remote machines"
        }
      }
    }
  },
  "required": ["platform"],
  "title": "JSON schema for Catapult PSP contents.yaml files",
  "type": "object"
}
