{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/vpsnet-com/json-schema/vpsnet-com-bare-metal-service-view-schema.json",
  "title": "BareMetalServiceView",
  "description": "Partial. A classic server without bare-metal registration has only registered (false), controlPlane (legacy) and capabilities.",
  "x-generated": "2026-11-28",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/vpsnet-com-openapi.yml#/components/schemas/BareMetalServiceView",
  "type": "object",
  "required": [
    "registered",
    "controlPlane",
    "capabilities"
  ],
  "properties": {
    "registered": {
      "type": "boolean"
    },
    "controlPlane": {
      "type": "string",
      "description": "managed for platform-managed servers; legacy otherwise."
    },
    "product": {
      "type": "string",
      "enum": [
        "ds",
        "colo"
      ]
    },
    "observationOnly": {
      "type": "boolean",
      "description": "Always false; kept for older clients."
    },
    "deliveryVerified": {
      "type": "boolean",
      "description": "True only when installed-system delivery was verified."
    },
    "state": {
      "type": "string",
      "enum": [
        "reserved",
        "preparing",
        "delivered",
        "needs_attention"
      ]
    },
    "hardware": {
      "type": "object",
      "additionalProperties": true,
      "properties": {
        "model": {
          "type": [
            "string",
            "null"
          ]
        },
        "formFactor": {
          "type": [
            "string",
            "null"
          ]
        },
        "cpu": {
          "type": [
            "string",
            "null"
          ]
        },
        "cpuCount": {
          "type": [
            "number",
            "null"
          ]
        },
        "memoryGb": {
          "type": [
            "number",
            "null"
          ]
        },
        "storage": {
          "type": [
            "string",
            "null"
          ]
        },
        "storageKey": {
          "type": [
            "string",
            "null"
          ]
        },
        "network": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "power": {
      "type": "object",
      "additionalProperties": true,
      "properties": {
        "state": {
          "type": "string",
          "description": "on or off for a fresh controller reading, otherwise unknown."
        },
        "source": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "bmc",
            null
          ]
        },
        "lastKnown": {
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "state": {
              "type": "string"
            },
            "observedAt": {
              "type": "string",
              "format": "date-time"
            },
            "ageSeconds": {
              "type": "integer"
            }
          }
        },
        "observedAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "stale": {
          "type": "boolean"
        },
        "watts": {
          "type": [
            "number",
            "null"
          ]
        }
      }
    },
    "capabilities": {
      "type": "object",
      "description": "Effective capability per action (power, console, reinstall, rescue, attachIso, isoUpload, reboot, ejectIso, exitRescue, bootFromCd, telemetry).",
      "additionalProperties": {
        "type": "boolean"
      }
    },
    "availability": {
      "type": "object",
      "description": "Typed availability per action (power and every day-2 control).",
      "additionalProperties": {
        "$ref": "#/$defs/BareMetalAvailability"
      }
    },
    "media": {
      "type": "array",
      "description": "Selectable catalogue and uploaded media; mediaId values for rescue and attachIso.",
      "items": {
        "type": "object",
        "additionalProperties": true
      }
    },
    "mediaMount": {
      "type": "object",
      "additionalProperties": true,
      "properties": {
        "runningFrom": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "rescue",
            "cd",
            null
          ],
          "description": "What the server was last started from, from settled successful requests only."
        }
      }
    },
    "facts": {
      "type": "object",
      "additionalProperties": true,
      "properties": {
        "source": {
          "type": "string",
          "enum": [
            "installation",
            "catalogue"
          ]
        },
        "asOrdered": {
          "type": "boolean"
        }
      }
    },
    "customerNetwork": {
      "type": "object",
      "additionalProperties": true
    },
    "networkFacts": {
      "type": "object",
      "additionalProperties": true
    },
    "provisionIssue": {
      "type": "object",
      "additionalProperties": true
    },
    "fulfillment": {
      "type": "object",
      "additionalProperties": true
    },
    "reinstall": {
      "type": "object",
      "additionalProperties": true
    },
    "day2": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": true,
      "description": "Active day-2 or console ticket (BareMetalDay2Ticket shape), or null."
    },
    "consoleSession": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": true,
      "description": "Active console ticket (BareMetalDay2Ticket shape), or null."
    },
    "day2Operation": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": true,
      "description": "Active non-console day-2 ticket (BareMetalDay2Ticket shape), or null."
    },
    "operation": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": true,
      "description": "Active power operation (BareMetalPowerOperation shape), or null."
    },
    "actionHistory": {
      "type": "array",
      "maxItems": 20,
      "items": {
        "$ref": "#/$defs/BareMetalActionReceipt"
      }
    }
  },
  "$defs": {
    "BareMetalActionReceipt": {
      "type": "object",
      "required": [
        "id",
        "action",
        "state",
        "createdAt",
        "completedAt"
      ],
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "action": {
          "type": "string",
          "description": "A day-2 action or a power operation action (power_on, power_off, provision)."
        },
        "state": {
          "type": "string"
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "completedAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        }
      }
    },
    "BareMetalAvailability": {
      "type": "object",
      "required": [
        "available",
        "reason"
      ],
      "properties": {
        "available": {
          "type": "boolean"
        },
        "reason": {
          "type": [
            "string",
            "null"
          ],
          "description": "Null when available. Otherwise one of baremetalPowerNotReady, baremetalObservationStale, baremetalPowerBindingUnqualified, baremetalAllocationChanged, baremetalOperationInProgress, baremetalDay2InProgress, baremetalDay2NotReady, baremetalReinstallNotQualified, baremetalReinstallDisabled, baremetalReinstallNoFulfillment, baremetalReinstallNoQualifiedStock, baremetalReinstallBmcUnsupported, baremetalMediaUnavailable, baremetalLabTargetRequired, baremetal_in_use_no_destructive, baremetalControlNotProvided."
        }
      }
    }
  }
}