openapi: 3.0.3
info:
  title: Repzo API - Integration App
  version: 1.0.0
  description: OpenAPI specification for Repzo Integration App endpoints.
servers:
  - url: https://sv.api.repzo.me
paths:
  /integration-app:
    get:
      summary: Find integration apps
      operationId: findIntegrationApps
      parameters:
        - in: query
          name: params
          schema:
            type: object
            properties:
              _id:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              search:
                type: string
              name:
                type: string
              category:
                type: string
              status:
                type: string
                enum: [active, inactive, pending]
              from_updatedAt:
                type: number
              from__id:
                type: string
              to__id:
                type: string
              sortBy:
                type: array
                items:
                  type: object
                  properties:
                    field:
                      type: string
                      enum: [_id, createdAt, updatedAt, name]
                    type:
                      type: string
                      enum: [asc, desc]
          description: Query parameters for filtering integration apps
      responses:
        "200":
          description: A list of integration apps
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/IntegrationAppFindResult"
    post:
      summary: Create an integration app
      operationId: createIntegrationApp
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/IntegrationAppCreateBody"
      responses:
        "201":
          description: Integration app created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/IntegrationAppCreateResult"
  /integration-app/{id}:
    get:
      summary: Get an integration app by ID
      operationId: getIntegrationApp
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Integration app details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/IntegrationAppGetResult"
    put:
      summary: Update an integration app
      operationId: updateIntegrationApp
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/IntegrationAppUpdateBody"
      responses:
        "200":
          description: Integration app updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/IntegrationAppUpdateResult"
components:
  schemas:
    IntegrationAppFindResult:
      type: object
      description: Result of finding integration apps
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/IntegrationAppSchema"
        total_result:
          type: number
          description: Total number of integration apps
        current_count:
          type: number
          description: Count of integration apps in current page
        total_pages:
          type: number
          description: Total number of pages
        current_page:
          type: number
          description: Current page number
        per_page:
          type: number
          description: Number of integration apps per page
    IntegrationAppSchema:
      type: object
      description: Integration app schema
      properties:
        _id:
          type: string
          description: Unique identifier for the integration app
        name:
          type: string
          description: Name of the integration app
        description:
          type: string
          description: Description of the integration app
        category:
          type: string
          description: Category of the integration
        version:
          type: string
          description: Version of the integration app
        status:
          type: string
          enum: [active, inactive, pending]
          description: Status of the integration app
        available_app:
          type: string
          description: Available app reference
        company_namespace:
          type: string
          description: Company namespace
        config:
          type: object
          additionalProperties: true
          description: Configuration settings for the integration
        credentials:
          type: object
          additionalProperties: true
          description: Credentials for the integration
        endpoints:
          type: object
          additionalProperties: true
          description: API endpoints configuration
        webhooks:
          type: object
          additionalProperties: true
          description: Webhook configuration
        sync_settings:
          type: object
          additionalProperties: true
          description: Synchronization settings
        last_sync:
          type: string
          format: date-time
          description: Last synchronization timestamp
        error_count:
          type: number
          description: Number of errors encountered
        success_count:
          type: number
          description: Number of successful operations
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
        __v:
          type: number
          description: Version number
    IntegrationAppCreateBody:
      type: object
      description: Body for creating an integration app
      required:
        - name
        - available_app
        - company_namespace
      properties:
        name:
          type: string
          description: Name of the integration app
        description:
          type: string
          description: Description of the integration app
        available_app:
          type: string
          description: Available app reference
        company_namespace:
          type: string
          description: Company namespace
        config:
          type: object
          additionalProperties: true
          description: Configuration settings for the integration
        credentials:
          type: object
          additionalProperties: true
          description: Credentials for the integration
        endpoints:
          type: object
          additionalProperties: true
          description: API endpoints configuration
        webhooks:
          type: object
          additionalProperties: true
          description: Webhook configuration
        sync_settings:
          type: object
          additionalProperties: true
          description: Synchronization settings
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
    IntegrationAppCreateResult:
      $ref: "#/components/schemas/IntegrationAppSchema"
      description: Result of creating an integration app
    IntegrationAppGetResult:
      $ref: "#/components/schemas/IntegrationAppSchema"
      description: Result of getting an integration app
    IntegrationAppUpdateBody:
      type: object
      description: Body for updating an integration app
      properties:
        name:
          type: string
          description: Name of the integration app
        description:
          type: string
          description: Description of the integration app
        status:
          type: string
          enum: [active, inactive, pending]
          description: Status of the integration app
        config:
          type: object
          additionalProperties: true
          description: Configuration settings for the integration
        credentials:
          type: object
          additionalProperties: true
          description: Credentials for the integration
        endpoints:
          type: object
          additionalProperties: true
          description: API endpoints configuration
        webhooks:
          type: object
          additionalProperties: true
          description: Webhook configuration
        sync_settings:
          type: object
          additionalProperties: true
          description: Synchronization settings
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
    IntegrationAppUpdateResult:
      $ref: "#/components/schemas/IntegrationAppSchema"
      description: Result of updating an integration app
