{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/viridi-parente/main/json-schema/viridi-parente-device-credentials-schema.json",
  "title": "DeviceCredentials",
  "description": "A JSON value representing the device credentials.",
  "x-generated": "2026-10-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/viridi-parente-device-controller-api-openapi.yml#/components/schemas/DeviceCredentials",
  "properties": {
    "id": {
      "$ref": "#/$defs/DeviceCredentialsId",
      "description": "The Id is automatically generated during device creation. Use 'getDeviceCredentialsByDeviceId' to obtain the id based on device id. Use 'updateDeviceCredentials' to update device credentials. ",
      "readOnly": true
    },
    "createdTime": {
      "type": "integer",
      "format": "int64",
      "description": "Timestamp of the device credentials creation, in milliseconds"
    },
    "deviceId": {
      "$ref": "#/$defs/DeviceId",
      "description": "JSON object with the device Id."
    },
    "credentialsType": {
      "type": "string",
      "description": "Type of the credentials",
      "enum": [
        "ACCESS_TOKEN",
        "X509_CERTIFICATE",
        "MQTT_BASIC",
        "LWM2M_CREDENTIALS"
      ]
    },
    "credentialsId": {
      "type": "string",
      "description": "Unique Credentials Id per platform instance. Used to lookup credentials from the database. By default, new access token for your device. Depends on the type of the credentials."
    },
    "credentialsValue": {
      "type": "string",
      "description": "Value of the credentials. Null in case of ACCESS_TOKEN credentials type. Base64 value in case of X509_CERTIFICATE. Complex object in case of MQTT_BASIC and LWM2M_CREDENTIALS"
    }
  },
  "required": [
    "credentialsId",
    "deviceId",
    "id"
  ],
  "$defs": {
    "DeviceCredentialsId": {
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "description": "string"
        }
      },
      "required": [
        "id"
      ]
    },
    "DeviceId": {
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "description": "ID of the entity, time-based UUID v1"
        },
        "entityType": {
          "type": "string",
          "description": "string",
          "enum": [
            "DEVICE"
          ]
        }
      },
      "required": [
        "entityType",
        "id"
      ]
    }
  }
}