{
  "openapi" : "3.1.0",
  "info" : {
    "description" : "Device Health Issues API - Beta Version",
    "title" : "Device Health Issues (Beta)",
    "version" : "1.0"
  },
  "externalDocs" : {
    "description" : "Trackunit Developer Hub",
    "url" : "https://developers.trackunit.com/"
  },
  "servers" : [ {
    "url" : "https://iris.trackunit.com/api/device-health-issues",
    "description" : "Production"
  } ],
  "security" : [ {
    "authorizationBearer" : [ ]
  } ],
  "tags" : [ {
    "description" : "API for getting issues related to device health.",
    "name" : "Issue API"
  } ],
  "paths" : {
    "/v1beta1/assets/{assetId}/issues" : {
      "get" : {
        "description" : "This endpoint returns issues by provided asset id",
        "operationId" : "getIssuesByAsset",
        "parameters" : [ {
          "in" : "path",
          "name" : "assetId",
          "required" : true,
          "schema" : {
            "type" : "string",
            "format" : "uuid"
          }
        }, {
          "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,
            "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"
            }
          }
        } ],
        "responses" : {
          "200" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/PaginatedIssue"
                }
              }
            },
            "description" : "Get issues by asset ID"
          },
          "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 issues by asset",
        "tags" : [ "Issue API" ]
      }
    },
    "/v1beta1/issues" : {
      "get" : {
        "description" : "This endpoint returns pageable issues",
        "operationId" : "getPaginatedIssues",
        "parameters" : [ {
          "in" : "query",
          "name" : "state",
          "required" : true,
          "schema" : {
            "type" : "string"
          }
        }, {
          "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,
            "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"
            }
          }
        } ],
        "responses" : {
          "200" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/PaginatedIssue"
                }
              }
            },
            "description" : "Get issues"
          },
          "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 issues",
        "tags" : [ "Issue API" ]
      }
    },
    "/v1beta1/issues/{issueId}" : {
      "get" : {
        "description" : "This endpoint returns issue by provided id",
        "operationId" : "getIssueById",
        "parameters" : [ {
          "in" : "path",
          "name" : "issueId",
          "required" : true,
          "schema" : {
            "type" : "string",
            "format" : "uuid"
          }
        } ],
        "responses" : {
          "200" : {
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/Issue"
                }
              }
            },
            "description" : "Get issue by ID"
          },
          "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 issue by id",
        "tags" : [ "Issue API" ]
      }
    }
  },
  "components" : {
    "schemas" : {
      "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"
            }
          }
        }
      },
      "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"
          }
        }
      },
      "Issue" : {
        "type" : "object",
        "properties" : {
          "assetId" : {
            "type" : "string",
            "format" : "uuid",
            "description" : "Unique identifier for the asset associated with the issue"
          },
          "category" : {
            "type" : "string",
            "description" : "Category of the issue, e.g 'DEVICE_BATTERY', 'COVERAGE', etc.",
            "enum" : [ "INSTALL_AND_CONFIGURATION", "COVERAGE", "DEVICE_BATTERY", "NON_REPORTING_DEVICE" ]
          },
          "createdAt" : {
            "type" : "string",
            "format" : "date-time",
            "description" : "Timestamp when the issue was created"
          },
          "criticality" : {
            "type" : "string",
            "description" : "Criticality of the issue, e.g., 'CRITICAL', 'LOW'",
            "enum" : [ "CRITICAL", "LOW", "UNKNOWN" ]
          },
          "deviceId" : {
            "type" : "string",
            "format" : "uuid",
            "description" : "Unique identifier for the device associated with the issue"
          },
          "id" : {
            "type" : "string",
            "format" : "uuid",
            "description" : "Unique identifier for the issue"
          },
          "resolvedAt" : {
            "type" : "string",
            "format" : "date-time",
            "description" : "Timestamp when the issue was resolved, if applicable"
          },
          "state" : {
            "type" : "string",
            "description" : "Current state of the issue, e.g., 'OPEN', 'RESOLVED'",
            "enum" : [ "OPEN", "RESOLVED" ]
          },
          "type" : {
            "type" : "string",
            "description" : "Type of the issue, e.g., 'LOW_DEVICE_INPUT_VOLTAGE', 'UNUSUAL_OPERATING_HOURS', etc.",
            "enum" : [ "UNUSUAL_OPERATING_HOURS", "NO_CAN_DATA_CONFIGURATION", "LOW_DEVICE_INPUT_VOLTAGE", "LOW_DEVICE_BATTERY_VOLTAGE", "LOW_GPS_COVERAGE", "LOW_CELLULAR_COVERAGE", "DATA_NOT_RECEIVED" ]
          }
        },
        "required" : [ "assetId", "category", "createdAt", "criticality", "deviceId", "id", "state", "type" ]
      },
      "PaginatedIssue" : {
        "type" : "object",
        "properties" : {
          "content" : {
            "type" : "array",
            "description" : "The page content as a list.",
            "items" : {
              "$ref" : "#/components/schemas/Issue"
            }
          },
          "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."
          }
        }
      },
      "Violation" : {
        "type" : "object",
        "properties" : {
          "field" : {
            "type" : "string"
          },
          "message" : {
            "type" : "string"
          }
        }
      }
    },
    "securitySchemes" : {
      "authorizationBearer" : {
        "bearerFormat" : "JWT",
        "scheme" : "bearer",
        "type" : "http"
      }
    }
  }
}