{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "consoleTokens.schema.json",
  "title": "OutputTokens",
  "description": "Schema for the game console definitions used to map DAT names to output tokens and file extensions",
  "type": "object",
  "required": ["version", "consoles"],
  "additionalProperties": false,
  "properties": {
    "$schema": {
      "type": "string"
    },
    "version": {
      "type": "integer",
      "minimum": 1
    },
    "consoles": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/console"
      }
    }
  },
  "$defs": {
    "console": {
      "type": "object",
      "required": ["datNameRegex", "extensions", "tokens"],
      "additionalProperties": false,
      "properties": {
        "datNameRegex": {
          "type": "string",
          "description": "A JavaScript regex literal string (e.g. \"/pattern/i\") matched against DAT names to identify the console",
          "pattern": "^/.+/[gimsuy]*$"
        },
        "extensions": {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^\\.[a-zA-Z0-9]+$"
          }
        },
        "tokens": {
          "$ref": "#/$defs/tokens"
        }
      }
    },
    "tokens": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "adam": {
          "type": "string",
          "description": "Adam image ROM subdirectory /ROMS/{adam}, as defined by https://github.com/eduardofilo/RG350_adam_image/wiki/En:-3.-Content-installation#roms"
        },
        "batocera": {
          "type": "string",
          "description": "Batocera ROM subdirectory roms/{batocera}, as defined by https://wiki.batocera.org/systems"
        },
        "crossmix": {
          "type": "string",
          "description": "CrossMix-OS ROM subdirectory /Roms/{crossmix}, as defined by https://github.com/cizia64/CrossMix-OS/wiki/Emulators"
        },
        "es": {
          "type": "string",
          "description": "EmulationStation ROM subdirectory roms/{emulationstation}, as defined by https://gitlab.com/es-de/emulationstation-de/-/raw/master/resources/systems/linux/es_systems.xml"
        },
        "funkeyos": {
          "type": "string",
          "description": "FunKey S ROM subdirectory /mnt/{funkeyos}, as defined by https://doc.funkey-project.com/developer_guide/software_reference/sd_card_layout/directory_structure/"
        },
        "minui": {
          "type": "string",
          "description": "MinUI ROM subdirectory /Roms/{minui}, as defined by the subdirectories of https://github.com/shauninman/MinUI/tree/main/skeleton/BASE/Roms and https://github.com/shauninman/MinUI/tree/main/skeleton/EXTRAS/Roms"
        },
        "mister": {
          "type": "string",
          "description": "MiSTer ROM subdirectory /games/{mister}, as defined by https://mister-devel.github.io/MkDocs_MiSTer/cores/console/ and https://mister-devel.github.io/MkDocs_MiSTer/cores/computer/ and https://mister-devel.github.io/MkDocs_MiSTer/cores/other/"
        },
        "miyoocfw": {
          "type": "string",
          "description": "MiyooCFW ROM subdirectory /roms/{miyoocfw}, as defined by https://github.com/TriForceX/MiyooCFW/wiki/Emulator-Info"
        },
        "onion": {
          "type": "string",
          "description": "OnionOS/GarlicOS ROM subdirectory /Roms/{onion}, as defined by https://onionui.github.io/docs/emulators/folders"
        },
        "pocket": {
          "type": "string",
          "description": "Analogue Pocket ROM subdirectory /Assets/{pocket}/common"
        },
        "retrodeck": {
          "type": "string",
          "description": "RetroDECK ROM subdirectory /roms/{retrodeck}"
        },
        "rocknix": {
          "type": "string",
          "description": "ROCKNIX ROM subdirectory /roms/{rocknix}"
        },
        "romm": {
          "type": "string",
          "description": "RomM ROM subdirectory /romm/library/{romm}, as defined by https://docs.romm.app/latest/Platforms-and-Players/Supported-Platforms/"
        },
        "spruce": {
          "type": "string",
          "description": "SpruceOS ROM subdirectory /Roms/{spruce}, as defined by https://github.com/spruceUI/spruceOS/wiki/11.-Adding-Games#rom-folder-chart"
        },
        "twmenu": {
          "type": "string",
          "description": "TWiLightMenu++ ROM subdirectory /roms/{twmenu}"
        }
      }
    }
  }
}
