openapi: "3.0.3"
info:
  title: ABT Utility CRUD APIs
  version: "1.0"
  description: CRUD APIs for ABT Utility tables. These are NOT the functional APIs from Service Engine.
servers:
  - url: https://services.acc.api.htm.nl/abt/abtutility/1.0
paths:
  /scheduledactions:
    get:
      summary: Get all scheduled actions.
      description: Get all scheduled actions.
      tags:
        - ScheduledAction
      parameters:
        - in: query
          name: scheduledActionTypeId
          schema:
            type: array
            items:
              type: integer
          explode: false
          required: false
          description: Filter on possible ScheduledAction types. 1 = gbo-refund.
        - in: query
          name: scheduledActionStatusId
          schema:
            type: array
            items:
              type: integer
          explode: false
          required: false
          description: Filter on possible ScheduledAction statuses. 1 = created, 2 = pending, 3 = processed, 4 = failed.
        - in: query
          name: executionTimeFrom
          schema:
            type: string
            format: date-time
            example: 2024-07-02 15:01:00.000
          required: false
          description: Execution timestmap (from).
        - in: query
          name: executionTimeUntil
          schema:
            type: string
            format: date-time
            example: 2024-07-02 15:01:00.000
          required: false
          description: Execution timestmap (until).
        - in: query
          name: createdFrom
          schema:
            type: string
            format: date-time
            example: 2024-07-02 15:01:00.000
          required: false
          description: Find all tasks created from this timestamp.
        - in: query
          name: createdUntil
          schema:
            type: string
            format: date-time
            example: 2024-07-02 15:01:00.000
          required: false
          description: Find all tasks created until this timestamp.
        - in: query
          name: updatedFrom
          schema:
            type: string
            format: date-time
            example: 2024-07-02 15:01:00.000
          required: false
          description: Find all tasks updated from this timestamp.
        - in: query
          name: updatedUntil
          schema:
            type: string
            format: date-time
            example: 2024-07-02 15:01:00.000
          required: false
          description: Find all tasks updated until this timestamp.
        - in: query
          name: correlationId
          schema:
            type: string
            example: 65ad5520-4e62-41b7-89dd-a01be6cb78bf
          required: false
          description: Pointer to executor of this action (e.g. the batch job).
        - in: query
          name: role
          schema:
            type: string
            example: customer
          required: false
          description: Role of the user or process that initiated the action.
        - in: query
          name: user
          schema:
            type: string
            example: 1255ab39-2f10-409a-bf61-38c07e1b8a9e
          required: false
          description: User that initiated the action. In case of a customer this is the customer id.
        - in: query
          name: resourceName
          schema:
            type: string
            example: contracts
          required: false
          description: Name of the resource concerning the scheduled action.
        - in: query
          name: resourceIdentifier
          schema:
            type: string
            example: 65ad5520-4e62-41b7-89dd-a01be6cb78bf
          required: false
          description: Id of the resource concerning the scheduled action.
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ScheduledAction"
              example:
                {
                  "scheduledActions":
                    [
                      {
                        "scheduledActionId": "d1dd439b-6072-4b97-89c9-724268865b93",
                        "scheduledActionType":
                          { "scheduledActionTypeId": 1, "name": "gbo-refund" },
                        "scheduledActionStatus":
                          { "scheduledActionStatusId": 1, "name": "created" },
                        "executionTime": "2024-07-02 15:01:00.000",
                        "details": '{ "xspit": "", "xtat": "", "refundMethod": "", "refundAmount": "" }',
                        "result": '{ "result": "", "timestamp": "" }',
                        "created": "2024-07-02 15:01:00.000",
                        "updated": "2024-07-02 15:01:00.000",
                        "correlationId": "fb4443c6-5a6a-47a3-adf0-db3dfc183399",
                        "role": "customer",
                        "user": "1255ab39-2f10-409a-bf61-38c07e1b8a9e",
                        "scheduledActionResources":
                          [
                            {
                              "scheduledActionResourceId": "7e4b7d7a-4266-47c5-b482-f1a00379c493",
                              "resourceName":
                                { "resourceNameId": 1, "name": "contracts" },
                              "resourceIdentifier": "70d29a0a-176d-4184-8cba-08416eccb361",
                            },
                          ],
                      },
                    ],
                }
    post:
      summary: Add a new scheduled action.
      description: Add a new scheduled action.
      tags:
        - ScheduledAction
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ScheduledAction"
            example:
              {
                "scheduledAction":
                  {
                    "scheduledActionTypeId": 1,
                    "scheduledActionStatusId": 1,
                    "executionTime": "2024-07-02 15:01:00.000",
                    "details": '{ "xspit": "", "xtat": "", "refundMethod": "", "refundAmount": "" }',
                    "result": '{ "result": "", "timestamp": "" }',
                    "created": "2024-07-02 15:01:00.000",
                    "updated": "2024-07-02 15:01:00.000",
                    "correlationId": "fb4443c6-5a6a-47a3-adf0-db3dfc183399",
                    "role": "customer",
                    "user": "1255ab39-2f10-409a-bf61-38c07e1b8a9e",
                    "scheduledActionResources":
                      [
                        {
                          "resourceNameId": 1,
                          "resourceIdentifier": "70d29a0a-176d-4184-8cba-08416eccb361",
                        },
                      ],
                  },
              }
      responses:
        "201":
          description: CREATED
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ScheduledAction"
              example:
                {
                  "scheduledAction":
                    {
                      "scheduledActionId": "d1dd439b-6072-4b97-89c9-724268865b93",
                    },
                }
  /scheduledactions/{scheduledActionId}:
    parameters:
      - in: path
        name: scheduledActionId
        schema:
          type: string
          format: uuid
          example: d1dd439b-6072-4b97-89c9-724268865b93
        required: true
        description: The id of the ScheduledAction, formatted as UUID.
    get:
      summary: Get a specific scheduled action.
      description: Get a specific scheduled action.
      tags:
        - ScheduledAction
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ScheduledAction"
              example:
                {
                  "scheduledAction":
                    {
                      "scheduledActionId": "d1dd439b-6072-4b97-89c9-724268865b93",
                      "scheduledActionType":
                        { "scheduledActionTypeId": 1, "name": "gbo-refund" },
                      "scheduledActionStatus":
                        { "scheduledActionStatusId": 1, "name": "created" },
                      "executionTime": "2024-07-02 15:01:00.000",
                      "details": '{ "xspit": "", "xtat": "", "refundMethod": "", "refundAmount": "" }',
                      "result": '{ "result": "", "timestamp": "" }',
                      "created": "2024-07-02 15:01:00.000",
                      "updated": "2024-07-02 15:01:00.000",
                      "correlationId": "fb4443c6-5a6a-47a3-adf0-db3dfc183399",
                      "role": "customer",
                      "user": "1255ab39-2f10-409a-bf61-38c07e1b8a9e",
                      "scheduledActionResources":
                        [
                          {
                            "scheduledActionResourceId": "7e4b7d7a-4266-47c5-b482-f1a00379c493",
                            "resourceName":
                              { "resourceNameId": 1, "name": "contracts" },
                            "resourceIdentifier": "70d29a0a-176d-4184-8cba-08416eccb361",
                          },
                        ],
                    },
                }
    patch:
      summary: Update a specific scheduled action.
      description: Update a specific scheduled action.
      tags:
        - ScheduledAction
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ScheduledAction"
            example:
              {
                "scheduledAction":
                  {
                    "scheduledActionStatusId": 1,
                    "executionTime": "2024-07-02 15:01:00.000",
                    "details": '{ "xspit": "", "xtat": "", "refundMethod": "", "refundAmount": "" }',
                    "result": '{ "result": "", "timestamp": "" }',
                    "updated": "2024-07-02 15:01:00.000",
                    "correlationId": "fb4443c6-5a6a-47a3-adf0-db3dfc183399",
                  },
              }
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ScheduledAction"
              example:
                {
                  "scheduledAction":
                    {
                      "scheduledActionId": "d1dd439b-6072-4b97-89c9-724268865b93",
                    },
                }
    delete:
      summary: Delete a specific scheduled action.
      description: Delete a specific scheduled action.
      tags:
        - ScheduledAction
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ScheduledAction"
              example:
                {
                  "scheduledAction":
                    {
                      "scheduledActionId": "d1dd439b-6072-4b97-89c9-724268865b93",
                    },
                }
  /scheduledactiontypes:
    get:
      summary: Return a list of all possible values of the ScheduledActionType reference table. Used for populating drop down lists for example.
      description: Return a list of all possible values of the ScheduledActionType reference table. Used for populating drop down lists for example.
      tags:
        - Reference Tables
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ScheduledActionType"
              example:
                {
                  "scheduledActionTypes":
                    [{ "scheduledActionTypeId": 1, "name": "gbo-refund" }],
                }
  /scheduledactionstatuses:
    get:
      summary: Return a list of all possible values of the ScheduledActionStatus reference table. Used for populating drop down lists for example.
      description: Return a list of all possible values of the ScheduledActionStatus reference table. Used for populating drop down lists for example.
      tags:
        - Reference Tables
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ScheduledActionStatus"
              example:
                {
                  "scheduledActionStatuses":
                    [
                      { "scheduledActionStatusId": 1, "name": "created" },
                      { "scheduledActionStatusId": 2, "name": "pending" },
                      { "scheduledActionStatusId": 3, "name": "processed" },
                      { "scheduledActionStatusId": 4, "name": "failed" },
                    ],
                }
  /resourcenames:
    get:
      summary: Return a list of all possible values of the ResourceName reference table. Used for populating drop down lists for example.
      description: Return a list of all possible values of the ResourceName reference table. Used for populating drop down lists for example.
      tags:
        - Reference Tables
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ResourceName"
              example:
                {
                  "resourceNames":
                    [
                      { "resourceNameId": 1, "name": "contracts" },
                      { "resourceNameId": 2, "name": "orders" },
                    ],
                }
components:
  securitySchemes:
    bearerToken:
      type: http
      scheme: bearer
      bearerFormat: JWT
  schemas:
    ScheduledAction:
      type: object
      properties:
        scheduledActionId:
          type: string
          format: uuid
          example: 8699d72a-cf4d-4e6b-9e9c-549d837ca51f
        scheduledActionType:
          type: object
          $ref: "#/components/schemas/ScheduledActionType"
        scheduledActionStatus:
          type: object
          $ref: "#/components/schemas/ScheduledActionStatus"
        executionTime:
          type: string
          format: date-time
          example: 2024-07-02 15:01:00.000
        details:
          type: string
          format: json
          example:
            { "xspit": "", "xtat": "", "refundMethod": "", "refundAmount": "" }
        result:
          type: string
          format: json
          example: { "result": "", "timestamp": "" }
        created:
          type: string
          format: date-time
          example: 2024-07-02 15:01:00.000
        updated:
          type: string
          format: date-time
          example: 2024-07-02 15:01:00.000
        correlationId:
          type: string
          format: uuid
          example: 8699d72a-cf4d-4e6b-9e9c-549d837ca51f
        role:
          type: string
          example: customer
        user:
          type: string
          example: 1255ab39-2f10-409a-bf61-38c07e1b8a9e
    ScheduledActionType:
      type: object
      properties:
        scheduledActionTypeId:
          type: integer
          example: 1
        name:
          type: string
          enum: [gbo-refund]
          example: gbo-refund
    ScheduledActionStatus:
      type: object
      properties:
        scheduledActionStatusId:
          type: integer
          example: 1
        name:
          type: string
          enum: [created, pending, processed, failed]
          example: created
    ScheduledActionResource:
      type: object
      properties:
        scheduledActionResourceId:
          type: string
          format: uuid
          example: 70d29a0a-176d-4184-8cba-08416eccb361
        resourceName:
          type: object
          $ref: "#/components/schemas/ResourceName"
        resourceIdentifier:
          type: string
          example: 70d29a0a-176d-4184-8cba-08416eccb361
    ResourceName:
      type: object
      properties:
        resourceNameId:
          type: integer
          example: 1
        name:
          type: string
          example: contracts
