openapi: 3.0.0
paths:
  /app/config:
    get:
      operationId: AppController_getSystemConfig
      parameters: []
      responses:
        '200':
          description: System configuration
      summary: Get default system configuration
      tags:
        - App
  /app/features:
    get:
      operationId: AppController_getFeatures
      parameters: []
      responses:
        '200':
          description: Feature flags
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FeaturesRO'
      summary: Get enabled features
      tags:
        - App
  /pipeline/frames:
    get:
      operationId: PipelineController_getFramesPipeline
      parameters: []
      responses:
        '200':
          description: Get the current status of the frame processing pipeline
      summary: Get frame pipeline status
      tags:
        - Pipeline
  /pipeline/evam:
    get:
      operationId: PipelineController_getEvamPipeline
      parameters: []
      responses:
        '200':
          description: Get the current status of the EVAM pipeline
      summary: Get EVAM pipeline status
      tags:
        - Pipeline
  /audio/models:
    get:
      operationId: AudioController_getAudioModels
      parameters: []
      responses:
        '200':
          description: Fetch available audio models
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AudioModelROSwagger'
      summary: Get available audio models
      tags:
        - Audio
  /search:
    get:
      operationId: SearchController_getQueries
      parameters: []
      responses:
        '200':
          description: Returns a list of all search queries
      summary: Get all search queries
      tags:
        - Search
    post:
      operationId: SearchController_addQuery
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SearchQueryDTO'
      responses:
        '201':
          description: Search query created
      summary: Add a new search query
      tags:
        - Search
  /search/watched:
    get:
      operationId: SearchController_getWatchedQueries
      parameters: []
      responses:
        '200':
          description: Returns a list of watched queries
      summary: Get all watched search queries
      tags:
        - Search
  /search/{queryId}:
    get:
      operationId: SearchController_getQuery
      parameters:
        - name: queryId
          required: true
          in: path
          description: ID of the search query
          schema:
            type: string
      responses:
        '200':
          description: Search query details
      summary: Get a search query by ID
      tags:
        - Search
    delete:
      operationId: SearchController_deleteQuery
      parameters:
        - name: queryId
          required: true
          in: path
          description: ID of the search query to delete
          schema:
            type: string
      responses:
        '200':
          description: Search query deleted
      summary: Delete a search query
      tags:
        - Search
  /search/{queryId}/refetch:
    post:
      operationId: SearchController_refetchQuery
      parameters:
        - name: queryId
          required: true
          in: path
          description: ID of the search query to refetch
          schema:
            type: string
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RefetchBodyDTO'
      responses:
        '200':
          description: Search query refetched
      summary: Refetch search results for a query
      tags:
        - Search
  /search/query:
    post:
      operationId: SearchController_searchQuery
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SearchQueryDTO'
      responses:
        '201':
          description: Search results
      summary: Execute a one-off search query
      tags:
        - Search
  /search/{queryId}/watch:
    patch:
      operationId: SearchController_watchQuery
      parameters:
        - name: queryId
          required: true
          in: path
          description: ID of the search query
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WatchBodyDTO'
      responses:
        '200':
          description: Watch status updated
      summary: Toggle watch status for a search query
      tags:
        - Search
  /videos:
    post:
      operationId: VideoController_videoUpload
      parameters: []
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/VideoDTOSwagger'
      responses:
        '201':
          description: Video uploaded successfully
      summary: Upload a video file
      tags:
        - Video
    get:
      operationId: VideoController_getVideos
      parameters: []
      responses:
        '200':
          description: Returns a list of videos
      summary: Get all videos
      tags:
        - Video
  /videos/{videoId}:
    get:
      operationId: VideoController_getVideo
      parameters:
        - name: videoId
          required: true
          in: path
          description: ID of the video
          schema:
            type: string
      responses:
        '200':
          description: Video details
      summary: Get a video by ID
      tags:
        - Video
  /videos/search-embeddings/{videoId}:
    post:
      operationId: VideoController_createSearchEmbeddings
      parameters:
        - name: videoId
          required: true
          in: path
          description: ID of the video to create search embeddings for
          schema:
            type: string
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                tags:
                  type: string
                  example: outdoor,daytime
                  description: >-
                    Optional comma-separated tags to merge into existing video
                    tags before embedding
      responses:
        '201':
          description: Search embeddings creation started
      summary: Create search embeddings for a video
      tags:
        - Video
  /videos/search-embeddings-batch:
    post:
      operationId: VideoController_createSearchEmbeddingsBatch
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - videoIds
              properties:
                videoIds:
                  type: array
                  items:
                    type: string
                  description: IDs of the videos to create search embeddings for
                tags:
                  type: string
                  example: outdoor,daytime
                  description: >-
                    Optional comma-separated tags to merge into every video
                    before embedding
      responses:
        '201':
          description: Batch embeddings job accepted
      summary: Create search embeddings for several videos in one batch job
      tags:
        - Video
  /videos/search-embeddings-jobs/{jobId}:
    get:
      operationId: VideoController_getSearchEmbeddingsJobStatus
      parameters:
        - name: jobId
          required: true
          in: path
          description: ID of the batch embeddings job to poll
          schema:
            type: string
      responses:
        '200':
          description: Batch embeddings job status
      summary: Get the status of a batch embeddings job
      tags:
        - Video
  /tags:
    get:
      operationId: TagsController_getTags
      parameters: []
      responses:
        '200':
          description: Returns a list of all tags
          content:
            application/json:
              schema:
                type: array
                items:
                  type: string
      summary: Get all tags
      tags:
        - Tags
  /tags/{tagId}:
    delete:
      operationId: TagsController_removeTag
      parameters:
        - name: tagId
          required: true
          in: path
          description: ID of the tag to remove
          schema:
            type: number
      responses:
        '200':
          description: Tag removed successfully
      summary: Remove a tag by ID
      tags:
        - Tags
  /summary:
    get:
      operationId: SummaryController_getSummary
      parameters: []
      responses:
        '200':
          description: Get all summary states raw
      summary: Get all summary states
      tags:
        - Summary
    post:
      operationId: SummaryController_startSummaryPipeline
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SummaryPipelineDTOSwagger'
      responses:
        '201':
          description: Summary pipeline started
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SummaryPipelineROSwagger'
      summary: Start a video summary pipeline
      tags:
        - Summary
  /summary/ui:
    get:
      operationId: SummaryController_getSummaryList
      parameters: []
      responses:
        '200':
          description: Get a list of summary states in UI-friendly format
      summary: Get summary list for UI
      tags:
        - Summary
  /summary/{stateId}:
    get:
      operationId: SummaryController_getSummaryById
      parameters:
        - name: stateId
          required: true
          in: path
          description: ID of the summary state
          schema: {}
      responses:
        '200':
          description: Get UI Friendly summary state by ID
      summary: Get summary state by ID
      tags:
        - Summary
    delete:
      operationId: SummaryController_deleteSummaryById
      parameters:
        - name: stateId
          required: true
          in: path
          description: ID of the summary state to delete
          schema: {}
      responses:
        '200':
          description: Summary state deleted
      summary: Delete a summary state
      tags:
        - Summary
  /summary/{stateId}/raw:
    get:
      operationId: SummaryController_getSummaryRawById
      parameters:
        - name: stateId
          required: true
          in: path
          description: ID of the summary state to fetch raw data
          schema: {}
      responses:
        '200':
          description: Get raw summary state data by ID
      summary: Get raw summary state by ID
      tags:
        - Summary
  /health:
    get:
      operationId: HealthController_check
      parameters: []
      responses:
        '200':
          description: |-
            Health check status

            The Health Check is successful
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: ok
                  info:
                    type: object
                    example:
                      database:
                        status: up
                    additionalProperties:
                      type: object
                      required:
                        - status
                      properties:
                        status:
                          type: string
                      additionalProperties: true
                    nullable: true
                  error:
                    type: object
                    example: {}
                    additionalProperties:
                      type: object
                      required:
                        - status
                      properties:
                        status:
                          type: string
                      additionalProperties: true
                    nullable: true
                  details:
                    type: object
                    example:
                      database:
                        status: up
                    additionalProperties:
                      type: object
                      required:
                        - status
                      properties:
                        status:
                          type: string
                      additionalProperties: true
        '503':
          description: The Health Check is not successful
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: error
                  info:
                    type: object
                    example:
                      database:
                        status: up
                    additionalProperties:
                      type: object
                      required:
                        - status
                      properties:
                        status:
                          type: string
                      additionalProperties: true
                    nullable: true
                  error:
                    type: object
                    example:
                      redis:
                        status: down
                        message: Could not connect
                    additionalProperties:
                      type: object
                      required:
                        - status
                      properties:
                        status:
                          type: string
                      additionalProperties: true
                    nullable: true
                  details:
                    type: object
                    example:
                      database:
                        status: up
                      redis:
                        status: down
                        message: Could not connect
                    additionalProperties:
                      type: object
                      required:
                        - status
                      properties:
                        status:
                          type: string
                      additionalProperties: true
      summary: Check service health status
      tags:
        - Health
info:
  title: Pipeline Manager
  description: Pipeline Manager API
  version: '1.0'
  contact: {}
tags:
  - name: pipeline
    description: ''
servers:
  - url: /manager
    description: Nginx manager prefix
components:
  schemas:
    FeaturesRO:
      type: object
      properties:
        summary:
          type: string
        search:
          type: string
          readOnly: true
      required:
        - summary
        - search
    AudioModelSwagger:
      type: object
      properties:
        model_id:
          type: string
          description: Unique identifier for the audio model
        display_name:
          type: string
          description: Display name of the audio model
        description:
          type: string
          description: Description of the audio model
      required:
        - model_id
        - display_name
        - description
    AudioModelROSwagger:
      type: object
      properties:
        default_model:
          type: string
          description: Default audio model ID
        models:
          description: List of available audio models
          type: array
          items:
            $ref: '#/components/schemas/AudioModelSwagger'
      required:
        - default_model
        - models
    TimeFilterSelection:
      type: object
      properties:
        value:
          type: number
          description: Relative time value
          example: 7
        unit:
          type: string
          enum:
            - minutes
            - hours
            - days
            - weeks
          description: Time unit for relative filter
        start:
          type: string
          description: Start date (ISO 8601)
          example: '2025-01-01T00:00:00Z'
        end:
          type: string
          description: End date (ISO 8601)
          example: '2025-12-31T23:59:59Z'
        source:
          type: string
          description: Filter source identifier
    SearchQueryDTO:
      type: object
      properties:
        query:
          type: string
          description: Search query string
          example: person walking
        tags:
          type: string
          description: Comma-separated tags to filter by
          example: outdoor,daytime
        timeFilter:
          description: Time range filter
          nullable: true
          type: object
          allOf:
            - $ref: '#/components/schemas/TimeFilterSelection'
      required:
        - query
    RefetchBodyDTO:
      type: object
      properties:
        timeFilter:
          description: Optional time filter override
          allOf:
            - $ref: '#/components/schemas/TimeFilterSelection'
    WatchBodyDTO:
      type: object
      properties:
        watch:
          type: boolean
          description: Whether to watch this query
      required:
        - watch
    VideoDTOSwagger:
      type: object
      properties:
        video:
          type: string
          description: Video file to upload
          format: binary
        name:
          type: string
          description: Name of the video file
        tags:
          type: string
          description: Tags seperated by commas
      required:
        - video
    SummaryPipelineSamplingSwagger:
      type: object
      properties:
        chunkDuration:
          type: number
          description: Duration for a chunk in seconds
        samplingFrame:
          type: number
          description: Number of frames to sample per chunk
        frameOverlap:
          type: number
          description: Frame overlap count
        multiFrame:
          type: number
          description: Multi frame count (batch size)
      required:
        - chunkDuration
        - samplingFrame
        - frameOverlap
        - multiFrame
    SummaryPipelineEvamSwagger:
      type: object
      properties:
        evamPipeline:
          type: string
          enum:
            - object_detection
            - video_ingestion
      required:
        - evamPipeline
    SummaryPipelinePromptsSwagger:
      type: object
      properties:
        framePrompt:
          type: string
          description: Prompt for frame processing
        summaryMapPrompt:
          type: string
          description: Prompt for summary map processing
        summaryReducePrompt:
          type: string
          description: Prompt for summary reduce processing
        summarySinglePrompt:
          type: string
          description: Prompt for single summary processing
        audioSummaryMapPrompt:
          type: string
          description: Prompt for full audio transcript summarization (map stage)
        audioSummaryReducePrompt:
          type: string
          description: Prompt for full audio transcript summarization (reduce stage)
        audioSummarySinglePrompt:
          type: string
          description: >-
            Prompt for full audio transcript summarization (single reduction
            stage)
    SummaryPipelineAudioSwagger:
      type: object
      properties:
        audioModel:
          type: string
          description: Audio model configuration
        useFullTranscriptSummary:
          type: boolean
          description: Enable full transcript summarization for audio-dominant videos
      required:
        - audioModel
    SummaryPipelineDTOSwagger:
      type: object
      properties:
        videoId:
          type: string
          description: ID of the video
        title:
          type: string
          description: Title for the summary
        sampling:
          description: Sampling configuration for the summary
          allOf:
            - $ref: '#/components/schemas/SummaryPipelineSamplingSwagger'
        evam:
          description: EVAM pipeline configuration
          allOf:
            - $ref: '#/components/schemas/SummaryPipelineEvamSwagger'
        prompts:
          description: Prompts override
          allOf:
            - $ref: '#/components/schemas/SummaryPipelinePromptsSwagger'
        audio:
          description: Audio model configuration
          allOf:
            - $ref: '#/components/schemas/SummaryPipelineAudioSwagger'
        produceFinalSummary:
          type: boolean
          description: >-
            When true, chunk-level summaries are combined into a final video
            summary via LLM map-reduce. When false, only individual chunk
            summaries are kept.
      required:
        - videoId
        - title
        - sampling
        - evam
    SummaryPipelineROSwagger:
      type: object
      properties:
        summaryPipelineId:
          type: string
          description: ID of the created summary pipeline state
      required:
        - summaryPipelineId
