{
  "openapi": "3.0.1",
  "info": {
    "description": "Specification of the Onboarding events API.",
    "title": "Machine Onboarding Events",
    "version": "1.0"
  },
  "externalDocs": {
    "description": "Trackunit Developer Hub",
    "url": "https://developers.trackunit.com/"
  },
  "servers": [
    {
      "url": "https://iris.trackunit.com/public/api/onboarding-events",
      "description": "Production"
    }
  ],
  "security": [
    {
      "authorizationBearer": []
    }
  ],
  "paths": {
    "/events": {
      "get": {
        "operationId": "getEvents",
        "parameters": [
          {
            "in": "query",
            "name": "serialNumber",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "timestamp",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/EventsRepresentation"
                }
              }
            },
            "description": "successful operation"
          }
        },
        "security": [
          {
            "Authorization": []
          }
        ],
        "summary": "Get Onboarding Events"
      }
    }
  },
  "components": {
    "schemas": {
      "EventRepresentation": {
        "required": [
          "message",
          "timestamp",
          "type"
        ],
        "type": "object",
        "properties": {
          "_links": {
            "$ref": "#/components/schemas/EventRepresentationLinks"
          },
          "assetId": {
            "type": "string",
            "description": "Asset ID for the created machine in case this is a machine created event",
            "format": "uuid"
          },
          "message": {
            "type": "string",
            "description": "Message with details of the event"
          },
          "timestamp": {
            "type": "integer",
            "description": "Timestamp of occurrence",
            "format": "int64"
          },
          "type": {
            "type": "string",
            "description": "Type of the event"
          }
        }
      },
      "EventRepresentationLinks": {
        "type": "object",
        "properties": {
          "machine": {
            "$ref": "#/components/schemas/HALLink"
          }
        }
      },
      "EventsRepresentation": {
        "type": "object",
        "properties": {
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EventRepresentation"
            }
          }
        }
      },
      "HALLink": {
        "type": "object",
        "properties": {
          "deprecation": {
            "type": "string"
          },
          "href": {
            "type": "string"
          },
          "hreflang": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "profile": {
            "type": "string",
            "format": "uri"
          },
          "seen": {
            "type": "string"
          },
          "templated": {
            "type": "boolean"
          },
          "title": {
            "type": "string"
          },
          "type": {
            "type": "string"
          }
        }
      }
    },
    "securitySchemes": {
      "authorizationBearer": {
        "bearerFormat": "JWT",
        "scheme": "bearer",
        "type": "http"
      }
    }
  }
}
