{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://overdeck.local/spec/deck-module.schema.json",
  "title": "deck.module.json",
  "type": "object",
  "additionalProperties": false,
  "required": ["schema_version", "name", "kind"],
  "properties": {
    "schema_version": {
      "type": "integer",
      "const": 1
    },
    "name": {
      "type": "string",
      "pattern": "^[a-z][a-z0-9]*(-[a-z0-9]+)*$"
    },
    "kind": {
      "type": "string",
      "enum": ["service", "cli", "config", "library"]
    },
    "services": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "bootstrap": {
      "type": "string"
    },
    "health": {
      "type": "string"
    },
    "install": {
      "type": "object",
      "additionalProperties": false,
      "required": ["mode", "needs_git"],
      "properties": {
        "mode": {
          "type": "string",
          "enum": ["in-place", "artifact"]
        },
        "needs_git": {
          "type": "boolean"
        }
      }
    },
    "state_dirs": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "system_units": { "$ref": "#/definitions/rootPaths" },
    "system_user_root": { "$ref": "#/definitions/rootPaths" },
    "system_bin": { "$ref": "#/definitions/rootPaths" },
    "system_sbin": { "$ref": "#/definitions/rootPaths" }
  },
  "definitions": {
    "rootPaths": {
      "description": "Module-relative directories this module opts into installing as root-owned content. Undeclared directories are never installed.",
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1
      }
    }
  }
}
