openapi: 3.0.0
info:
  title: ai in service
  description: Middleware für eine Fachanwendung
  version: 1.0.0

components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

security:
  - bearerAuth: []

paths:
  /cases/{caseId}/chats:
    get:
      summary: Get all chats for a case
      parameters:
        - name: caseId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: A list of chats
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    sessionId:
                      type: string
                    author:
                      type: string
                    group:
                      type: string
                      enum: [Technican, User]
                    timestamp:
                      type: string
                      format: date-time
        '401':
          description: Unauthorized
    post:
      summary: Create a new chat for a case
      parameters:
        - name: caseId
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                message:
                  type: string
      responses:
        '201':
          description: Chat created
          content:
            application/json:
              schema:
                type: object
                properties:
                  sessionId:
                    type: string
                  message:
                    type: string
                  timestamp:
                    type: string
                    format: date-time
        '401':
          description: Unauthorized
    delete:
      summary: Delete all chats for a case
      parameters:
        - name: caseId
          in: path
          required: true
          schema:
            type: string
      responses:
        '204':
          description: No Content
        '401':
          description: Unauthorized
  /cases/{caseId}/status:
    get:
      summary: Get the current status of a case
      parameters:
        - name: caseId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: The current status of the case
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                  hasUserChat:
                    type: boolean
                  hasTechnicanChat:
                    type: boolean
        '401':
          description: Unauthorized
  /cases/{caseId}/transcript:
    get:
      summary: Get the transcript of all messages for a case
      parameters:
        - name: caseId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: The transcript of all messages
          content:
            application/json:
              schema:
                type: object
                properties:
                  transcript:
                    type: string
        '401':
          description: Unauthorized
  /cases/{caseId}/transcript/pdf:
    get:
      summary: Get the transcript of all messages for a case as PDF
      parameters:
        - name: caseId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: The transcript of all messages as PDF
          content:
            application/pdf:
              schema:
                type: string
                format: binary
        '401':
          description: Unauthorized
  /cases/{caseId}/send-message:
    post:
      summary: Send a message to the chat for a case
      parameters:
        - name: caseId
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                message:
                  type: string
      responses:
        '200':
          description: Message sent
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  timestamp:
                    type: string
                    format: date-time
        '401':
          description: Unauthorized
