openapi: 3.0.0
info:
  title: Process board API - ValueStreamer
  version: 2.0.0
  description: "This is the specification of the REST interface for the entity teams."
servers:
  - url: https://api-tenant.valuestreamer.de/api
security:
  - basicAuth: []
  
paths:
  /exchange/teams:
    get:
      tags:
        - "Meta"
        - "Team"
      summary: "Get the list of all teams"
      responses:
        '200':
          description: OK
          content:
            application/vs.te.v1.0.0+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/TeamExcerpt'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '500':
          $ref: '#/components/responses/InternalServerError'
  /exchange/teams/{id}:
    get:
      tags:
        - "Meta"
        - "Team"
      summary: "Get the details of a specific team"
      parameters:
        - in: "path"
          name: "id"
          description: "UUID of the team"
          required: true
          schema:
            type: "string"
            format: "uuid"
      responses:
        '200':
          description: OK
          content:
            application/vs.te.v2.0+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/TeamDetailsWithKpis'
            application/vs.te.v1.0.0+json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/TeamDetails'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  securitySchemes:
    basicAuth:           
      type: http
      scheme: basic
  schemas:
    # Schema for error response body
    Error:
      type: object
      properties:
        errorId:
          type: number
        errorMessage:
          type: string
    ProcessboardExcerpt:
      type: "object"
      properties:
        id:
          type: string
          format: uuid
          description: "UUID"
        name:
            type: string
    TeamDetails:
      type: "object"
      properties:
        id:
          type: string
          format: uuid
          description: "UUID of the team."
        name:
          type: string
          maxLength: 255
        shortName:
          type: string
          maxLength: 55
        parentTeam:
          type: string
          format: uuid
        members:
          type: array
          items:
            allOf:
              - type: object
              - $ref: '#/components/schemas/UserExcerpt'
        processBoards:
          type: array
          items:
            allOf:
              - type: object
              - $ref: '#/components/schemas/ProcessboardExcerpt'
    TeamDetailsWithKpis:
      type: "object"
      properties:
        id:
          type: string
          format: uuid
          description: "UUID of the team."
        name:
            type: string
            maxLength: 255
        shortName:
            type: string
            maxLength: 55
        parentTeam:
            type: string
            format: uuid
        members:
          type: array
          items:
            allOf:
              - type: object
              - $ref: '#/components/schemas/UserExcerpt'
        processBoards:
          type: array
          items:
            allOf:
              - type: object
              - $ref: '#/components/schemas/ProcessboardExcerpt'
        availableKpis:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
                format: uuid
                description: "UUID of the KPI"
              name:
                type: string
              recordingTeam:
                type: boolean
              subTileRecording:
                type: boolean
                default: false
                description: "FALSE: The team has no sub-KPI. Data can be entered directly in the team.
                TRUE: The team has sub-KPI. Data must be inserted for the combination of Team+KPI+Sub-Tile."
              subTiles:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: string
                      format: uuid
                    name:
                      type: string
                    orderId:
                      type: integer
                      description: "Order of the sub-tiles."
    TeamExcerpt:
      type: "object"
      properties:
        id:
          type: string
          format: uuid
          description: "UUID of the team."
        name:
            type: string
            maxLength: 255
        shortName:
            type: string
            maxLength: 55
        parentTeam:
            type: string
            format: uuid
        interdisciplinary:
            type: boolean
            description: 'Marker whether the team is part of the organizational cascade (false), or an interdisciplinary cross-cutting team. (true)'
    UserExcerpt:
      type: "object"
      properties:
        id:
          type: string
          format: uuid
        firstName:
          type: string
          maxLength: 55
        lastName:
          type: string
          maxLength: 55
        email:
          type: string
          maxLength: 255
  responses:
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Not authorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    BadRequest:
      description: Bad request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    InternalServerError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    UnsupportedMediaType:
      description: UnsupportedMediaType
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
