openapi: "3.0.3"
info:
  title: ABT Service CRUD APIs
  version: "1.0"
  description: CRUD APIs for ABT Service processes.
servers:
  - url: https://api.integratielaag.nl/v1/service
paths:
  /tokenregisterrequests:
    get:
      summary: Get all token register requests.
      description: Get all token register requests.
      tags:
        - NFC Reader
      parameters:
        - in: query
          name: readerId
          schema:
            type: string
            example: b14b0320-2b72-48bb-990b-b97a2d67f9df
          explode: false
          required: false
          description: Filter on possible NFC reader ids.
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TokenRegisterRequestsGetResponse"
              examples:
                Single TokenRegisterRequest:
                  summary: Single TokenRegisterRequest
                  value:
                    {
                      "tokenRegisterRequests":
                        [
                          {
                            "readerId": "b14b0320-2b72-48bb-990b-b97a2d67f9df",
                            "xBot": "4bfaede2-a6c9-45dd-8a80-1f83a075a115",
                            "updated": "2025-07-02T15:01:00.000+00:00",
                          },
                        ],
                    }
                Multiple TokenRegisterRequests:
                  summary: Multiple TokenRegisterRequests
                  value:
                    {
                      "tokenRegisterRequests":
                        [
                          {
                            "readerId": "b14b0320-2b72-48bb-990b-b97a2d67f9df",
                            "xBot": "4bfaede2-a6c9-45dd-8a80-1f83a075a115",
                            "updated": "22025-07-02T15:01:00.000+00:00",
                          },
                          {
                            "readerId": "b4d8e43c-be21-472c-955b-a0c7c11b4bfb",
                            "xBot": "625bc66b-a5de-42fc-ba9e-fb02ada4a4ee",
                            "updated": "2025-07-02T13:37:07.000+00:00",
                          },
                        ],
                    }
  /tokenregisterrequests/{readerId}:
    parameters:
      - in: path
        name: readerId
        required: true
        description: The NFC reader id.
        schema:
          type: string
          example: b14b0320-2b72-48bb-990b-b97a2d67f9df
    put:
      summary: Insert or update token register request.
      description: Insert or update token register request.
      tags:
        - NFC Reader
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/TokenRegisterRequestPutRequest"
            example: { "xBot": "4bfaede2-a6c9-45dd-8a80-1f83a075a115" }
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TokenRegisterRequestPutResponse"
              example:
                {
                  "readerId": "b14b0320-2b72-48bb-990b-b97a2d67f9df",
                  "xBot": "4bfaede2-a6c9-45dd-8a80-1f83a075a115",
                  "updated": "2025-07-02T15:01:00.000+00:00",
                }
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TokenRegisterRequestPutResponse"
              example:
                {
                  "readerId": "b14b0320-2b72-48bb-990b-b97a2d67f9df",
                  "xBot": "4bfaede2-a6c9-45dd-8a80-1f83a075a115",
                  "updated": "2025-07-02T15:01:00.000+00:00",
                }
components:
  securitySchemes:
    bearerToken:
      type: http
      scheme: bearer
      bearerFormat: JWT
  schemas:
    TokenRegisterRequestsGetResponse:
      type: object
      properties:
        tokenRegisterRequests:
          type: array
          items:
            $ref: "#/components/schemas/TokenRegisterRequest"
    TokenRegisterRequestPutRequest:
      type: object
      properties:
        xBot:
          type: string
          format: uuid
          example: 4bfaede2-a6c9-45dd-8a80-1f83a075a115
          nullable: false
          description: The xBOT id.
      required:
        - xBot
    TokenRegisterRequestPutResponse:
        $ref: "#/components/schemas/TokenRegisterRequest"
    TokenRegisterRequest:
      type: object
      properties:
        readerId:
          type: string
          example: b14b0320-2b72-48bb-990b-b97a2d67f9df
          nullable: false
          description: The NFC reader id.
        xBot:
          type: string
          format: uuid
          example: 4bfaede2-a6c9-45dd-8a80-1f83a075a115
          nullable: false
          description: The xBOT id.
        updated:
          type: string
          format: date-time
          example: "2025-07-02T15:01:00+00:00"
          nullable: false
          description: The date and time when the token register request was updated.
      required:
        - readerId
        - xBot
        - updated
