{
  "openapi" : "3.1.0",
  "info" : {
    "description" : "Public Asset Event Management API",
    "title" : "Asset Event API",
    "version" : "1.0"
  },
  "externalDocs" : {
    "description" : "Trackunit Developer Hub",
    "url" : "https://developers.trackunit.com/"
  },
  "servers" : [ {
    "url" : "https://iris.trackunit.com/public/api/eventlog/v3",
    "description" : "Production"
  } ],
  "security" : [ {
    "authorizationBearer" : [ ]
  } ],
  "tags" : [ {
    "description" : "API for managing asset events",
    "name" : "Asset Events"
  } ],
  "paths" : {
    "/asset-event/active" : {
      "post" : {
        "description" : "This API is used to get paginated active asset events based on the provided filter criteria.\nActive events are those that are currently ongoing or unresolved.\n",
        "operationId" : "getActiveEventsBy",
        "parameters" : [ {
          "description" : "Zero-based page index (0..N)",
          "example" : 0,
          "in" : "query",
          "name" : "page",
          "required" : false,
          "schema" : {
            "type" : "integer",
            "format" : "int32",
            "default" : 0,
            "minimum" : 0
          }
        }, {
          "description" : "The size of the page to be returned",
          "example" : 20,
          "in" : "query",
          "name" : "size",
          "required" : false,
          "schema" : {
            "type" : "integer",
            "format" : "int32",
            "default" : 20,
            "maximum" : 1000,
            "minimum" : 1
          }
        }, {
          "description" : "Sort order: `property` (ascending by default), `+property` (ascending), `-property` (descending).",
          "in" : "query",
          "name" : "sort",
          "required" : false,
          "schema" : {
            "type" : "array",
            "items" : {
              "type" : "string"
            }
          }
        } ],
        "requestBody" : {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/ActiveAssetEventQueryFilter"
              }
            }
          },
          "required" : true
        },
        "responses" : {
          "200" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/PaginatedAssetEvent"
                }
              }
            },
            "description" : "Get active asset events"
          },
          "400" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ConstraintViolationError"
                }
              }
            },
            "description" : "Bad request"
          },
          "401" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/DefaultError"
                }
              }
            },
            "description" : "Invalid or missing bearer token in Authorization header"
          },
          "403" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/DefaultError"
                }
              }
            },
            "description" : "User not allowed to make this request"
          },
          "404" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/DefaultError"
                }
              }
            },
            "description" : "Resource not found"
          },
          "500" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/DefaultError"
                }
              }
            },
            "description" : "Internal server error"
          }
        },
        "summary" : "Get active asset events",
        "tags" : [ "Asset Events" ]
      }
    },
    "/asset-event/log" : {
      "post" : {
        "description" : "This API is used to get paginated asset events based on the provided filter criteria. ",
        "operationId" : "getAssetEventBy",
        "parameters" : [ {
          "description" : "Zero-based page index (0..N)",
          "example" : 0,
          "in" : "query",
          "name" : "page",
          "required" : false,
          "schema" : {
            "type" : "integer",
            "format" : "int32",
            "default" : 0,
            "minimum" : 0
          }
        }, {
          "description" : "The size of the page to be returned",
          "example" : 20,
          "in" : "query",
          "name" : "size",
          "required" : false,
          "schema" : {
            "type" : "integer",
            "format" : "int32",
            "default" : 20,
            "maximum" : 1000,
            "minimum" : 1
          }
        }, {
          "description" : "Sort order: `property` (ascending by default), `+property` (ascending), `-property` (descending).",
          "in" : "query",
          "name" : "sort",
          "required" : false,
          "schema" : {
            "type" : "array",
            "items" : {
              "type" : "string"
            }
          }
        } ],
        "requestBody" : {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/AssetEventQueryFilter"
              }
            }
          },
          "required" : true
        },
        "responses" : {
          "200" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/PaginatedAssetEvent"
                }
              }
            },
            "description" : "Get asset events"
          },
          "400" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ConstraintViolationError"
                }
              }
            },
            "description" : "Bad request"
          },
          "401" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/DefaultError"
                }
              }
            },
            "description" : "Invalid or missing bearer token in Authorization header"
          },
          "403" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/DefaultError"
                }
              }
            },
            "description" : "User not allowed to make this request"
          },
          "404" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/DefaultError"
                }
              }
            },
            "description" : "Resource not found"
          },
          "500" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/DefaultError"
                }
              }
            },
            "description" : "Internal server error"
          }
        },
        "summary" : "Get asset events",
        "tags" : [ "Asset Events" ]
      }
    }
  },
  "components" : {
    "schemas" : {
      "ActiveAssetEventQueryFilter" : {
        "type" : "object",
        "properties" : {
          "assetIds" : {
            "type" : "array",
            "items" : {
              "type" : "string",
              "format" : "uuid"
            },
            "uniqueItems" : true
          },
          "criticality" : {
            "type" : "array",
            "description" : "Filter on event criticality. Defaulting to include both LOW and CRITICAL events if none are provided",
            "example" : "CRITICAL",
            "items" : {
              "$ref" : "#/components/schemas/Criticality"
            },
            "uniqueItems" : true
          },
          "customerIds" : {
            "type" : "array",
            "items" : {
              "type" : "string",
              "format" : "uuid"
            },
            "uniqueItems" : true
          },
          "groupIds" : {
            "type" : "array",
            "items" : {
              "type" : "string",
              "format" : "uuid"
            },
            "uniqueItems" : true
          },
          "siteIds" : {
            "type" : "array",
            "items" : {
              "type" : "string",
              "format" : "uuid"
            },
            "uniqueItems" : true
          },
          "type" : {
            "type" : "array",
            "description" : "Filter on event type. Defaulting to include all types if none are provided",
            "example" : "ALERT",
            "items" : {
              "$ref" : "#/components/schemas/AssetEventType"
            },
            "uniqueItems" : true
          }
        }
      },
      "AlertConfigurationType" : {
        "type" : "string",
        "description" : "Types of alert configurations available",
        "enum" : [ "ADVANCED_OPERATIONAL_ALERT", "CAN_FAULT_ALERT", "HIGH_IMPACT_ALERT", "INPUT_ALERT", "LOGISTIC_LOGGING_ALERT", "MOVEMENT_BASED_THEFT_ALERT", "OPERATIONAL_ALERT", "SITE_BASED_THEFT_ALERT", "TELEMATICS_DEVICE_ALERT" ]
      },
      "AssetEvent" : {
        "type" : "object",
        "description" : "Asset Event information",
        "properties" : {
          "accountId" : {
            "type" : "string",
            "format" : "uuid",
            "description" : "Account identifier"
          },
          "assetEventDomainDetails" : {
            "description" : "Domain-specific details for the asset event",
            "oneOf" : [ {
              "$ref" : "#/components/schemas/AssetEventAlertDetails"
            }, {
              "$ref" : "#/components/schemas/AssetEventClassicServiceDetails"
            }, {
              "$ref" : "#/components/schemas/AssetEventDamageReportDetails"
            }, {
              "$ref" : "#/components/schemas/AssetEventInspectionDetails"
            }, {
              "$ref" : "#/components/schemas/AssetEventMachineFaultDetails"
            }, {
              "$ref" : "#/components/schemas/AssetEventPrecheckDetails"
            }, {
              "$ref" : "#/components/schemas/AssetEventServiceManagementDetails"
            } ]
          },
          "assetId" : {
            "type" : "string",
            "format" : "uuid",
            "description" : "Asset identifier"
          },
          "criticality" : {
            "$ref" : "#/components/schemas/Criticality",
            "description" : "Criticality level of the event"
          },
          "eventTime" : {
            "type" : "string",
            "format" : "date-time",
            "description" : "When the event occurred (ISO 8601 format: YYYY-MM-DDTHH:mm:ssZ)",
            "example" : "2024-01-15T10:30:00Z"
          },
          "id" : {
            "type" : "string",
            "format" : "uuid",
            "description" : "Unique identifier for the asset event"
          },
          "status" : {
            "$ref" : "#/components/schemas/EventStatus",
            "description" : "Current status of the event"
          },
          "timeOff" : {
            "type" : "string",
            "format" : "date-time",
            "description" : "When the event ended, null if still active (ISO 8601 format: YYYY-MM-DDTHH:mm:ssZ)",
            "example" : "2024-01-15T11:30:00Z"
          },
          "timeOn" : {
            "type" : "string",
            "format" : "date-time",
            "description" : "When the event started (ISO 8601 format: YYYY-MM-DDTHH:mm:ssZ)",
            "example" : "2024-01-15T10:30:00Z"
          },
          "type" : {
            "$ref" : "#/components/schemas/AssetEventType",
            "description" : "Type of the asset event"
          },
          "typeDescription" : {
            "type" : "string",
            "description" : "Event type description"
          }
        }
      },
      "AssetEventAlertDetails" : {
        "allOf" : [ {
          "$ref" : "#/components/schemas/AssetEventDomainDetails"
        }, {
          "type" : "object",
          "properties" : {
            "alertConfigurationId" : {
              "type" : "string",
              "format" : "uuid",
              "description" : "Alert configuration ID"
            },
            "location" : {
              "$ref" : "#/components/schemas/EventLocation",
              "description" : "The location where the alert event occurred"
            },
            "type" : {
              "$ref" : "#/components/schemas/AlertConfigurationType",
              "description" : "The type of alert configuration",
              "example" : "INPUT_ALERT"
            }
          }
        } ],
        "description" : "Details for an Alert event"
      },
      "AssetEventClassicServiceDetails" : {
        "allOf" : [ {
          "$ref" : "#/components/schemas/AssetEventDomainDetails"
        }, {
          "type" : "object",
          "properties" : {
            "serviceState" : {
              "$ref" : "#/components/schemas/ClassicServiceState",
              "description" : "The current state of the classic service",
              "example" : "APPROVED"
            },
            "serviceType" : {
              "$ref" : "#/components/schemas/ClassicServiceType",
              "description" : "The type of classic service",
              "example" : "KM"
            }
          }
        } ],
        "description" : "Details for a Classic service event"
      },
      "AssetEventDamageReportDetails" : {
        "allOf" : [ {
          "$ref" : "#/components/schemas/AssetEventDomainDetails"
        }, {
          "type" : "object",
          "properties" : {
            "damageReportId" : {
              "type" : "string",
              "format" : "uuid",
              "description" : "Unique identifier for the damage report"
            },
            "description" : {
              "type" : "string",
              "description" : "Detailed description of the damage"
            },
            "imageUrls" : {
              "type" : "array",
              "description" : "List of image URLs documenting the damage",
              "items" : {
                "type" : "string"
              }
            },
            "name" : {
              "type" : "string",
              "description" : "Name of the damage report"
            },
            "title" : {
              "type" : "string",
              "description" : "Title of the damage report"
            }
          }
        } ],
        "description" : "Details for a Damage Report event"
      },
      "AssetEventDomainDetails" : {
        "type" : "object",
        "description" : "Base class for asset event domain-specific details",
        "discriminator" : {
          "propertyName" : "eventTypeName"
        },
        "properties" : {
          "eventTypeName" : {
            "type" : "string"
          }
        }
      },
      "AssetEventInspectionDetails" : {
        "allOf" : [ {
          "$ref" : "#/components/schemas/AssetEventDomainDetails"
        }, {
          "type" : "object",
          "properties" : {
            "failedAnswers" : {
              "type" : "integer",
              "format" : "int32",
              "description" : "Number of failed answers in the inspection"
            },
            "inspectionResponseId" : {
              "type" : "string",
              "format" : "uuid",
              "description" : "Unique identifier for the inspection response"
            },
            "performedByOperatorId" : {
              "type" : "string",
              "format" : "uuid",
              "description" : "Unique identifier for the operator who performed the inspection"
            },
            "templateName" : {
              "type" : "string",
              "description" : "Name of the inspection template"
            },
            "totalAnswers" : {
              "type" : "integer",
              "format" : "int32",
              "description" : "Total number of answers in the inspection"
            }
          }
        } ],
        "description" : "Details for an Inspection event"
      },
      "AssetEventMachineFaultDetails" : {
        "allOf" : [ {
          "$ref" : "#/components/schemas/AssetEventDomainDetails"
        }, {
          "type" : "object",
          "properties" : {
            "description" : {
              "type" : "string",
              "description" : "Description of the fault if available"
            },
            "faultCode" : {
              "type" : "string",
              "description" : "The fault code identifier"
            },
            "j1939" : {
              "$ref" : "#/components/schemas/J1939",
              "description" : "The field is present if is a J1939 machine fault, otherwise is null"
            }
          }
        } ],
        "description" : "Details for Machine Fault events"
      },
      "AssetEventPrecheckDetails" : {
        "allOf" : [ {
          "$ref" : "#/components/schemas/AssetEventDomainDetails"
        }, {
          "type" : "object",
          "properties" : {
            "preheckId" : {
              "type" : "string",
              "format" : "uuid",
              "description" : "Unique identifier for the precheck"
            },
            "templateName" : {
              "type" : "string",
              "description" : "Name of the precheck template"
            }
          }
        } ],
        "description" : "Details for a Pre-Check event"
      },
      "AssetEventQueryFilter" : {
        "type" : "object",
        "properties" : {
          "assetIds" : {
            "type" : "array",
            "items" : {
              "type" : "string",
              "format" : "uuid"
            },
            "uniqueItems" : true
          },
          "criticality" : {
            "type" : "array",
            "description" : "Filter on event criticality. Defaulting to include all criticality if none are provided",
            "example" : "CRITICAL",
            "items" : {
              "$ref" : "#/components/schemas/Criticality"
            },
            "uniqueItems" : true
          },
          "customerIds" : {
            "type" : "array",
            "items" : {
              "type" : "string",
              "format" : "uuid"
            },
            "uniqueItems" : true
          },
          "fromTime" : {
            "type" : "string",
            "format" : "date-time",
            "description" : "Start time for filtering events (ISO 8601 format: YYYY-MM-DDTHH:mm:ssZ)",
            "example" : "2024-01-15T10:30:00Z"
          },
          "groupIds" : {
            "type" : "array",
            "items" : {
              "type" : "string",
              "format" : "uuid"
            },
            "uniqueItems" : true
          },
          "siteIds" : {
            "type" : "array",
            "items" : {
              "type" : "string",
              "format" : "uuid"
            },
            "uniqueItems" : true
          },
          "status" : {
            "type" : "array",
            "description" : "Filter on event status. Defaulting to include all statuses if none are provided",
            "example" : "OPEN",
            "items" : {
              "$ref" : "#/components/schemas/EventStatus"
            },
            "uniqueItems" : true
          },
          "toTime" : {
            "type" : "string",
            "format" : "date-time",
            "description" : "End time for filtering events (ISO 8601 format: YYYY-MM-DDTHH:mm:ssZ)",
            "example" : "2024-01-15T11:30:00Z"
          },
          "type" : {
            "type" : "array",
            "description" : "Filter on event type. Defaulting to include all event types if none are provided",
            "example" : "ALERT",
            "items" : {
              "$ref" : "#/components/schemas/AssetEventType"
            },
            "uniqueItems" : true
          }
        },
        "required" : [ "fromTime", "toTime" ]
      },
      "AssetEventServiceManagementDetails" : {
        "allOf" : [ {
          "$ref" : "#/components/schemas/AssetEventDomainDetails"
        }, {
          "type" : "object",
          "properties" : {
            "servicePlanId" : {
              "type" : "string",
              "format" : "uuid",
              "description" : "Unique identifier for the service plan"
            },
            "serviceProviderAccountId" : {
              "type" : "string",
              "format" : "uuid",
              "description" : "Unique identifier for the service provider account"
            },
            "status" : {
              "$ref" : "#/components/schemas/ServiceManagementStatus",
              "description" : "Current status of the service management event"
            }
          }
        } ],
        "description" : "Details for a Service Management event"
      },
      "AssetEventType" : {
        "type" : "string",
        "description" : "Types of asset events",
        "enum" : [ "ALERT", "CLASSIC_SERVICE", "DAMAGE_REPORT", "INSPECTION", "MACHINE_FAULT", "PRE_CHECK", "SERVICE_MANAGEMENT" ]
      },
      "ClassicServiceState" : {
        "type" : "string",
        "description" : "Possible states of a classic service event",
        "enum" : [ "APPROVED", "DELETED", "REMINDER_SEND", "UNKNOWN", "WARNING" ]
      },
      "ClassicServiceType" : {
        "type" : "string",
        "description" : "Types of classic service events",
        "enum" : [ "CALENDAR", "HOUR", "HOUR2", "KM", "UNKNOWN" ]
      },
      "ConstraintViolationError" : {
        "type" : "object",
        "properties" : {
          "code" : {
            "type" : [ "string", "null" ],
            "description" : "Alphanumeric code (snake case) describing use case specific error"
          },
          "message" : {
            "type" : "string",
            "description" : "Detailed description of error"
          },
          "properties" : {
            "type" : [ "object", "null" ],
            "additionalProperties" : { },
            "description" : "Additional properties to be included in the error response"
          },
          "status" : {
            "type" : "integer",
            "format" : "int32",
            "description" : "HTTP status code"
          },
          "violations" : {
            "type" : "array",
            "items" : {
              "$ref" : "#/components/schemas/Violation"
            }
          }
        }
      },
      "Coordinates" : {
        "type" : "object",
        "description" : "Geographical coordinates with latitude and longitude",
        "properties" : {
          "latitude" : {
            "type" : "number",
            "format" : "double",
            "description" : "Latitude"
          },
          "longitude" : {
            "type" : "number",
            "format" : "double",
            "description" : "Longitude"
          }
        }
      },
      "Criticality" : {
        "type" : "string",
        "description" : "Criticality levels for asset events",
        "enum" : [ "CRITICAL", "LOW", "NONE", "UNKNOWN" ]
      },
      "DefaultError" : {
        "type" : "object",
        "properties" : {
          "code" : {
            "type" : [ "string", "null" ],
            "description" : "Alphanumeric code (snake case) describing use case specific error"
          },
          "message" : {
            "type" : "string",
            "description" : "Detailed description of error"
          },
          "properties" : {
            "type" : [ "object", "null" ],
            "additionalProperties" : { },
            "description" : "Additional properties to be included in the error response"
          },
          "status" : {
            "type" : "integer",
            "format" : "int32",
            "description" : "HTTP status code"
          }
        }
      },
      "EventLocation" : {
        "type" : "object",
        "description" : "Location information including coordinates and address",
        "properties" : {
          "address" : {
            "type" : "string",
            "description" : "The address of the location"
          },
          "coordinates" : {
            "$ref" : "#/components/schemas/Coordinates",
            "description" : "The geographical coordinates of the location"
          }
        }
      },
      "EventStatus" : {
        "type" : "string",
        "description" : "Possible states of an asset event",
        "enum" : [ "CLOSED", "DISMISSED", "OPEN", "RESOLVED" ]
      },
      "J1939" : {
        "type" : "object",
        "description" : "Details for J1939 Machine Fault",
        "properties" : {
          "fmi" : {
            "type" : "integer",
            "format" : "int32",
            "description" : "The Failure Mode Identifier (FMI) of the CAN event"
          },
          "sa" : {
            "type" : "integer",
            "format" : "int32",
            "description" : "Source Address (SA) of the CAN event"
          },
          "spn" : {
            "type" : "integer",
            "format" : "int32",
            "description" : "The Suspect Parameter Number (SPN) of the CAN event"
          }
        }
      },
      "PaginatedAssetEvent" : {
        "type" : "object",
        "properties" : {
          "content" : {
            "type" : "array",
            "description" : "The page content as a list.",
            "items" : {
              "$ref" : "#/components/schemas/AssetEvent"
            }
          },
          "number" : {
            "type" : "integer",
            "format" : "int32",
            "description" : "The number of the current page."
          },
          "numberOfElements" : {
            "type" : "integer",
            "format" : "int32",
            "description" : "The number of elements currently on this page."
          },
          "size" : {
            "type" : "integer",
            "format" : "int32",
            "description" : "The size of the page."
          },
          "totalElements" : {
            "type" : "integer",
            "format" : "int64",
            "description" : "The total number of elements."
          },
          "totalPages" : {
            "type" : "integer",
            "format" : "int32",
            "description" : "The number of total pages."
          }
        }
      },
      "ServiceManagementStatus" : {
        "type" : "string",
        "description" : "Possible states of a service management event",
        "enum" : [ "DELETED", "OVERDUE", "RESOLVED", "UNKNOWN", "UPCOMING" ]
      },
      "Violation" : {
        "type" : "object",
        "properties" : {
          "field" : {
            "type" : "string"
          },
          "message" : {
            "type" : "string"
          }
        }
      }
    },
    "securitySchemes" : {
      "authorizationBearer" : {
        "bearerFormat" : "JWT",
        "scheme" : "bearer",
        "type" : "http"
      }
    }
  }
}