openapi: 3.1.0
info:
  title: VCS API - Apigee
  description: >-
    VCS API documentation <h2>Authentication & Authorization</h2> <p>You will
    need to be identified before calling any VCS API endpoints. </p> <p>In order
    to be recognized and authorized to access our VCS API, we put in place 2
    mechanisms:</p><ul><li>Authentication mechanism is done with an API key
    dedicated to you. <br/>Remember that the API key provided should be shared
    with care.<br/> The API key must be inserted in the header of the request in
    the appropriate field</li><li>Authorization mechanism is done by a
    well-known authorization flow for REST Web API: <strong>“Client credentials”
    OAuth2.0 flow.</strong></li></ul>
  license:
    name: Internal usage only
    identifier: Internal
  version: 1.2.2
servers:
  - url: https://indus.api.euromaster.com
    description: APIGEE UAT
  - url: https://api.euromaster.com
    description: APIGEE PROD
tags:
  - name: Inspections
    description: Inspections operation with all operation types
paths:
  /vcs-erm/v1/inspections:
    summary: Inspections endpoints
    get:
      summary: Get inspections data
      description: Get inspections data filtered by parameters
      operationId: getInspections
      tags:
        - Inspections
      parameters:
        - in: query
          name: pageNumber
          schema:
            $ref: '#/components/schemas/PageNumberQueryParam'
          required: true
          description: The page number
        - in: query
          name: pageSize
          schema:
            $ref: '#/components/schemas/PageSizeQueryParam'
          required: true
          description: The page size
        - in: query
          name: lastModifiedDateFrom
          required: false
          description: Date from for last update date of data
          schema:
            $ref: '#/components/schemas/lastModifiedDateFromParam'
        - in: query
          name: lastModifiedDateTo
          required: false
          description: Date to for last update date of data
          schema:
            $ref: '#/components/schemas/lastModifiedDateToParam'
        - in: query
          name: managingServiceCenterCode
          required: false
          description: Managing service center code
          schema:
            $ref: '#/components/schemas/managingServiceCenterCodeParam'
        - in: query
          name: vehicleCode
          required: false
          description: Vehicle code param
          schema:
            $ref: '#/components/schemas/vehicleCodeParam'
      responses:
        '200':
          $ref: '#/components/responses/InspectionsResponseDTO'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestDTO'
              examples:
                InvalidPageSize:
                  value:
                    errors:
                      - error: must be greater than or equal to 1
                        property: pageSize
                InvalidPageNumber:
                  value:
                    errors:
                      - error: must be greater than or equal to 1
                        property: pageNumber
                InvalidDatesOrder:
                  value:
                    errors:
                      - error: 'dateFrom : 2024-07-01T00:00:00 is greater than dateTo'
                        property: lastModifiedDateFrom
        '401':
          $ref: '#/components/responses/UnauthorizedDTO'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestDTO'
              examples:
                InvalidPageSize:
                  value:
                    errors:
                      - error: The pageNumber must be lower than or equals to 3
                        property: pageNumber
        '500':
          $ref: '#/components/responses/InternalErrorDTO'
security:
  - OAuth2: []
    ApiKeyAuth: []
components:
  securitySchemes:
    OAuth2:
      type: oauth2
      flows: {}
    ApiKeyAuth:
      type: apiKey
      in: header
      name: clientid
  schemas:
    InspectionsResponseDTO:
      type: object
      properties:
        pagination:
          description: Pagination information
          $ref: '#/components/schemas/PaginationDTO'
        inspections:
          type: array
          maxItems: 1000
          items:
            description: Inspection information
            $ref: '#/components/schemas/InspectionDTO'
    InspectionDTO:
      type: object
      properties:
        code:
          type: string
          example: IP4122430S
          description: Inspection identifier
        vehicleCode:
          type: string
          maxLength: 255
          example: FZ-479-ZP
          description: Uniq identifier of the Vehicle (registration number)
        inspectorCode:
          type: string
          maxLength: 255
          example: xxx.yyy.zzz
          description: Inspector login
        locationCode:
          type: string
          maxLength: 255
          example: St Léon
          description: Location code of the inspection
        locationName:
          type: string
          maxLength: 255
          example: St Léon
          description: Location name of the inspection
        startDate:
          type: string
          example: '2024-04-09T06:55:46'
          description: Start date of the inspection
          pattern: >-
            ^([0-9]{4})-(?:[0-9]{2})-([0-9]{2})T([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])$
        endDate:
          type: string
          example: '2024-04-09T06:57:52'
          description: End date of the inspection
          pattern: >-
            ^([0-9]{4})-(?:[0-9]{2})-([0-9]{2})T([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])$
        customer:
          type: object
          properties:
            companyCode:
              type: string
              maxLength: 255
              example: SEMOCTOM
              description: Company code of the customer
            fleetCode:
              type: string
              maxLength: 255
              example: Semoctom
              description: Fleet code of the customer
            locationCode:
              type: string
              maxLength: 255
              example: St Léon
              description: Location code of the customer
            locationName:
              type: string
              maxLength: 255
              example: St Léon
              description: Location name of the customer
          required:
            - companyCode
            - fleetCode
            - locationCode
        serviceProvider:
          type: object
          properties:
            contractorCode:
              type: string
              maxLength: 255
              example: FR_BU_FRANCHISE_TAQUI
              description: Code of the business unit
            marketCode:
              type: string
              maxLength: 255
              example: FR_MA_FRANCHISE_TAQUI
              description: Market code
          required:
            - contractorCode
            - marketCode
        mileage:
          type: integer
          format: int32
          example: 120000
          description: Mileage of the vehicle during the inspection
        mileageUOM:
          type: string
          maxLength: 255
          example: km
          description: Mileage unit of measure
        type:
          type: string
          maxLength: 255
          description: Type of the inspection
        comments:
          type: string
          maxLength: 255
          description: Comments of the inspection
        managingServiceCenterCode:
          type: string
          maxLength: 255
          description: ''
        lastModifiedDate:
          type: string
          example: '2024-04-09T06:59:51'
          description: Last technical modification of the inspection
          pattern: >-
            ^([0-9]{4})-(?:[0-9]{2})-([0-9]{2})T([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])$
        measurements:
          type: array
          items:
            $ref: '#/components/schemas/MeasurementDTO'
        observations:
          type: array
          items:
            $ref: '#/components/schemas/ObservationDTO'
      required:
        - code
        - vehicleCode
        - inspectorCode
        - locationCode
        - startDate
        - endDate
        - type
        - lastModifiedDate
    MeasurementDTO:
      type: object
      properties:
        axlePosition:
          type: integer
          format: int32
          example: 1
          description: Axle position
        tyrePosition:
          type: integer
          format: int32
          example: 1
          description: Tyre position
        spareWheel:
          type: boolean
          example: false
          description: Boolean if spare_wheel
        tyreGroove:
          type: integer
          format: int32
          example: 2
          description: Tyre groove
        pressure:
          type: number
          format: float
          example: 2.3
          description: Pressure value
        pressureUOM:
          type: string
          maxLength: 255
          example: bar
          description: Pressure unit of measure
        treadDepth:
          type: number
          format: float
          example: 8.4
          description: Tread depth value
        treadDepthUOM:
          type: string
          maxLength: 255
          example: mm
          description: Tread depth unit of measure
      required:
        - axlePosition
        - tyrePosition
        - spareWheel
    ObservationDTO:
      type: object
      properties:
        axlePosition:
          type: integer
          format: int32
          example: 2
          description: Axle position
        tyrePosition:
          type: integer
          format: int32
          example: 3
          description: Tyre position
        spareWheel:
          type: boolean
          example: false
          description: Boolean if spare_wheel
        name:
          type: string
          maxLength: 255
          example: Irregular Wear
          description: Name of the observation
        type:
          type: string
          maxLength: 255
          example: Irregular Wear
          description: Type of the observation
        severity:
          type: string
          maxLength: 255
          example: Severe
          description: Severity of the observation
        actionName:
          type: string
          maxLength: 255
          example: Turn On Rim Urgent
          description: Name of the action to manage the observation
        actionLevel:
          type: string
          maxLength: 255
          example: Défaut
          description: Action level
      required:
        - tyrePosition
        - spareWheel
        - name
        - type
        - severity
        - actionName
        - actionLevel
    managingServiceCenterCodeParam:
      type: string
      description: managing service center code param
      maxLength: 255
    vehicleCodeParam:
      type: string
      example: AA-123-BB
      description: vehicle code param
      maxLength: 255
    PaginationDTO:
      type: object
      additionalProperties: false
      properties:
        next:
          type: string
          maxLength: 200
          description: Url for next page
          example: /vcs-erm/v1/inspections?page=3&size=50
        previous:
          type: string
          maxLength: 200
          description: Url for previous page
          example: /vcs-erm/v1/inspections?page=1&size=50
        pageTotal:
          type: integer
          format: int32
          example: '2'
          minimum: 0
          maximum: 1000
          description: Number total of page available
        totalElements:
          type: integer
          format: int32
          example: '200'
          minimum: 0
          maximum: 10000
          description: Number total of elements available
    lastModifiedDateFromParam:
      type: string
      format: date-time
      example: '2024-05-02T10:00:00'
      description: last modified date from, must have the format yyyy-MM-ddTHH:mm:ss
    lastModifiedDateToParam:
      type: string
      format: date-time
      example: '2024-05-02T10:00:00'
      description: last modified date to, must have the format yyyy-MM-ddTHH:mm:ss
    PageNumberQueryParam:
      type: integer
      format: int32
      example: '2'
      minimum: 1
      maximum: 1000
      description: The number of page requested, minimum 1
    PageSizeQueryParam:
      type: integer
      format: int32
      example: '2'
      minimum: 1
      maximum: 1000
      description: The size of the page
    BadRequestDTO:
      type: object
      properties:
        errors:
          type: array
          minItems: 1
          items:
            type: object
            properties:
              error:
                type: string
                format: string
                description: Error message
              property:
                type: string
                format: string
                description: The name of the field affected by the error
    ForbiddenDTO:
      type: object
      properties:
        errors:
          type: array
          minItems: 1
          items:
            type: object
            properties:
              error:
                type: string
                format: string
                description: Error message
              property:
                type: string
                format: string
                description: The name of the field affected by the error
    InternalErrorDTO:
      type: object
      properties:
        error:
          type: string
          example: Unexpected error
    UnauthorizedDTO:
      type: object
      properties:
        errors:
          type: array
          minItems: 1
          items:
            type: object
            properties:
              error:
                type: string
                format: string
                description: Error message
              property:
                type: string
                format: string
                description: The name of the field affected by the error
  responses:
    InspectionsResponseDTO:
      description: The Inspections response
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/InspectionsResponseDTO'
          examples:
            standardResponse:
              summary: Inspections
              value:
                pagination:
                  next: /vcs-erm/v1/inspections?page=3&size=50
                  previous: /vcs-erm/v1/inspections?page=1&size=50
                  pageTotal: '3'
                  totalElements: '125'
                inspections:
                  - code: IP4122430S
                    vehicleCode: FZ-479-ZP
                    inspectorCode: jeanluc.lartigue.taqui
                    locationCode: St Léon
                    locationName: St Léon
                    startDate: '2024-04-09T06:55:46'
                    endDate: '2024-04-09T06:57:52'
                    customer:
                      companyCode: SEMOCTOM
                      fleetCode: Semoctom
                      locationCode: St Léon
                      locationName: St Léon
                    serviceProvider:
                      contractorCode: FR_BU_FRANCHISE_TAQUI
                      marketCode: FR_MA_FRANCHISE_TAQUI
                    mileage: '120000'
                    mileageUOM: km
                    type: ''
                    comments: ''
                    managingServiceCenterCode: ''
                    lastModifiedDate: '2024-04-09T06:59:51'
                    measurements:
                      - axlePosition: '1'
                        typrePosition: '1'
                        spareWheel: false
                        tyreGroove: '2'
                        pressure: '2.3'
                        pressureUOM: bar
                        treadDepth: '8.4'
                        treadDepthUOM: mm
                    observations:
                      - axlePosition: '2'
                        tyrePosition: '3'
                        spareWheel: false
                        name: Irregular Wear
                        type: Irregular Wear
                        severity: Severe
                        actionName: Turn On Rim Urgent
                        actionLevel: Défaut
    UnauthorizedDTO:
      description: The requester is not recognized by our system.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/UnauthorizedDTO'
          examples:
            Unknown client id:
              summary: Unknown client id
              value:
                errors:
                  - error: Unknown client id, please contact our API service support
                    property: clientid
            Missing client id:
              summary: Missing client id
              value:
                errors:
                  - error: The client id is missing
                    property: clientid
            Bad credentials:
              summary: The credentials are wrong
              value:
                errors:
                  - error: The credentials are wrong
                    property: Authorization
            Missing credentials:
              summary: The credentials are missing
              value:
                errors:
                  - error: The credentials are missing
                    property: Authorization
    InternalErrorDTO:
      description: An internal error occurred
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/InternalErrorDTO'
          examples:
            internalError:
              summary: An internal error occurred
              value:
                errors:
                  - error: >-
                      An internal error occurred, please try again later. Thank
                      you for your understanding
