---
openapi: 3.0.3
info:
  title: Translation Service API
  version: 0.0.1-SNAPSHOT
  description: Translation Service provide a REST-API to access Translation
  contact:
    name: Contact and Support
    email: support@gec.io
    url: https://gec.io/
  license:
    name: Commercial
    url: https://gec.io/
security:
- keycloak_auth: []
components:
  securitySchemes:
    keycloak_auth:
      type: openIdConnect
      flows:
        implicit:
          authorizationUrl: https://keycloak.alm.oncite.io/keycloak/auth/realms/alm/protocol/openid-connect/auth
          tokenUrl: https://keycloak.alm.oncite.io/keycloak/auth/realms/alm/protocol/openid-connect/token
      openIdConnectUrl: https://keycloak.alm.oncite.io/auth/realms/alm/.well-known/openid-configuration
      description: Authentication
  schemas:
    Duration:
      format: duration
      type: string
      example: P1D
    KeycloakConfig:
      type: object
      properties:
        url:
          type: string
        realm:
          type: string
        clientId:
          type: string
    OffsetDateTime:
      format: date-time
      type: string
      example: 2022-03-10T12:15:50-04:00
    Source:
      type: object
      properties:
        id:
          type: string
        uploadedFileId:
          $ref: "#/components/schemas/UUID"
        title:
          type: string
        titleHashSum:
          type: string
        content:
          type: string
        contentHashSum:
          type: string
        titleTranslation:
          $ref: "#/components/schemas/Translation"
        contentTranslation:
          $ref: "#/components/schemas/Translation"
        created:
          $ref: "#/components/schemas/OffsetDateTime"
        stamp:
          $ref: "#/components/schemas/OffsetDateTime"
    Translation:
      type: object
      properties:
        hashSum:
          type: string
        translations:
          type: object
          additionalProperties:
            type: string
        created:
          $ref: "#/components/schemas/OffsetDateTime"
        stamp:
          $ref: "#/components/schemas/OffsetDateTime"
    UUID:
      format: uuid
      pattern: "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}"
      type: string
    UploadedFile:
      type: object
      properties:
        id:
          $ref: "#/components/schemas/UUID"
        created:
          $ref: "#/components/schemas/OffsetDateTime"
        stamp:
          $ref: "#/components/schemas/OffsetDateTime"
        version:
          format: int64
          description: "Internal version of the entity, used for optimistic locking.\
            \ Required for updates. Generated on server-side, must not be given in\
            \ creates."
          type: integer
        fileName:
          type: string
        fileSize:
          format: int64
          type: integer
        fileData:
          format: binary
          type: string
        progress:
          format: int32
          type: integer
        translationDuration:
          $ref: "#/components/schemas/Duration"
    LoggerLevel:
      title: LoggerLevel
      enum:
      - "OFF"
      - SEVERE
      - ERROR
      - FATAL
      - WARNING
      - WARN
      - INFO
      - DEBUG
      - TRACE
      - CONFIG
      - FINE
      - FINER
      - FINEST
      - ALL
      type: string
    LoggerInfo:
      title: LoggerInfo
      type: object
      properties:
        configuredLevel:
          $ref: "#/components/schemas/LoggerLevel"
        effectiveLevel:
          $ref: "#/components/schemas/LoggerLevel"
        name:
          type: string
    HealthResponse:
      type: object
      properties:
        checks:
          type: array
          items:
            $ref: "#/components/schemas/HealthCheck"
        status:
          enum:
          - UP
          - DOWN
          type: string
    HealthCheck:
      type: object
      properties:
        data:
          type: object
          nullable: true
        name:
          type: string
        status:
          enum:
          - UP
          - DOWN
          type: string
tags:
- name: Config
- name: Logging Manager
  description: Visualize and manage the log level of your loggers.
- name: MicroProfile Health
  description: Check the health of the application
paths:
  /api/config/keycloak:
    get:
      operationId: io.gec.boundary.ConfigResource_getKeycloakConfig
      tags:
      - Config
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/KeycloakConfig"
      summary: Get Keycloak Config
  /api/file/upload:
    post:
      operationId: io.gec.boundary.UploadResource_uploadFile
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                file:
                  format: binary
                  type: string
        required: true
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/UploadedFile"
        "401":
          description: Not Authorized
        "403":
          description: Not Allowed
      summary: Upload File
      security:
      - keycloak_auth: []
    get:
      operationId: io.gec.boundary.UploadResource_getUploadedFiles
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/UploadedFile"
        "401":
          description: Not Authorized
        "403":
          description: Not Allowed
      summary: Get Uploaded Files
      security:
      - keycloak_auth: []
  /api/file/upload/{id}:
    delete:
      operationId: io.gec.boundary.UploadResource_deleteUploadedFile
      parameters:
      - name: id
        in: path
        required: true
        schema:
          $ref: "#/components/schemas/UUID"
      responses:
        "204":
          description: No Content
        "401":
          description: Not Authorized
        "403":
          description: Not Allowed
      summary: Delete Uploaded File
      security:
      - keycloak_auth: []
  /api/file/upload/{id}/sources:
    get:
      operationId: io.gec.boundary.UploadResource_getSources
      parameters:
      - name: id
        in: path
        required: true
        schema:
          $ref: "#/components/schemas/UUID"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/Source"
        "401":
          description: Not Authorized
        "403":
          description: Not Allowed
      summary: Get Sources
      security:
      - keycloak_auth: []
  /api/file/upload/{id}/translate/{locale}:
    put:
      operationId: io.gec.boundary.UploadResource_translateUploadedFile
      parameters:
      - name: id
        in: path
        required: true
        schema:
          $ref: "#/components/schemas/UUID"
      - name: locale
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema: {}
        "401":
          description: Not Authorized
        "403":
          description: Not Allowed
      summary: Translate Uploaded File
      security:
      - keycloak_auth: []
  /api/translation/{hashsum}/{locale}:
    put:
      operationId: io.gec.boundary.UploadResource_updateTranslation
      parameters:
      - name: hashsum
        in: path
        required: true
        schema:
          type: string
      - name: locale
        in: path
        required: true
        schema:
          type: string
      requestBody:
        content:
          text/plain:
            schema:
              type: string
        required: true
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema: {}
        "401":
          description: Not Authorized
        "403":
          description: Not Allowed
      summary: Update Translation
      security:
      - keycloak_auth: []
    delete:
      operationId: io.gec.boundary.UploadResource_clearTranslation
      parameters:
      - name: hashsum
        in: path
        required: true
        schema:
          type: string
      - name: locale
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema: {}
        "401":
          description: Not Authorized
        "403":
          description: Not Allowed
      summary: Clear Translation
      security:
      - keycloak_auth: []
  /q/logging-manager:
    summary: "Return info on all loggers, or a specific logger"
    description: Logging Manager Loggers
    get:
      operationId: logging_manager_get_all
      summary: Information on Logger(s)
      description: Get information on all loggers or a specific logger.
      tags:
      - Logging Manager
      parameters:
      - name: loggerName
        in: query
        schema:
          type: string
      responses:
        "200":
          description: Ok
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/LoggerInfo"
        "404":
          description: Not Found
    post:
      operationId: logging_manager_update
      summary: Update log level
      description: Update a log level for a certain logger. Use query param `temporary=true`
        for temporary level.
      tags:
      - Logging Manager
      parameters:
      - name: temporary
        in: query
        description: Used to set the log level temporarily
        schema:
          type: boolean
        required: false
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                loggerName:
                  type: string
                loggerLevel:
                  $ref: "#/components/schemas/LoggerLevel"
                duration:
                  description: "Duration in seconds, used only if temporary=true"
                  type: integer
      responses:
        "201":
          description: Created
        "200":
          description: Log level already set
        "400":
          description: Invalid request
        "404":
          description: Logger not found
  /q/logging-manager/levels:
    description: All available levels
    summary: Return all levels that is available
    get:
      description: This returns all possible log levels
      operationId: logging_manager_levels
      tags:
      - Logging Manager
      summary: Get all available levels
      responses:
        "200":
          description: Ok
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/LoggerLevel"
  /q/health:
    description: MicroProfile Health Endpoint
    summary: MicroProfile Health provides a way for your application to distribute
      information about its healthiness state to state whether or not it is able to
      function properly
    get:
      operationId: microprofile_health_root
      description: Check the health of the application
      tags:
      - MicroProfile Health
      summary: "An aggregated view of the Liveness, Readiness and Startup of this\
        \ application"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/HealthResponse"
        "503":
          description: Service Unavailable
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/HealthResponse"
        "500":
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/HealthResponse"
  /q/health/live:
    description: MicroProfile Health - Liveness Endpoint
    summary: Liveness checks are utilized to tell whether the application should be
      restarted
    get:
      operationId: microprofile_health_liveness
      description: Check the liveness of the application
      tags:
      - MicroProfile Health
      summary: The Liveness check of this application
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/HealthResponse"
        "503":
          description: Service Unavailable
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/HealthResponse"
        "500":
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/HealthResponse"
  /q/health/ready:
    description: MicroProfile Health - Readiness Endpoint
    summary: Readiness checks are used to tell whether the application is able to
      process requests
    get:
      operationId: microprofile_health_readiness
      description: Check the readiness of the application
      tags:
      - MicroProfile Health
      summary: The Readiness check of this application
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/HealthResponse"
        "503":
          description: Service Unavailable
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/HealthResponse"
        "500":
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/HealthResponse"
  /q/health/started:
    description: MicroProfile Health - Startup Endpoint
    summary: Startup checks are an used to tell when the application has started
    get:
      operationId: microprofile_health_startup
      description: Check the startup of the application
      tags:
      - MicroProfile Health
      summary: The Startup check of this application
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/HealthResponse"
        "503":
          description: Service Unavailable
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/HealthResponse"
        "500":
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/HealthResponse"
