openapi: 3.0.0
info:
  title: Integration Action Log API
  description: API for managing integration action logs
  version: 1.0.0
  contact:
    name: Repzo
    url: https://repzo.com

servers:
  - url: https://sv.api.repzo.me
    description: Production server
  - url: https://staging.sv.api.repzo.me
    description: Staging server

tags:
  - name: Integration Action Log
    description: Operations related to integration action log management

paths:
  /integration-action-log:
    get:
      tags:
        - Integration Action Log
      summary: Get all integration action log records
      description: Retrieve a list of all integration action log records with optional filtering and pagination
      parameters:
        - name: limit
          in: query
          description: Maximum number of records to return
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 50
        - name: offset
          in: query
          description: Number of records to skip for pagination
          required: false
          schema:
            type: integer
            minimum: 0
            default: 0
        - name: sort
          in: query
          description: Field to sort by
          required: false
          schema:
            type: string
        - name: order
          in: query
          description: Sort order (asc or desc)
          required: false
          schema:
            type: string
            enum: [asc, desc]
            default: desc
        - name: filter
          in: query
          description: Filter conditions in JSON format
          required: false
          schema:
            type: string
        - name: search
          in: query
          description: Search term for text fields
          required: false
          schema:
            type: string
      responses:
        "200":
          description: List of integration action log records retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/IntegrationActionLog"
                  total:
                    type: integer
                    description: Total number of records
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "500":
          description: Internal server error
    post:
      tags:
        - Integration Action Log
      summary: Create a new integration action log record
      description: Create a new integration action log record with the provided data
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/IntegrationActionLogInput"
      responses:
        "201":
          description: Integration action log record created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/IntegrationActionLog"
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "500":
          description: Internal server error

  /integration-action-log/{id}:
    get:
      tags:
        - Integration Action Log
      summary: Get integration action log record by ID
      description: Retrieve a specific integration action log record by its ID
      parameters:
        - name: id
          in: path
          required: true
          description: Integration action log record ID
          schema:
            type: string
      responses:
        "200":
          description: Integration action log record retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/IntegrationActionLog"
        "404":
          description: Integration action log record not found
        "401":
          description: Unauthorized
        "500":
          description: Internal server error
    put:
      tags:
        - Integration Action Log
      summary: Update integration action log record
      description: Update an existing integration action log record with new data
      parameters:
        - name: id
          in: path
          required: true
          description: Integration action log record ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/IntegrationActionLogInput"
      responses:
        "200":
          description: Integration action log record updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/IntegrationActionLog"
        "400":
          description: Bad request
        "404":
          description: Integration action log record not found
        "401":
          description: Unauthorized
        "500":
          description: Internal server error
    delete:
      tags:
        - Integration Action Log
      summary: Delete integration action log record
      description: Delete an existing integration action log record
      parameters:
        - name: id
          in: path
          required: true
          description: Integration action log record ID
          schema:
            type: string
      responses:
        "200":
          description: Integration action log record deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: Integration action log record deleted successfully
        "404":
          description: Integration action log record not found
        "401":
          description: Unauthorized
        "500":
          description: Internal server error

components:
  schemas:
    IntegrationActionLog:
      type: object
      properties:
        _id:
          type: string
          description: Unique identifier for the integration action log record
          example: "60f7b1b3e4b0e8b3f8b3f8b3"
        integrationId:
          type: string
          description: Integration identifier
          example: "60f7b1b3e4b0e8b3f8b3f8b4"
        actionType:
          type: string
          enum: [create, update, delete, sync, webhook]
          description: Type of action performed
          example: "create"
        entityType:
          type: string
          description: Type of entity affected
          example: "product"
        entityId:
          type: string
          description: ID of the affected entity
          example: "60f7b1b3e4b0e8b3f8b3f8b5"
        status:
          type: string
          enum: [pending, success, failed, retrying]
          description: Status of the action
          example: "success"
        payload:
          type: object
          additionalProperties: true
          description: Action payload data
        response:
          type: object
          additionalProperties: true
          description: Response data from the action
        errorMessage:
          type: string
          description: Error message if action failed
        retryCount:
          type: integer
          minimum: 0
          default: 0
          description: Number of retry attempts
        executionTime:
          type: number
          description: Execution time in milliseconds
        metadata:
          type: object
          additionalProperties: true
          description: Additional metadata
        createdAt:
          type: string
          format: date-time
          description: Record creation timestamp
          example: "2023-01-15T08:00:00Z"
        updatedAt:
          type: string
          format: date-time
          description: Record last update timestamp
          example: "2023-01-15T10:30:00Z"
      required:
        - integrationId
        - actionType
        - entityType
        - status

    IntegrationActionLogInput:
      type: object
      properties:
        integrationId:
          type: string
          description: Integration identifier
          example: "60f7b1b3e4b0e8b3f8b3f8b4"
        actionType:
          type: string
          enum: [create, update, delete, sync, webhook]
          description: Type of action performed
          example: "create"
        entityType:
          type: string
          description: Type of entity affected
          example: "product"
        entityId:
          type: string
          description: ID of the affected entity
          example: "60f7b1b3e4b0e8b3f8b3f8b5"
        status:
          type: string
          enum: [pending, success, failed, retrying]
          description: Status of the action
          example: "success"
        payload:
          type: object
          additionalProperties: true
          description: Action payload data
        response:
          type: object
          additionalProperties: true
          description: Response data from the action
        errorMessage:
          type: string
          description: Error message if action failed
        retryCount:
          type: integer
          minimum: 0
          default: 0
          description: Number of retry attempts
        executionTime:
          type: number
          description: Execution time in milliseconds
        metadata:
          type: object
          additionalProperties: true
          description: Additional metadata
      required:
        - integrationId
        - actionType
        - entityType
        - status

  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: api-key

security:
  - ApiKeyAuth: []
