{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://heartcortex.ai/schemas/1.0/lifecycle.schema.json",
  "title": "lifecycle",
  "type": "object",
  "required": [
    "phase"
  ],
  "properties": {
    "phase": {
      "enum": [
        "provisioning",
        "starting",
        "running",
        "maintenance",
        "sleeping",
        "stopping",
        "decommissioned"
      ],
      "x-heart-privacy": "public",
      "description": "provisioning: not yet claimed by an owner. starting: booting. running: doing its main job. maintenance: in a maintenance window or maintenance-on; requiresMaintenance guards pass. sleeping: low power, reachable again at the time stated in the sleep Action. stopping: shutting down. decommissioned: permanently out of service."
    },
    "allowed": {
      "type": "array",
      "items": {
        "anyOf": [
          {
            "enum": [
              "restart",
              "shutdown",
              "sleep",
              "wake",
              "drain",
              "reload",
              "power-cycle",
              "safe-mode",
              "maintenance-on",
              "maintenance-off",
              "reset-config",
              "reset-network",
              "clear-data",
              "factory-reset",
              "decommission"
            ]
          },
          {
            "type": "string",
            "pattern": "^x-[a-z0-9][a-z0-9-]*$"
          }
        ]
      },
      "x-heart-privacy": "internal",
      "description": "Lifecycle operations allowed from this phase, such as restart or maintenance-on."
    },
    "since": {
      "$ref": "common.schema.json#/$defs/timestamp",
      "x-heart-privacy": "internal"
    },
    "maintenanceUntil": {
      "$ref": "common.schema.json#/$defs/timestamp",
      "x-heart-privacy": "internal",
      "description": "When maintenance ends by itself (D29). Present only in phase maintenance."
    },
    "wakeSources": {
      "type": "array",
      "uniqueItems": true,
      "items": {
        "enum": [
          "timer",
          "button",
          "local",
          "wake-on-lan",
          "mqtt",
          "radio-pass",
          "none"
        ]
      },
      "x-heart-privacy": "internal",
      "description": "What can wake this system from sleep or shutdown; the same as card.lifecycle.wakeSources."
    },
    "ext": {
      "$ref": "common.schema.json#/$defs/ext",
      "x-heart-privacy": "private"
    }
  }
}
