openapi: 3.0.4
info:
  title: Dynamic Import API
  description: Service for extracting text from various file formats
  version: v1
paths:
  /api/v1/aggregate:
    post:
      tags:
        - Aggregation
      summary: Aggregates results from the provided request.
      requestBody:
        description: The aggregate request data.
        content:
          application/json-patch+json:
            schema:
              $ref: '#/components/schemas/AggregateResults'
          application/json:
            schema:
              $ref: '#/components/schemas/AggregateResults'
          text/json:
            schema:
              $ref: '#/components/schemas/AggregateResults'
          application/*+json:
            schema:
              $ref: '#/components/schemas/AggregateResults'
      responses:
        '200':
          description: Returns success when the aggregation is processed.
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/AggregateResponse'
            application/json:
              schema:
                $ref: '#/components/schemas/AggregateResponse'
            text/json:
              schema:
                $ref: '#/components/schemas/AggregateResponse'
        '400':
          description: Returns when the request is invalid.
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
            text/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
  /api/v1/feedback:
    post:
      tags:
        - Feedback
      summary: Receives feedback to improve the Dynamic Import service.
      parameters:
        - name: isAIActive
          in: query
          schema:
            type: boolean
      requestBody:
        description: The feedback data as an untyped JSON blob.
        content:
          application/json-patch+json:
            schema: {}
          application/json:
            schema: {}
          text/json:
            schema: {}
          application/*+json:
            schema: {}
      responses:
        '200':
          description: Returns when feedback is properly received.
  /api/v1/health:
    get:
      tags:
        - Health
      summary: Checks the health of the service.
      responses:
        '200':
          description: Returns when the service is healthy.
  /api/v1/info:
    get:
      tags:
        - Info
      summary: Gets information about the service.
      responses:
        '200':
          description: Returns service information.
components:
  schemas:
    AggregateResponse:
      type: object
      properties:
        matches:
          type: array
          items:
            type: array
            items:
              $ref: '#/components/schemas/TextMatch'
          nullable: true
        unmatched:
          type: array
          items:
            $ref: '#/components/schemas/TextMatch'
          nullable: true
      additionalProperties: false
    AggregateResults:
      required:
        - matches
      type: object
      properties:
        matches:
          type: array
          items:
            type: array
            items:
              type: array
              items:
                $ref: '#/components/schemas/TextMatch'
      additionalProperties: false
    ProblemDetails:
      type: object
      properties:
        type:
          type: string
          nullable: true
        title:
          type: string
          nullable: true
        status:
          type: integer
          format: int32
          nullable: true
        detail:
          type: string
          nullable: true
        instance:
          type: string
          nullable: true
      additionalProperties: {}
    TextMatch:
      type: object
      properties:
        field:
          type: string
          nullable: true
        value:
          type: string
          nullable: true
        index:
          type: integer
          format: int32
        length:
          type: integer
          format: int32
        source:
          $ref: '#/components/schemas/TextMatchSource'
      additionalProperties: false
    TextMatchSource:
      enum:
        - 0
        - 1
        - 2
        - 3
        - 4
      type: integer
      format: int32
