openapi: "3.0.0"
info:
  version: 2.27.0
  title: Vehicle Service
  license:
    name: MIT
servers:
  - url: "http://localhost:8080"
    description: "Local development"
  - url: "https://vehicleapiv2.qa.aptivcs.com"
    description: "QA environment"
  - url: "https://vehicleapiv2.aptivcs.com"
    description: "Prod - US"
  - url: "https://vehicleapiv2.eu.aptivcs.com"
    description: "Prod - EU"
  - url: "https://vehicleapiv2.aptivcs.cn"
    description: "Prod - China"
paths:
  /healthz:
    get:
      summary: Get the health of the application
      operationId: getHealth
      tags:
        - Health
      responses:
        "200":
          description: Healthy server
          content:
            text/plain:
              schema:
                type: string
  /builds:
    get:
      security:
        - OAuth2:
          - api://vehicle-service/.default
          - api://vehicle-service/vehicles.get
      summary: Get Builds
      description: Get all builds in a given tenant
      operationId: getBuilds
      tags:
        - Builds
      parameters:
        - in: header
          name: tenant-id
          description: The tenant id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: An array of Build objects
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Builds"
  /emissions:
    get:
      security:
        - OAuth2:
          - api://vehicle-service/.default
          - api://vehicle-service/vehicles.get
      summary: Get Emissions
      description: Get all emissions in a given tenant
      operationId: getEmissions
      tags:
        - Emissions
      parameters:
        - in: header
          name: tenant-id
          description: The tenant id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: An array of Emission objects
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Emissions"
  /calibrations:
    get:
      security:
        - OAuth2:
          - api://vehicle-service/.default
          - api://vehicle-service/calibrations.read
      summary: Get Unique Calibrations
      description: Get the set of unique calibration values across vehicles in a tenant.
      operationId: getCalibrations
      tags:
        - Cablibrations
      parameters:
        - in: header
          name: tenant-id
          description: The tenant id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: An array of Calibration objects
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Calibrations"
        "400":
          $ref: "#/components/responses/400"
        "403":
          $ref: "#/components/responses/403"
        "404":
          $ref: "#/components/responses/404"
  /fleets:
    get:
      security:
        - OAuth2:
          - api://vehicle-service/.default
          - api://vehicle-service/fleets.read
      summary: Get Fleets
      description: Get all fleets in a given tenant
      operationId: getFleets
      tags:
        - Fleets
      parameters:
        - in: header
          name: tenant-id
          description: The tenant id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: An array of Fleet objects
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Fleets"
  /fleets/{idFleet}:
    get:
      security:
        - OAuth2:
          - api://vehicle-service/.default
          - api://vehicle-service/fleets.read
      summary: Get Fleet by ID
      description: Get a Fleet resource based on the resource idFleet
      operationId: getFleet
      tags:
        - Fleets
      parameters:
        - in: header
          name: tenant-id
          description: The tenant id
          required: true
          schema:
            type: string
        - in: path
          name: idFleet
          description: idFleet of the Fleet resource to retrieve
          required: true
          schema:
            type: string
      responses:
        "200":
          description: A Fleet
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Fleet"
  /modelyears:
    get:
      security:
        - OAuth2:
          - api://vehicle-service/.default
          - api://vehicle-service/vehicles.get
      summary: Get Model Years
      description: Get set of model years across all vehicles in a given tenant
      operationId: getModelYears
      tags:
        - ModelYears
      parameters:
        - in: header
          name: tenant-id
          description: The tenant id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: An array of ModelYear objects
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ModelYears"
  /packages:
    post:
      security:
        - OAuth2:
          - api://vehicle-service/.default
          - api://vehicle-service/packages.write
      summary: Create new package
      description: Create a new unique Vehicle Package from an engine / body / transmission combination.
      operationId: createPackage
      tags:
        - Packages
      parameters:
        - in: header
          name: tenant-id
          description: The tenant id
          required: true
          schema:
            type: string
      requestBody:
        description: The vehicle package to be created
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateVehiclePackageRequestObject"
      responses:
        "200":
          description: The created package.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/VehiclePackage"
        "400":
          $ref: "#/components/responses/400"
    get:
      security:
        - OAuth2:
          - api://vehicle-service/.default
          - api://vehicle-service/packages.read
      summary: Search Packages
      operationId: getPackages
      tags:
        - Packages
      parameters:
        - in: header
          name: tenant-id
          description: The tenant id
          required: true
          schema:
            type: string
        - in: query
          name: bodies
          description: A list of bodies to filter packages.
          required: false
          schema:
            type: array
            items:
              type: string
        - in: query
          name: engines
          description: A list of engines to filter packages.
          required: false
          schema:
            type: array
            items:
              type: string
        - in: query
          name: idPackages
          description: A list of idPackages to select packages
          required: false
          schema:
            type: array
            items:
              type: integer
        - in: query
          name: transmissions
          description: A list of transmissions to filter packages.
          required: false
          schema:
            type: array
            items:
              type: string
      responses:
        "200":
          description: An array of packages
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Packages"
  /testgroups:
    get:
      security:
        - OAuth2:
          - api://vehicle-service/.default
          - api://vehicle-service/vehicles.get
      summary: Get Test Groups
      description: Get set of TestGroups across vehicles in a given tenant
      operationId: getTestGroups
      tags:
        - TestGroups
      parameters:
        - in: header
          name: tenant-id
          description: The tenant id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: An array of TestGroup objects
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TestGroups"
  /vehiclestatuses:
    get:
      security:
        - OAuth2:
          - api://vehicle-service/.default
          - api://vehicle-service/statuses.get
      summary: Search VehicleStatuses
      description: Get set of available VehicleStatuses available to the tenant
      operationId: getVehicleStatuses
      tags:
        - Vehicle statuses
      parameters:
        - in: header
          name: tenant-id
          description: The id for the tenant making the request
          required: true
          schema:
            type: string
      responses:
        "200":
          description: A list of available vehicle statuses
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/VehicleStatuses"
  /vehicles/{idVin}/status:
    patch:
      security:
        - OAuth2:
          - api://vehicle-service/.default
          - api://vehicle-service/vehicles.update
      summary: Update Vehicle's Status
      description: Update the status property of a vehicle.
      operationId: updateVehicleStatus
      tags:
        - Vehicles
      parameters:
        - in: header
          name: tenant-id
          description: The tenant id
          required: true
          schema:
            type: string
        - in: path
          name: idVin
          description: The unique id of the vehicle we are patching
          required: true
          schema:
            type: integer
            format: int64
      requestBody:
        description: The vehicle status that the vehicle parameterized by idVin will be patched to.
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/VehicleStatus"
      responses:
        "200":
          description: A newly created vehicle model.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Vehicle"
  /vehicles:
    post:
      security:
        - OAuth2:
          - api://vehicle-service/.default
          - api://vehicle-service/vehicles.write
      summary: Create Vehicle
      description: |
        Create a new Vehicle. Provided a Vehicle object in the request body. Create a vehicle with those properties
        Vehicle is initialized with a predetermined initial Vehicle.idStatus based on the tenant/division in which the Vehicle will be created.
        The creation of a vehicle will also attempt to bind the vehicle to a Vdr resource. If the Vehicle.dlSerial property of the requested
        vehicle is present. A request to create the binding will be formed.
      operationId: createVehicle
      tags:
        - Vehicles
      parameters:
        - in: header
          name: tenant-id
          description: The tenant id
          required: true
          schema:
            type: string
      requestBody:
        description: Properties required to create a vehicle. Currently this model is grossly over complicated.
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/Vehicle"
      responses:
        "200":
          description: A newly created vehicle model.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Vehicle"
        "409":
          description: The vehicle with the unique VIN already exists. Return the currently existing vehicle in the response.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Vehicle"
    get:
      security:
        - OAuth2:
          - api://vehicle-service/.default
          - api://vehicle-service/vehicles.get
      summary: Search Vehicles 
      description: Get set of Vehicles based on query params
      operationId: getVehicles
      tags:
        - Vehicles
      parameters:
        - in: header
          name: tenant-id
          description: The tenant id
          required: true
          schema:
            type: string
        - in: query
          name: activeFlags
          description: A list of activeFlag values to select vehicles
          required: false
          schema:
            type: array
            items:
              type: integer
        - in: query
          name: idVins
          description: A list of idVins to select vehicles.
          required: false
          schema:
            type: array
            items:
              type: integer
              format: int64
        - in: query
          name: idPackages
          description: A list of idPackages to select vehicles.
          required: false
          schema:
            type: array
            items:
              type: integer
        - in: query
          name: idStatuses
          description: A list of idStatuses to select vehicles.
          required: false
          schema:
            type: array
            items:
              type: integer
        - in: query
          name: vehicleNumber
          description: A list of vehicle numbers to filter vehicles.
          required: false
          schema:
            type: array
            items:
              type: string
        - in: query
          name: vehicleNumberQuery
          description: A query to find vehicles whose vehicle number contains the provided value
          required: false
          schema:
            type: string
        - in: query
          name: fleet
          description: A list of fleets to filter vehicles.
          required: false
          schema:
            type: array
            items:
              type: string
        - in: query
          name: vins
          description: A list of vins attached to VDRs to search for.
          required: false
          schema:
            type: array
            items:
              type: string
        - in: query
          name: vinQuery
          description: A query to find vehicles whose VIN contains the provided value
          required: false
          schema:
            type: string
        - in: query
          name: fields
          description: A flexible query parameter which determines which fields to set in the resource being returned as response and rest of the fields will be null.
          required: false
          schema:
            type: string
            example: idVin, statusHistory.status
      responses:
        "200":
          description: A list of Vehicle data models
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Vehicles"
  /vehicles/{idVin}:
    get:
      security:
        - OAuth2:
          - api://vehicle-service/.default
          - api://vehicle-service/vehicles.get
      summary: Get Vehicle by ID
      description: Get a vehicle resource based on the resource id[idVin]
      operationId: getVehicle
      tags:
        - Vehicles
      parameters:
        - in: header
          name: tenant-id
          description: The tenant id
          required: true
          schema:
            type: string
        - in: path
          name: idVin
          description: idVin of the vehicle resource to retrieve
          required: true
          schema:
            type: integer
            format: int64
        - in: query
          name: includes
          description: Include the status history of the vehicle
          required: false
          schema:
            type: string
            example: statusHistory
      responses:
        "200":
          description: A vehicle
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Vehicle"
  /vehicles/{idVin}/build:
    patch:
      security:
        - OAuth2:
          - api://vehicle-service/.default
          - api://vehicle-service/vehicles.update
      summary: Update Vehicle's Build
      description: Update the build property of a vehicle.
      operationId: updateVehicleBuild
      tags:
        - Vehicles
      parameters:
        - in: header
          name: tenant-id
          description: The tenant id
          required: true
          schema:
            type: string
        - in: path
          name: idVin
          description: The unique id of the vehicle we are patching
          required: true
          schema:
            type: integer
            format: int64
      requestBody:
        description: The vehicle build that the vehicle parameterized by idVin will be patched to.
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/Build"
      responses:
        "200":
          description: The updated Vehicle.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Vehicle"
        "400":
          $ref: "#/components/responses/400"
  /vehicles/{idVin}/package:
    patch:
      security:
        - OAuth2:
          - api://vehicle-service/.default
          - api://vehicle-service/vehicles.update
      summary: Update Vehicle's Package
      description: Update the Vehicle's Package.
      operationId: updateVehiclePackage
      tags:
        - Vehicles
      parameters:
        - in: header
          name: tenant-id
          description: The tenant id
          required: true
          schema:
            type: string
        - in: path
          name: idVin
          description: The unique id of the vehicle we are patching
          required: true
          schema:
            type: integer
            format: int64
      requestBody:
        description: The vehicle package values that the vehicle parameterized by idVin will be patched to.
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateVehiclePackageRequestObject"
      responses:
        "200":
          description: The updated Vehicle.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Vehicle"
        "400":
          $ref: "#/components/responses/400"
  /vehicles/{idVin}/modelyear:
    patch:
      security:
        - OAuth2:
          - api://vehicle-service/.default
          - api://vehicle-service/vehicles.update
      summary: Update Vehicle's Model Year
      description: Update the model year property of a vehicle.
      operationId: updateVehicleModelYear
      tags:
        - Vehicles
      parameters:
        - in: header
          name: tenant-id
          description: The tenant id
          required: true
          schema:
            type: string
        - in: path
          name: idVin
          description: The unique id of the vehicle we are patching
          required: true
          schema:
            type: integer
            format: int64
      requestBody:
        description: The vehicle model year that the vehicle parameterized by idVin will be patched to.
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ModelYear"
      responses:
        "200":
          description: The updated Vehicle.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Vehicle"
        "400":
          $ref: "#/components/responses/400"
  /vehicles/{idVin}/fleet:
    patch:
      security:
        - OAuth2:
          - api://vehicle-service/.default
          - api://vehicle-service/vehicles.update
      summary: Update Fleet for Vehicle
      description: Update the fleet property of a vehicle.
      operationId: updateVehicleFleet
      tags:
        - Vehicles
      parameters:
        - in: header
          name: tenant-id
          description: The tenant id
          required: true
          schema:
            type: string
        - in: path
          name: idVin
          description: The unique id of the vehicle we are patching
          required: true
          schema:
            type: integer
            format: int64
      requestBody:
        description: The vehicle fleet that the vehicle parameterized by idVin will be patched to.
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/Fleet"
      responses:
        "200":
          description: The updated Vehicle.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Vehicle"
        "400":
          $ref: "#/components/responses/400"
  /vehicles/{idVin}/vehicleno:
    patch:
      security:
        - OAuth2:
          - api://vehicle-service/.default
          - api://vehicle-service/vehicles.update
      summary: Update Vehicle's Vehicle Number
      description: Update the Vehicle Number property of a Vehicle.
      operationId: updateVehicleNo
      tags:
        - Vehicles
      parameters:
        - in: header
          name: tenant-id
          description: The tenant id
          required: true
          schema:
            type: string
        - in: path
          name: idVin
          description: The unique id of the vehicle we are patching
          required: true
          schema:
            type: integer
            format: int64
      requestBody:
        description: The vehicle vehicleNo that the vehicle parameterized by idVin will be patched to.
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                vehicleNo:
                  type: string
      responses:
        "200":
          description: The updated Vehicle.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Vehicle"
        "400":
          $ref: "#/components/responses/400"
  /vehicles/{idVin}/testGroup:
    patch:
      security:
        - OAuth2:
          - api://vehicle-service/.default
          - api://vehicle-service/vehicles.update
      summary: Update Vehicle's TestGroup 
      description: Update the test group property of a vehicle.
      operationId: updateTestGroup
      tags:
        - Vehicles
      parameters:
        - in: header
          name: tenant-id
          description: The tenant id
          required: true
          schema:
            type: string
        - in: path
          name: idVin
          description: The unique id of the vehicle we are patching
          required: true
          schema:
            type: integer
            format: int64
      requestBody:
        description: The vehicle test group that the vehicle parameterized by idVin will be patched to.
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                testGroup:
                  type: string
      responses:
        "200":
          description: The updated Vehicle.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Vehicle"
        "400":
          $ref: "#/components/responses/400"
  /vehicles/{idVin}/comments:
    get:
      security:
        - OAuth2:
          - api://vehicle-service/.default
          - api://vehicle-service/vehicles.comments.read
      summary: Get Vehicle's comments
      description: Get any comments saved for a Vehicle
      operationId: getVehicleComments
      tags:
        - Vehicles
      parameters:
        - in: header
          name: tenant-id
          description: The tenant id
          required: true
          schema:
            type: string
        - in: path
          name: idVin
          description: idVin of the vehicle resource to retrieve comment from
          required: true
          schema:
            type: integer
            format: int64
      responses:
        "200":
          description: An array of vehicle comments
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/VehicleComments"
    post:
      security:
        - OAuth2:
          - api://vehicle-service/.default
          - api://vehicle-service/vehicles.comments.write
      summary: Create new Vehicle Comment
      description: Adds a new Vehicle Comment to a Vehicle
      operationId: addVehicleComment
      requestBody:
        description: This should add a new Vehicle Comment
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/POSTVehicleComment"
      parameters:
        - in: header
          name: tenant-id
          description: The tenant id
          required: true
          schema:
            type: string
        - in: path
          name: idVin
          description: idVin of the vehicle resource to add comment to
          required: true
          schema:
            type: integer
            format: int64
      tags:
        - Vehicles
      responses:
        "201":
          description: "Vehicle Comment Added."
          content:
            application/json:
              schema:
                type: object
                properties:
                  idComment:
                    type: integer
                    format: int64
              example:
                idComment: 1
        "400":
          description: "Bad request. The request object does not match the expected."
  /vehicles/{idVin}/can-logs:
    get:
      security:
        - OAuth2:
          - api://vehicle-service/.default
          - api://vehicle-service/vehicles.get
      summary: Search Vehicle's BootCycles
      description: Get boot cycles with processing status for a vehicle
      operationId: getVehicleCanLogs
      tags:
        - Vehicles
      parameters:
        - in: header
          name: tenant-id
          description: The tenant id
          required: true
          schema:
            type: string
        - in: path
          name: idVin
          description: The unique id of the vehicle
          required: true
          schema:
            type: integer
            format: int64
        - in: query
          name: networkOn
          description: Filter by network on status (0, 1 or 2)
          required: false
          schema:
            type: integer
            enum: [0, 1, 2]
          example: 1
        - in: query
          name: idBootCycles
          description: Filter by boot cycle ids
          required: false
          schema:
            type: array
            items:
              type: integer
              format: int64
      responses:
        "200":
          description: An array of boot cycles
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CanLogBootCycles"
        "400":
          $ref: "#/components/responses/400"
        "404":
          $ref: "#/components/responses/404"
  /vehicles/{idVin}/can-logs/{bootCycleId}/comments:
    get:
      security:
        - OAuth2:
          - api://vehicle-service/.default
          - api://vehicle-service/vehicles.comments.read
      summary: Get Vehicle's CAN Logs comments
      description: Get comments for a specific boot cycle
      operationId: getBootCycleComments
      tags:
        - Vehicles
      parameters:
        - in: header
          name: tenant-id
          description: The tenant id
          required: true
          schema:
            type: string
        - in: path
          name: idVin
          description: The unique id of the vehicle
          required: true
          schema:
            type: integer
            format: int64
        - in: path
          name: bootCycleId
          description: The unique id of the boot cycle
          required: true
          schema:
            type: integer
            format: int64
      responses:
        "200":
          description: An array of comments for the boot cycle
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CanLogComments"
        "400":
          $ref: "#/components/responses/400"
        "404":
          $ref: "#/components/responses/404"
    post:
      security:
        - OAuth2:
          - api://vehicle-service/.default
          - api://vehicle-service/vehicles.comments.write
      summary: Create new BootCycle comment
      description: Add a comment to a BootCycle
      operationId: addBootCycleComment
      tags:
        - Vehicles
      parameters:
        - in: header
          name: tenant-id
          description: The tenant id
          required: true
          schema:
            type: string
        - in: path
          name: idVin
          description: The unique id of the vehicle
          required: true
          schema:
            type: integer
            format: int64
        - in: path
          name: bootCycleId
          description: The unique id of the boot cycle
          required: true
          schema:
            type: integer
            format: int64
      requestBody:
        description: The comment to add to the boot cycle
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/POSTCanLogComment"
      responses:
        "201":
          description: "Comment added successfully."
          content:
            application/json:
              schema:
                type: object
                properties:
                  commentId:
                    type: integer
                    format: int64
              example:
                commentId: 56010833
        "400":
          $ref: "#/components/responses/400"
  /vehicles/{idVin}/can-logs/{bootCycleId}/network-cycles:
    get:
      security:
        - OAuth2:
          - api://vehicle-service/.default
          - api://vehicle-service/vehicles.get
      summary: Get Vehicle NetworkCycles 
      description: Get NetworkCycles for a specific BootCycle
      operationId: getVehicleCanLogNetworkCycles
      tags:
        - Vehicles
      parameters:
        - in: header
          name: tenant-id
          description: The tenant id
          required: true
          schema:
            type: string
        - in: path
          name: idVin
          description: The unique id of the vehicle
          required: true
          schema:
            type: integer
            format: int64
        - in: path
          name: bootCycleId
          description: The unique id of the boot cycle
          required: true
          schema:
            type: integer
            format: int64
        - in: query
          name: networkOn
          description: Filter by network on status (0 or 1)
          required: false
          schema:
            type: integer
            enum: [0, 1, 2]
          example: 1
      responses:
        "200":
          description: An array of network cycles for the boot cycle
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CanLogNetworkCycles"
        "400":
          $ref: "#/components/responses/400"
        "404":
          $ref: "#/components/responses/404"
  /vehicles/{idVin}/can-logs/{bootCycleId}/network-cycles/{networkCycleId}/comments:
    get:
      security:
        - OAuth2:
          - api://vehicle-service/.default
          - api://vehicle-service/vehicles.comments.read
      summary: Get NetworkCycle comments
      operationId: getNetworkCycleComments
      tags:
        - Vehicles
      parameters:
        - in: header
          name: tenant-id
          description: The tenant id
          required: true
          schema:
            type: string
        - in: path
          name: idVin
          description: The unique id of the vehicle
          required: true
          schema:
            type: integer
            format: int64
        - in: path
          name: bootCycleId
          description: The unique id of the boot cycle
          required: true
          schema:
            type: integer
            format: int64
        - in: path
          name: networkCycleId
          description: The unique id of the network cycle
          required: true
          schema:
            type: integer
            format: int64
      responses:
        "200":
          description: An array of comments for the network cycle
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CanLogComments"
        "400":
          $ref: "#/components/responses/400"
        "404":
          $ref: "#/components/responses/404"
    post:
      security:
        - OAuth2:
          - api://vehicle-service/.default
          - api://vehicle-service/vehicles.comments.write
      summary: Create NetworkCycle comment
      description: Add a comment to a network cycle
      operationId: addNetworkCycleComment
      tags:
        - Vehicles
      parameters:
        - in: header
          name: tenant-id
          description: The tenant id
          required: true
          schema:
            type: string
        - in: path
          name: idVin
          description: The unique id of the vehicle
          required: true
          schema:
            type: integer
            format: int64
        - in: path
          name: bootCycleId
          description: The unique id of the boot cycle
          required: true
          schema:
            type: integer
            format: int64
        - in: path
          name: networkCycleId
          description: The unique id of the network cycle
          required: true
          schema:
            type: integer
            format: int64
      requestBody:
        description: The comment to add to the network cycle
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/POSTCanLogComment"
      responses:
        "201":
          description: "Comment added successfully."
          content:
            application/json:
              schema:
                type: object
                properties:
                  commentId:
                    type: integer
                    format: int64
              example:
                commentId: 56010833
        "400":
          $ref: "#/components/responses/400"
  /vehicles/{idVin}/can-logs/{bootCycleId}/files:
    get:
      security:
        - OAuth2:
          - api://vehicle-service/.default
          - api://vehicle-service/vehicles.get
      summary: Get CAN Log files
      description: Get individual CAN log files for a boot cycle
      operationId: getVehicleCanLogFiles
      tags:
        - Vehicles
      parameters:
        - in: header
          name: tenant-id
          description: The tenant id
          required: true
          schema:
            type: string
        - in: path
          name: idVin
          description: The unique id of the vehicle
          required: true
          schema:
            type: integer
            format: int64
        - in: path
          name: bootCycleId
          description: The unique id of the boot cycle
          required: true
          schema:
            type: integer
            format: int64
        - in: query
          name: networkOn
          description: Filter by network on status (0, 1 or 2)
          required: false
          schema:
            type: integer
            enum: [0, 1, 2]
          example: 1
        - in: query
          name: idNetworkCycle
          description: Filter by network cycle id
          required: false
          schema:
            type: integer
            format: int64
      responses:
        "200":
          description: An array of CAN log files
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CanLogFiles"
        "400":
          $ref: "#/components/responses/400"
        "404":
          $ref: "#/components/responses/404"
  /vehicles/{idVin}/can-logs/{bootCycleId}/files/{idCanlog}/comments:
    get:
      security:
        - OAuth2:
          - api://vehicle-service/.default
            - api://vehicle-service/vehicles.comments.read
      summary: Get CAN Log file comments
      operationId: getCanLogFileComments
      tags:
        - Vehicles
      parameters:
        - in: header
          name: tenant-id
          description: The tenant id
          required: true
          schema:
            type: string
        - in: path
          name: idVin
          description: The unique id of the vehicle
          required: true
          schema:
            type: integer
            format: int64
        - in: path
          name: bootCycleId
          description: The unique id of the boot cycle
          required: true
          schema:
            type: integer
            format: int64
        - in: path
          name: idCanlog
          description: The unique id of the CAN log file
          required: true
          schema:
            type: integer
            format: int64
      responses:
        "200":
          description: An array of comments for the CAN log file
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CanLogComments"
        "400":
          $ref: "#/components/responses/400"
        "404":
          $ref: "#/components/responses/404"
    post:
      security:
        - OAuth2:
          - api://vehicle-service/.default
          - api://vehicle-service/vehicles.comments.write
      summary: Create new CAN Log file comment
      operationId: addCanLogFileComment
      tags:
        - Vehicles
      parameters:
        - in: header
          name: tenant-id
          description: The tenant id
          required: true
          schema:
            type: string
        - in: path
          name: idVin
          description: The unique id of the vehicle
          required: true
          schema:
            type: integer
            format: int64
        - in: path
          name: bootCycleId
          description: The unique id of the boot cycle
          required: true
          schema:
            type: integer
            format: int64
        - in: path
          name: idCanlog
          description: The unique id of the CAN log file
          required: true
          schema:
            type: integer
            format: int64
      requestBody:
        description: The comment to add to the CAN log file
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/POSTCanLogComment"
      responses:
        "201":
          description: "Comment added successfully."
          content:
            application/json:
              schema:
                type: object
                properties:
                  commentId:
                    type: integer
                    format: int64
              example:
                commentId: 56010833
        "400":
          $ref: "#/components/responses/400"
  /vehiclesearch:
    get:
      security:
        - OAuth2:
          - api://vehicle-service/.default
          - api://vehicle-service/vehicles.get
      summary: Search for Vehicles
      operationId: searchVehicles
      tags:
        - Vehicles
      parameters:
        - in: header
          name: tenant-id
          description: The tenant id
          required: true
          schema:
            type: string
        - in: query
          name: activeFlags
          description: A list of activeFlag values to select vehicles
          required: false
          schema:
            type: array
            items:
              type: integer
        - in: query
          name: allQuery
          description: A query to find vehicles whose properties contain the provided value
          required: false
          schema:
            type: string
        - in: query
          name: body
          description: A list of bodies to filter vehicles.
          required: false
          schema:
            type: array
            items:
              type: string
        - in: query
          name: build
          description: A list of builds to filter vehicles.
          required: false
          schema:
            type: array
            items:
              type: string
        - in: query
          name: emission
          description: A list of emissions to filter vehicles.
          required: false
          schema:
            type: array
            items:
              type: string
        - in: query
          name: engine
          description: A list of engines to filter vehicles.
          required: false
          schema:
            type: array
            items:
              type: string
        - in: query
          name: fleet
          description: A list of fleets to filter vehicles.
          required: false
          schema:
            type: array
            items:
              type: string
        - in: query
          name: fleetQuery
          description: A query to find vehicles whose fleet contains the provided value
          required: false
          schema:
            type: string
        - in: query
          name: idPackages
          description: A list of idPackages to select vehicles.
          required: false
          schema:
            type: array
            items:
              type: integer
        - in: query
          name: idStatuses
          description: A list of idStatuses to select vehicles.
          required: false
          schema:
            type: array
            items:
              type: integer
        - in: query
          name: idVdr
          description: A list of strings uniquely identifying Vdrs in the system
          required: false
          schema:
            type: array
            items:
              type: string
        - in: query
          name: maxLastData
          description: A maximum lastData value
          required: false
          schema:
            type: integer
            format: int64
        - in: query
          name: maxLastPulseTs
          description: A maximum lastPulseTs value
          required: false
          schema:
            type: integer
            format: int64
        - in: query
          name: minLastData
          description: A minimum lastData value
          required: false
          schema:
            type: integer
            format: int64
        - in: query
          name: minLastPulseTs
          description: A minimum lastPulseTs value
          required: false
          schema:
            type: integer
            format: int64
        - in: query
          name: modelYear
          description: A list of modelYears to filter vehicles.
          required: false
          schema:
            type: array
            items:
              type: integer
        - in: query
          name: packageQuery
          description: A query to find vehicles whose package contains the provided value
          required: false
          schema:
            type: string
        - in: query
          name: pageNumber
          description: The 1-indexed page number of the results to return. Defaults to 1
          required: false
          schema:
            type: integer
            format: int32
        - in: query
          name: pageSize
          description: The 1-indexed page number of the results to return. Defaults to 10
          required: false
          schema:
            type: integer
            format: int32
        - in: query
          name: sort
          description: The attribute to sort the vehicle search results by ('-' prefix means descending order)
          schema:
            type: string
            enum:
              [
                "fleet",
                "-fleet",
                "idConfig",
                "-idConfig",
                "lastData",
                "-lastData",
                "vehicleNo",
                "-vehicleNo",
                "vin",
                "-vin",
                "lastPulseTs",
                "-lastPulseTs",
                "modelYear",
                "-modelYear",
              ]
          example: "-lastData"
        - in: query
          name: testGroup
          description: A list of testGroups to filter vehicles.
          required: false
          schema:
            type: array
            items:
              type: string
        - in: query
          name: transmission
          description: A list of transmissions to filter vehicles.
          required: false
          schema:
            type: array
            items:
              type: string
        - in: query
          name: vehicleNumber
          description: A list of vehicleNumbers to filter vehicles.
          required: false
          schema:
            type: array
            items:
              type: string
        - in: query
          name: vehicleNumberQuery
          description: A query to find vehicles whose vehicle number contains the provided value
          required: false
          schema:
            type: string
        - in: query
          name: vinQuery
          description: A query to find vehicles whose VIN contains the provided value
          required: false
          schema:
            type: string
        - in: query
          name: dlVersion
          description: A query to find vehicles whose dlVersion contains the provided value
          required: false
          schema:
            type: string
        - in: query
          name: idConfig
          description: A list of idConfigs to select vehicles.
          required: false
          schema:
            type: array
            items:
              type: integer
        - in: query
          name: idVins
          description: A list of idVins to select vehicles.
          required: false
          schema:
            type: array
            items:
              type: integer
              format: int64
        - in: query
          name: fields
          description: A flexible query parameter which determines which fields to set in the resource being returned as response and rest of the fields will be null.
          required: false
          schema:
            type: string
            example: idVin, statusHistory.status
        - in: query
          name: oboOid
          description: An optional query parameter to attempt to override the user for the request. If principal is authorized to use oboOid, the request will behave like the oboOid user is sending the request instead of the current principal
          required: false
          schema:
            type: string
      responses:
        "200":
          description: A page of Vehicle data models and the pagination metadata
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/VehicleSearchResultObject"
        "400":
          $ref: "#/components/responses/400"
        "403":
          $ref: "#/components/responses/403"
        "404":
          $ref: "#/components/responses/404"
  /kronos/files:
    get:
      tags:
        - kronos
      summary: Search Kronos Files
      description: Search Kronos Files that have been converted from SQLite
      operationId: getFiles
      security:
        - OAuth2:
          - api://vehicle-service/.default
          - api://vehicle-service/kronos.read
      parameters:
        - in: header
          name: tenant-id
          description: The tenant id
          required: true
          schema:
            type: string
        - in: query
          name: idFiles
          description: Search for KronosFiles based on the KronosFile.idFile property given a set of idFiles
          required: false
          schema:
            type: array
            items:
              type: integer
              format: int32
        - in: query
          name: idVins
          description: VIN of vehicle being searched for
          required: false
          schema:
            type: array
            items:
              type: integer
              format: int64
        - in: query
          name: idsqlites
          description: id of SQLite being searched for
          required: false
          schema:
            type: array
            items:
              type: integer
              format: int64
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/KronosFiles"
        "404":
          description: No files found
        "500":
          description: Internal Server Error
  /kronos/vehicles:
    get:
      tags:
        - kronos
      summary: Get Kronos Vehicles
      operationId: getKronosVehicles
      security:
        - OAuth2:
          - api://vehicle-service/.default
          - api://vehicle-service/kronos.read
      parameters:
        - in: header
          name: tenant-id
          description: The tenant id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/KronosVehicles"
  # RVD DATA
  /rvddataconfigs:
    post:
      security:
        - OAuth2:
            - api://vehicle-service/.default
      summary: Create RvdDataConfiguration.
      description: Creates a new RvdDataConfiguration. A RvdDataConfiguration is something that holds all the necessary information to be able to aggregate RvdData.
      operationId: createNewRvdDataConfig
      tags:
        - Rvd Data Configuration
      parameters:
        - in: header
          name: tenant-id
          description: The tenant id
          required: true
          schema:
            type: string
      requestBody:
        description: The structure for a request to create a new Rvd Data Configuration
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/RvdDataConfig"
      responses:
        "200":
          description: The created RvdDataConfig
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RvdDataConfig"
        "400":
          $ref: "#/components/responses/400"
    get:
      security:
        - OAuth2:
          - api://vehicle-service/.default
      summary: Search RvdDataConfigurations
      description: Query for all of the User's Rvd Configs as well as any public resources.
      operationId: getRvdDataConfigs
      tags:
        - Rvd Data Configuration
      parameters:
        - in: header
          name: tenant-id
          description: The tenant id
          required: true
          schema:
            type: string
        - in: query
          name: includes
          description: What related resources to include in the response. Available related resources [columns]
          required: false
          schema:
            type: string
      responses:
        "200":
          description: The model containing search results for the RvdDataConfig resources
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RvdDataConfigSearchResults"
        "400":
          $ref: "#/components/responses/400"
  /rvddataconfigs/{id}:
    get:
      security:
        - OAuth2:
          - api://vehicle-service/.default
      summary: Get RvdDataConfig
      description: Get the RvdDataConfig for a given id if the user has access to it.
      operationId: getRvdDataConfigById
      tags:
        - Rvd Data Configuration
      parameters:
        - in: header
          name: tenant-id
          description: The tenant id
          required: true
          schema:
            type: string
        - in: path
          name: id
          description: The id of the RvdDataConfig resource
          required: true
          schema:
            type: integer
            format: int64
      responses:
        "200":
          description: The RvdDataConfig resource
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RvdDataConfigSearchResults"
        "400":
          $ref: "#/components/responses/400"
  /rvddataconfigs/{id}/data:
    get:
      security:
        - OAuth2:
          - api://vehicle-service/.default
      summary: Get RvdData 
      description: Get the RvdData for a given RvdDataConfig resource.
      operationId: getRvdData
      tags:
        - Rvd Data
      parameters:
        - in: header
          name: tenant-id
          description: The tenant id
          required: true
          schema:
            type: string
        - in: path
          name: id
          description: The id of the RvdDataConfig resource in which we want to get data for
          required: true
          schema:
            type: integer
            format: int64
        - in: query
          name: idVins
          description: The id for the Vehicle in which we are aggregating RvdData
          required: true
          schema:
            type: array
            items:
              type: integer
              format: int64
        - in: query
          name: minTime
          description: The lower limit for the time
          required: true
          schema:
            type: integer
            format: int64
        - in: query
          name: maxTime
          description: The upper limit for the time
          required: true
          schema:
            type: integer
            format: int64
        - in: query
          name: pageNumber
          description: The page number of data we are looking at
          required: true
          schema:
            type: integer
        - in: query
          name: pageSize
          description: The number of records per page
          required: true
          schema:
            type: integer
        - name: idConfigs
          in: query
          description: "Identifier for a single configuration that might be used for filtering."
          required: false
          schema:
            type: array
            items:
              type: integer
              format: int64
      responses:
        "200":
          description: The aggregated RvdDataResults.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RvdDataResults"
        "400":
          $ref: "#/components/responses/400"
  /rvdparameters:
    get:
      security:
        - OAuth2:
          - api://vehicle-service/.default
      summary: Get RvdParameters
      description: Get a set of RvdParameterDefinition(s) available for the customer to choose from when creating or editing configs.
      operationId: getRvdParameterDefinitions
      tags:
        - Rvd Parameters
      parameters:
        - in: header
          name: tenant-id
          description: The tenant id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: The Rvd Parameters options available for the configs.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RvdParameterDefinitions"
        "400":
          $ref: "#/components/responses/400"
components:
  responses:
    "400":
      description: "Bad Request. Server cannot process request"
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
    "403":
      description: "Forbidden. Unable to fulfill request for authenticated user"
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
    "404":
      description: "NotFound. Can't find the requested resource"
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
  securitySchemes:
    OAuth2: # <---- arbitrary name
      type: oauth2
      description: "This API uses OAuth 2 with Microsoft Entra ID provider for authentication and authorization."
      flows:
        implicit: # <---- OAuth flow(authorizationCode, implicit, password or clientCredentials)
          authorizationUrl: https://login.microsoftonline.com/4ea0a50e-341e-4eb1-9c44-88b724ac50c4/oauth2/v2.0/authorize
          scopes:
            api://vehicle-service/.default: Get all API permissions granted to client application.
            api://vehicle-service/vehicles.get: GET vehicle resources.
            api://vehicle-service/vehicles.update: Update vehicle resources.
            api://vehicle-service/statuses.get: List and read vehicle statuses.
            api://vehicle-service/vehicles.comments.read: Read comments about a vehicle.
            api://vehicle-service/vehicles.comments.write: Write new comments to a vehicle.
            api://vehicle-service/vehicles.write: Create new vehicles.
            api://vehicle-service/packages.read: List packages available
            api://vehicle-service/packages.write: Create a new package
            api://vehicle-service/fleets.read: List fleets available
  schemas:
    RvdDataConfigSearchResults:
      type: object
      description: The results when querying for RvdDataConfig resources.
      required:
        - rvdDataConfigs
      properties:
        rvdDataConfigs:
          type: array
          items:
            $ref: "#/components/schemas/RvdDataConfig"
    # Rvd data config
    RvdDataConfig:
      type: object
      required:
        - name
        - description
        - isPublic
        - rvdDataType
      properties:
        id:
          type: integer
          format: int64
          readOnly: true
        rvdDataType:
          type: string
          enum: [trip, charge]
          description: "The type of data that this RvdDataConfig is responsible for organizing."
        name:
          type: string
          description: A value to describe the RvdDataConfig to other people.
        description:
          type: string
          description: A longer explaination to describe the RvdDataConfig. Can be used to describe the config in more detail.
        isPublic:
          type: boolean
          description: Flag to set whether this RvdDataConfig is public or not.
        columns:
          description: A set of column definitions for the configuration. This describes the columns that we want to select data for.
          $ref: "#/components/schemas/RvdDataColumns"
    RvdDataColumns:
      type: object
      required:
        - columnDefinitions
      properties:
        columnDefinitions:
          type: array
          description: A set of columns. Each column contains a name and a parameter definition for the column
          items:
            $ref: "#/components/schemas/RvdDataColumnDefinition"
    RvdDataColumnDefinition:
      type: object
      description: A combination of a name for the column to be displayed in views. Then the parameter definition used for the values in the column
      required:
        - name
        - parameter
      properties:
        name:
          type: string
          description: A descriptive name for the data column
        parameter:
          description: The columns parameter definition used for the values in the data.
          $ref: "#/components/schemas/RvdParameterDefinition"
    RvdParameterDefinitions:
      type: object
      required:
        - parameterDefinitions
      properties:
        parameterDefinitions:
          type: array
          description: A set of all available RvdParameterDefinition resources
          items:
            $ref: "#/components/schemas/RvdParameterDefinition"
    RvdParameterDefinition:
      type: object
      required:
        - key
      properties:
        key:
          description: A unique key for the available parameters
          type: string
    # RVD Data Results
    RvdDataResults:
      type: object
      required:
        - rvdDataConfig
        - rvdData
      properties:
        pagination:
          $ref: "#/components/schemas/SearchPagination"
        rvdDataConfig:
          description: The related RvdDataConfig that is responsible for organizing the data.
          $ref: "#/components/schemas/RvdDataConfig"
        rvdData:
          type: array
          items:
            $ref: "#/components/schemas/RvdData"
    RvdData:
      type: object
      description: RvdData results are modeled with a summary and an array of details
      required:
        - summary
        - details
      properties:
        idTrip:
          type: integer
          format: int64
        summary:
          $ref: "#/components/schemas/RvdDataRecord"
        details:
          type: array
          items:
            $ref: "#/components/schemas/RvdDataRecord"
    RvdDataRecord:
      type: object
      required:
        - id
        - rvdDataType
        - idFile
        - ts
        - parameterData
      properties:
        id:
          type: integer
          format: int64
        rvdDataType:
          type: string
          enum: [trip, charge]
        idFile:
          type: integer
          format: int64
        ts:
          type: integer
          format: int64
        parameterData:
          $ref: "#/components/schemas/RvdParameterData"
    RvdParameterData:
      type: object
      required:
        - parameterDataValues
      properties:
        parameterDataValues:
          type: array
          description: A set of parameter data values. The data is related through the key of the column definition and key in the RvdParameterDataValue model
          items:
            $ref: "#/components/schemas/RvdParameterDataValue"
    RvdParameterDataValue:
      type: object
      description: A model to hold the parameter data value. The data provided can be of two different types. Float or string. The dataType will be set to f(float64) or s(string). If dataType is set to f the value will be in the floatValue property. If the dataType is s the value will be in the stringValue property.
      required:
        - key
        - dataType
      properties:
        key:
          type: string
        dataType:
          type: string
          enum: [f, s]
        floatValue:
          type: number
          format: float64
        stringValue:
          type: string
    ErrorResponse:
      type: object
      properties:
        detail:
          type: string
        instance:
          type: string
        title:
          type: string
        type:
          type: string
          description: A human-readable error type or a URI. Any consumption of this MUST allow a URI of a human-readable description.
    SearchPagination:
      type: object
      properties:
        pageCount:
          type: integer
          format: int32
        pageNumber:
          type: integer
          format: int32
        pageSize:
          type: integer
          format: int32
        totalCount:
          type: integer
          format: int32
    Vehicles:
      type: array
      items:
        $ref: "#/components/schemas/Vehicle"
    Vehicle:
      type: object
      required:
        - vin
      properties:
        idVin:
          type: integer
          format: int64
        vin:
          type: string
        idVdr:
          type: string
          description: |
            idVdr property used in the POST /vehicles endpoint in order to determine what VDR the vehicle being created should be bound to.
            This property is only used in the POST endpoint. TODO: come up with efficient method of populating a vehicles model with the 
            idVdr based on the latest known binding retreived from the VDR vdrvehiclebinding resource. The requirement is when a vehicle is created
            using the POST /vehicles endpoint. This property should be used in a transitive request to the Vdr API when creating the binding.
        vehicleNo:
          type: string
        fleet:
          type: string
        project:
          type: string
        make:
          type: string
        model:
          type: string
        modelYear:
          type: integer
        idPackage:
          type: integer
        external_feed:
          type: integer
        mfgCode:
          type: string
        plantCode:
          type: string
        buildLevel:
          type: string
        drivetrain:
          type: string
        emissions:
          type: string
        market:
          type: string
        banks:
          type: integer
        axleRatio:
          type: number
          format: double
        fuelType:
          type: string
        tireSize:
          type: string
        engineController:
          type: string
        location:
          type: string
        autostick:
          type: boolean
        beginTestDate:
          type: integer
          format: int64
        endTestDate:
          type: integer
          format: int64
        testType:
          type: string
        color:
          type: string
        trim:
          type: string
        incharge:
          type: integer
        idStatus:
          type: integer
        comment:
          type: string
        dlSerial:
          type: string
        dlVersion:
          type: string
        calibration:
          type: string
        calFamily:
          type: string
        calibration2:
          type: string
        calFamily2:
          type: string
        lastData:
          type: integer
          format: int64
        lastIdEvent:
          type: integer
        activeFlag:
          type: boolean
        updatedBy:
          type: integer
        updatedTs:
          type: integer
          format: int64
        radio:
          type: string
        nav:
          type: string
        gpsLatitude:
          type: string
        gpsLongitude:
          type: string
        odometer:
          type: integer
        startOdometer:
          type: integer
        testDistance:
          type: integer
        lastGpsTs:
          type: integer
          format: int64
        idConfig:
          type: integer
        idArchitecture:
          type: integer
        packNo:
          type: string
        testGroup:
          type: string
        lastPulseTs:
          type: integer
          format: int64
        idsFleet:
          type: string
        custodian:
          type: string
        bodyStyle:
          type: string
        powerOption:
          type: string
        testLocation:
          type: string
        tcase:
          type: string
        commentId:
          type: integer
        createdTs:
          type: integer
          format: int64
        package:
          $ref: "#/components/schemas/VehiclePackage"
        statusHistory:
          type: array
          items:
            $ref: "#/components/schemas/VehicleStatusHistory"
    VehicleStatusHistory:
      type: object
      properties:
        updatedBy:
          type: string
          example: John Smith
        status:
          $ref: "#/components/schemas/VehicleStatus"
        updatedTs:
          type: string
          example: 2015-12-08 17:37:45
    VehicleSearchResultObject:
      type: object
      properties:
        pagination:
          $ref: "#/components/schemas/SearchPagination"
        vehicles:
          $ref: "#/components/schemas/Vehicles"
    Build:
      type: object
      properties:
        idBuild:
          type: string
        value:
          type: string
    Builds:
      type: array
      items:
        $ref: "#/components/schemas/Build"
    Calibration:
      type: object
      properties:
        idCalibration:
          type: integer
          format: int64
        value:
          type: string
    Calibrations:
      type: array
      items:
        $ref: "#/components/schemas/Calibration"
    Emission:
      type: object
      properties:
        idEmission:
          type: string
        value:
          type: string
    Emissions:
      type: array
      items:
        $ref: "#/components/schemas/Emission"
    Fleets:
      type: array
      items:
        $ref: "#/components/schemas/Fleet"
    Fleet:
      type: object
      properties:
        idFleet:
          type: string
        value:
          type: string
    ModelYear:
      type: object
      properties:
        idModelYear:
          type: integer
        value:
          type: integer
    ModelYears:
      type: array
      items:
        $ref: "#/components/schemas/ModelYear"
    Packages:
      type: array
      items:
        $ref: "#/components/schemas/VehiclePackage"
    UpdateVehiclePackageRequestObject:
      type: object
      properties:
        idPackage:
          type: integer
        title:
          type: string
          description: The title of the update request
        reason:
          type: string
          description: The reason for the update request
    CreateVehiclePackageRequestObject:
      type: object
      properties:
        engine:
          type: string
        body:
          type: string
        transmission:
          type: string
    TestGroup:
      type: object
      properties:
        idTestGroup:
          type: string
        value:
          type: string
    TestGroups:
      type: array
      items:
        $ref: "#/components/schemas/TestGroup"
    VehiclePackage:
      type: object
      properties:
        idPackage:
          type: integer
        packageConcatString:
          type: string
        engine:
          $ref: "#/components/schemas/Engine"
        body:
          $ref: "#/components/schemas/Body"
        transmission:
          $ref: "#/components/schemas/Transmission"
    Engine:
      type: object
      properties:
        idEngine:
          type: integer
          format: int64
        engine:
          type: string
        activeFlag:
          type: integer
        allowEdit:
          type: integer
    Body:
      type: object
      properties:
        idBody:
          type: integer
          format: int64
        body:
          type: string
        idBodyHash:
          type: integer
        activeFlag:
          type: integer
        allowEdit:
          type: integer
    Transmission:
      type: object
      properties:
        idTransmission:
          type: integer
          format: int64
        transmission:
          type: string
        activeFlag:
          type: integer
        allowEdit:
          type: integer
    VehicleComments:
      type: array
      items:
        $ref: "#/components/schemas/VehicleComment"
    VehicleComment:
      type: object
      properties:
        idComment:
          type: integer
          format: int64
        comment:
          type: string
        idVin:
          type: integer
          format: int64
        updatedBy:
          type: integer
          format: int64
        updatedTs:
          type: integer
          format: int64
        editedTs:
          type: integer
          format: int64
    POSTVehicleComment:
      type: object
      required:
        - comment
      properties:
        comment:
          type: string
      example:
        comment: "This is my favorite vehicle."
    VehicleStatus:
      type: object
      properties:
        idStatus:
          type: integer
          format: int64
        name:
          type: string
        initialState:
          type: boolean
        isCompletedType:
          type: boolean
        isIdleType:
          type: boolean
    VehicleStatuses:
      type: array
      items:
        $ref: "#/components/schemas/VehicleStatus"
    KronosFile:
      type: object
      properties:
        filename:
          type: string
          description: The name of this file
          example: "European Diesel.mf4"
        tsFile:
          type: integer
          format: int64
          description: The ts_file of this file as an epoch
          example: 1652985787
        importer:
          type: string
          description: The job_email for this file
        tsImport:
          type: integer
          format: int64
          description: The ts_of_import for this file as an epoch
        idJob:
          type: integer
          format: int32
          description: The id_kronos_job_sqlite for this file
        idFile:
          type: integer
          format: int32
          description: The id_file_kronos for this file
        location:
          type: string
          description: S3 bucket location of this file
          example: div101/2022/04/19/kronos_file.zip
        locationSqlite:
          type: string
          description: The sqlite_location of this file on s3
          example: data_processing_services/kronos/sqlite/div101/2022/04/23/identifier/filename.mf4.sqlite.zip
        urlAcg:
          type: string
          description: This is an AC-Graph link for this file
          example: https://www.ac-graph.com/kronos-file
    KronosFiles:
      type: array
      items:
        $ref: "#/components/schemas/KronosFile"
    KronosVehicle:
      allOf:
        - $ref: "#/components/schemas/Vehicle"
        - type: object
          properties:
            tsLastData:
              type: integer
              format: int64
              description: The last time data was updated for this vehicle as an epoch timestamp
              example: 1652985787
            tsLastImport:
              type: integer
              format: int64
              description: The last time a file was imported for this vehicle as an epoch timestamp
              example: 1652985787
    KronosVehicles:
      type: array
      items:
        $ref: "#/components/schemas/KronosVehicle"
    CanLogBootCycles:
      type: array
      items:
        $ref: "#/components/schemas/CanLogBootCycle"
    CanLogBootCycle:
      type: object
      properties:
        idBootCycle:
          type: integer
          format: int64
          description: The unique identifier of the boot cycle
        bootCycleStart:
          type: string
          format: date-time
          description: The start timestamp of the boot cycle
        bootCycleEnd:
          type: string
          format: date-time
          description: The end timestamp of the boot cycle
        networkCycleCount:
          type: integer
          description: Number of network cycles in this boot cycle
        totalFileCount:
          type: integer
          description: Total number of files in this boot cycle
        totalLengthMs:
          type: integer
          format: int64
          description: Total length in milliseconds
        totalRxError:
          type: integer
          description: Total receive errors
        totalTxError:
          type: integer
          description: Total transmit errors
        dlVersion:
          type: string
          description: Datalogger version
        dlSerial:
          type: string
          description: Datalogger serial number
        idConfig:
          type: integer
          format: int64
          description: Configuration identifier
        networkOn:
          type: integer
          description: Network on status
        processedFiles:
          type: integer
          description: Number of processed files
        missingFiles:
          type: integer
          description: Number of missing files
    CanLogNetworkCycles:
      type: array
      items:
        $ref: "#/components/schemas/CanLogNetworkCycle"
    CanLogNetworkCycle:
      type: object
      properties:
        idBootCycle:
          type: integer
          format: int64
          description: The unique identifier of the boot cycle
        idNetworkCycle:
          type: integer
          format: int64
          description: The unique identifier of the network cycle
        networkCycleStart:
          type: string
          format: date-time
          description: The start timestamp of the network cycle
        networkCycleEnd:
          type: string
          format: date-time
          description: The end timestamp of the network cycle
        fileCount:
          type: integer
          description: Number of files in this network cycle
        totalLengthMs:
          type: integer
          format: int64
          description: Total length in milliseconds
        totalRxError:
          type: integer
          description: Total receive errors
        totalTxError:
          type: integer
          description: Total transmit errors
        networkOn:
          type: integer
          description: Network on status
        processedFiles:
          type: integer
          description: Number of processed files
        missingFiles:
          type: integer
          description: Number of missing files
    CanLogFiles:
      type: array
      items:
        $ref: "#/components/schemas/CanLogFile"
    CanLogFile:
      type: object
      properties:
        idFcl:
          type: integer
          format: int64
          description: The unique identifier of the file
        filename:
          type: string
          description: The name of the CAN log file
        fileTs:
          type: string
          format: date-time
          description: The file timestamp
        stopTs:
          type: string
          format: date-time
          description: The stop timestamp
        fileLengthMs:
          type: integer
          format: int64
          description: File length in milliseconds
        idBootCycle:
          type: integer
          format: int64
          description: The boot cycle identifier
        idNetworkCycle:
          type: integer
          format: int64
          description: The network cycle identifier
        idCanlog:
          type: integer
          format: int64
          description: The CAN log identifier
        networkCycleFileNumber:
          type: integer
          description: Network cycle file number
        fileSize:
          type: integer
          format: int64
          description: File size in bytes
        networkOn:
          type: integer
          description: Network on status
        rxError:
          type: integer
          description: Receive errors
        txError:
          type: integer
          description: Transmit errors
    CanLogComments:
      type: array
      items:
        $ref: "#/components/schemas/CanLogComment"
    CanLogComment:
      type: object
      properties:
        commentId:
          type: integer
          format: int64
          description: The unique identifier of the comment
        comment:
          type: string
          description: The comment text
        idVin:
          type: integer
          format: int64
          description: Vehicle identifier
        idBootCycle:
          type: integer
          format: int64
          description: Boot cycle identifier
        idNetworkCycle:
          type: integer
          format: int64
          description: Network cycle identifier
        idCanlog:
          type: integer
          format: int64
          description: CAN log identifier
        updatedBy:
          type: integer
          format: int64
          description: User who updated the comment
        updatedTs:
          type: integer
          format: int64
          description: Timestamp when comment was created/updated
        editedTs:
          type: integer
          format: int64
          description: Timestamp when comment was edited
    POSTCanLogComment:
      type: object
      required:
        - comment
      properties:
        comment:
          type: string
          description: The comment text
      example:
        comment: "0x720 0x404C present"
