{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/airthings/json-schema/airthings-segment-response-enriched-schema.json",
  "title": "SegmentResponse-enriched",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/airthings-segments-api-openapi.yml#/components/schemas/SegmentResponse-enriched",
  "type": "object",
  "properties": {
    "deviceId": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "type": "string",
          "maxLength": 10,
          "minLength": 10
        }
      ]
    },
    "ended": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "type": "string",
          "format": "date-time"
        }
      ]
    },
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "labels": {
      "additionalProperties": {
        "type": "string"
      },
      "type": "object"
    },
    "location": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/$defs/LocationSimpleResponse"
        }
      ]
    },
    "name": {
      "type": "string"
    },
    "spaceId": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "type": "string",
          "format": "uuid",
          "description": "Space ID where the device segment is/was located. It is null for old ended non-space segments"
        }
      ]
    },
    "started": {
      "type": "string",
      "format": "date-time"
    }
  },
  "required": [
    "id",
    "labels",
    "name",
    "started"
  ],
  "$defs": {
    "LocationSimpleResponse": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "name": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "name"
      ]
    }
  }
}