openapi: 3.1.0
info:
  title: Trayn Service
  version: '2507.02'
  description: Trayn Service API
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
  - url: https://api.trayn.com/backend/rest
    description: Production
  - url: https://api.demo.trayn.com/backend/rest
    description: Demo
  - url: https://api.bronze.trayn.com/backend/rest
    description: Bronze
security:
  - bearerAuth: []
  - tokenAuth: []
  - {}
tags:
  - name: admin
    description: Administrative functions
  - name: account
    description: |
      User account management: login, logout, availability, developer tokens
  - name: calendar
    description: Calendars
  - name: exercise
    description: Exercises and training zones
  - name: workout
    description: Workouts and exercise presets
  - name: general
    description: Related to app version, supported locale and processing tokens
  - name: macro
    description: Macro plans
  - name: micro
    description: Micro plans and sessions
  - name: report
    description: Trainings and reports
  - name: team
    description: Team management
  - name: test
    description: Tests, performance definitions, and measurements
  - name: unit
    description: Physical units and unit groups
  - name: user
    description: Information related to the user
  - name: attendance
    description: Attendances
  - name: questionnaires
    description: Questionnaires and responses
paths:
  /app/version:
    get:
      operationId: getAppVersion
      summary: Get application version
      tags:
        - general
      responses:
        '200':
          description: OK
          content:
            plain/text:
              schema:
                type: string
  /s/user/settings:
    get:
      operationId: getSettings
      summary: Settings for current user
      tags:
        - user
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserSettings'
  /s/user:
    get:
      operationId: listUsers
      summary: List users
      description: |
        Return all users associated with the currently logged in user. 

        - If the user is a team member, all users from the associated teams are
        returned.

        - If the user is an administrator, all users from the current environment
        are returned.

        If the user is both, an administrator and a team member, the team membership
        takes precedence, i.e. users from the current user's teams are returned.
        However, by adding `showAllUsers`, an administrator will always receive a
        list of all users.
      tags:
        - user
      parameters:
        - $ref: '#/components/parameters/start'
        - $ref: '#/components/parameters/max'
        - name: role
          in: query
          schema:
            $ref: '#/components/schemas/Role'
        - name: team
          in: query
          description: Team ID
          schema:
            type: string
        - name: showAllUsers
          in: query
          description: Show all users
          schema:
            type: boolean
            default: false
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/User'
    post:
      operationId: createUser
      summary: Create a new user
      tags:
        - user
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserCreate'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/User'
  /s/user/{id}/poassword:
    post:
      operationId: setPassword
      summary: Sets the password of the given user
      tags:
        - user
      parameters:
        - $ref: '#/components/parameters/id'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ResetPassword'
      responses:
        '200':
          description: OK
  /s/user/{id}/disable:
    post:
      operationId: disableUser
      summary: Enable or disable a user
      tags:
        - user
      parameters:
        - $ref: '#/components/parameters/id'
        - name: status
          in: query
          schema:
            type: boolean
          description: Set to `true` to disable, `false` to enable
      responses:
        '204':
          description: OK
  /s/user/{id}/merge:
    post:
      operationId: mergeUser
      summary: Merge two users and delete the source user
      description: |
        The following information will be merged from the source user into the target user

        - Calendar:
          - Events on the private calendar
          - Tracked workouts associated with the user
          - Workouts on calendars created by the user
        - Team memberships, as athlete or trainer
        - Testing
          - Performance measurements (test results). Please note that it is not possible to have more than one test result for a specific performance definition and athlete per day. Any conflict will be returned in `conflicts`
          - Test participation
        - Ownership: The ownership for the following content will be transfered from the source to the target user
          - Exercises
          - Workout sessions (micro)
          - Micro templates and associated micro template workouts
          - Macro templates
      tags:
        - user
      parameters:
        - $ref: '#/components/parameters/id'
        - name: source
          in: query
          schema:
            type: string
          description: The id of the source user
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MergeResultUser'
  /s/user/{id}/identity:
    get:
      operationId: getUser
      summary: Get an individual user
      tags:
        - user
      parameters:
        - $ref: '#/components/parameters/id'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/User'
    patch:
      operationId: updateUser
      summary: Update user
      tags:
        - user
      parameters:
        - $ref: '#/components/parameters/id'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserUpdate'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/User'
  /s/user/{id}/username:
    put:
      operationId: updateUserName
      summary: Update the username/email address
      description: Update the username / email address of a user
      tags:
        - user
      parameters:
        - $ref: '#/components/parameters/id'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                username:
                  description: The new user name
                  type: string
      responses:
        '200':
          description: OK
  /s/user/{id}/lookup/calendar:
    get:
      operationId: getUserCalendars
      summary: Get calendars for a user
      description: Will return at least the personal calendar of the user. If the user is member of multiple teams, the list will contain the respective team calendars.
      tags:
        - user
      parameters:
        - $ref: '#/components/parameters/id'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Calendar'
  /s/user/assignment/micro:
    get:
      operationId: getMicroAssignments
      summary: Get microtemplates assigned to a specific user
      tags:
        - user
      parameters:
        - $ref: '#/components/parameters/user'
        - $ref: '#/components/parameters/dateFromMin'
        - $ref: '#/components/parameters/dateFromMax'
        - $ref: '#/components/parameters/dateToMin'
        - $ref: '#/components/parameters/dateToMax'
        - $ref: '#/components/parameters/all'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/MicroAssignment'
  /s/user/assignment/workout:
    get:
      operationId: getWorkoutAssignments
      summary: Get workouts assigned to a user
      tags:
        - user
      parameters:
        - $ref: '#/components/parameters/user'
        - $ref: '#/components/parameters/workout'
        - $ref: '#/components/parameters/all'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/WorkoutAssignment'
    post:
      operationId: createWorkoutAssignments
      summary: Create workout assignments
      tags:
        - user
      requestBody:
        content:
          application/json:
            schema:
              type: array
              items:
                type: object
                properties:
                  user:
                    $ref: '#/components/schemas/Identifiable'
                  workout:
                    $ref: '#/components/schemas/Identifiable'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/WorkoutAssignment'
    delete:
      operationId: deleteWorkoutAssignments
      summary: Delete workout assignment
      tags:
        - user
      parameters:
        - $ref: '#/components/parameters/id-multiple'
      responses:
        '204':
          description: OK
  /s/user/assignment/workout/count:
    get:
      operationId: getWorkoutAssignmentsCount
      summary: Get number of workouts assigned to a user
      tags:
        - user
      parameters:
        - $ref: '#/components/parameters/user'
        - $ref: '#/components/parameters/workout'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: number
  /s/user/assignment/workout/{id}:
    delete:
      operationId: deleteWorkoutAssignment
      summary: Delete workout assignment
      tags:
        - user
      parameters:
        - $ref: '#/components/parameters/id'
      responses:
        '204':
          description: OK
  /account/reset:
    put:
      operationId: confirmPasswordReset
      summary: Confirms a password reset
      description: |
        Using a token mailed to the user, the user may set a new password on their account.
      tags:
        - account
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                required:
                  - token
                allOf:
                  - $ref: '#/components/schemas/LoginTokenReset'
                  - type: object
                    properties:
                      token:
                        type: string
                        description: The token to be used to confirm the password reset
                      password:
                        type: string
                        description: The new password
  /s/account/login-token:
    get:
      operationId: getLoginTokens
      summary: List of login tokens
      description: |
        Every successful login results in a login token being issued. Usually, this  login token can be converted into a refresh token that can be used to generate JWT access tokens with limited duration. This list shows when login tokens were issued and the information associated with that issue.
      tags:
        - account
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/LoginInfo'
    delete:
      operationId: revokeLoginTokens
      summary: Revokes all login tokens for the current user
      description: |
        Revokes all login tokens for the current user.
      tags:
        - account
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                password:
                  type: string
                  description: The user's current password
                  example: password
      responses:
        '200':
          description: OK
  /s/account/developer/token:
    get:
      operationId: getDeveloperTokens
      summary: List of tokens for the current user
      description: |
        By default, the list only returns currently valid tokens. Use `timeMin` with a date in the past to return tokens that were valid at that point in time.
      tags:
        - account
      parameters:
        - $ref: '#/components/parameters/timeMin'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/DeveloperToken'
    post:
      operationId: createDeveloperToken
      summary: Create a token for the current user
      description: |
        A corresponding activity log entry will be created. Note: the actual `token` will only be returned once here.
      tags:
        - account
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeveloperTokenCreateParams'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeveloperTokenCreateResult'
  /s/account/developer/token/{id}:
    delete:
      operationId: invalidateDeveloperToken
      summary: Invalidate a token
      description: The token will be removed. A corresponding activity log entry will be created.
      tags:
        - account
      parameters:
        - $ref: '#/components/parameters/id'
      responses:
        '204':
          description: OK
  /s/admin/activity:
    get:
      operationId: listActivityLog
      summary: List activity log entries
      tags:
        - admin
      parameters:
        - $ref: '#/components/parameters/max'
        - $ref: '#/components/parameters/start'
        - name: type
          in: query
          description: Activity log entry type
          schema:
            type: array
            items:
              type: string
        - name: subject
          in: query
          description: Subject/initiator of the activity
          schema:
            type: string
        - name: user
          in: query
          description: ID of the user affected by the activity
          schema:
            type: string
        - name: team
          in: query
          description: ID of the team affected by the activity
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ActivityLogEntry'
  /s/admin/activity/types:
    get:
      operationId: listActivityTypes
      summary: List activity types
      tags:
        - admin
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  type: string
                example:
                  - LOGIN
                  - USER_ENABLE
                  - USER_DISABLE
  /s/admin/user:
    delete:
      operationId: deleteUsers
      summary: Delete multiple users in a single transaction
      tags:
        - user
      parameters:
        - name: user
          in: query
          schema:
            type: array
            description: List of user IDs
            items:
              type: string
      responses:
        '204':
          description: OK
  /s/admin/user/{id}:
    delete:
      operationId: deleteUser
      summary: Delete a user
      tags:
        - user
      parameters:
        - $ref: '#/components/parameters/id'
      responses:
        '204':
          description: OK
  /s/admin/user/{id}/role:
    put:
      operationId: addUserRole
      summary: Add a role to a user
      tags:
        - user
      parameters:
        - $ref: '#/components/parameters/id'
        - $ref: '#/components/parameters/role'
      responses:
        '204':
          description: OK
    delete:
      operationId: removeUserRole
      summary: Remove a role from a user
      tags:
        - user
      parameters:
        - $ref: '#/components/parameters/id'
        - $ref: '#/components/parameters/role'
      responses:
        '204':
          description: OK
  /s/search:
    get:
      operationId: search
      summary: Search
      tags:
        - micro
      parameters:
        - $ref: '#/components/parameters/start'
        - $ref: '#/components/parameters/max'
        - $ref: '#/components/parameters/search-order-by'
        - name: type
          in: query
          description: Document type
          schema:
            $ref: '#/components/schemas/SearchDocumentType'
        - name: q
          in: query
          description: Query string
          schema:
            type: string
      responses:
        '200':
          description: OK
          headers:
            X-Total-Count:
              schema:
                type: string
              description: Total number of documents match the search parameters.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/IdName'
  /s/search/user:
    get:
      operationId: searchUsers
      summary: Search users
      tags:
        - user
      parameters:
        - $ref: '#/components/parameters/start'
        - $ref: '#/components/parameters/max'
        - $ref: '#/components/parameters/role-list'
        - $ref: '#/components/parameters/search-order-by'
        - name: q
          in: query
          description: query string
          schema:
            type: string
        - name: team
          in: query
          schema:
            type: array
            description: List of team IDs
            items:
              type: string
        - name: disabled
          in: query
          schema:
            type: boolean
            default: false
      responses:
        '200':
          description: OK
          headers:
            X-Total-Count:
              schema:
                type: string
              description: Total number of users matching the query parameters.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/UserSearch'
  /s/sportsteam:
    get:
      operationId: listTeams
      summary: List teams
      tags:
        - team
      parameters:
        - $ref: '#/components/parameters/start'
        - $ref: '#/components/parameters/max'
        - name: aggregate
          in: query
          description: aggregate count of athletes and trainers
          schema:
            type: boolean
        - name: q
          in: query
          description: search by team name
          schema:
            type: string
        - name: with
          in: query
          description: controls the shape of the data objects, not compatible with 'aggregate' param. Available options 'basic', 'athletes'
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Team'
    put:
      operationId: updateTeam
      summary: Update team
      tags:
        - team
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Team'
      responses:
        '200':
          description: OK
    post:
      operationId: createTeam
      summary: Create a team
      tags:
        - team
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Team'
      responses:
        '200':
          description: OK
  /s/sportsteam/{id}:
    parameters:
      - $ref: '#/components/parameters/id'
    get:
      operationId: getTeam
      summary: Get team
      tags:
        - team
      parameters:
        - name: aggregate
          in: query
          description: aggregate count of athletes and trainers
          schema:
            type: boolean
        - name: with
          in: query
          description: controls the shape of the data objects, not compatible with 'aggregate' param. Available options 'basic', 'athletes'
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Team'
  /s/sportsteam/{id}/{role}/{user_id}:
    parameters:
      - $ref: '#/components/parameters/id'
      - name: role
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/TeamRole'
      - name: user_id
        in: path
        required: true
        schema:
          type: string
    post:
      operationId: addTeamMember
      summary: Add a user to a team
      tags:
        - team
      responses:
        '200':
          description: OK
    delete:
      operationId: removeTeamMember
      summary: Remove a user from a team
      tags:
        - team
      responses:
        '200':
          description: OK
  /s/exercise:
    get:
      operationId: listExercises
      summary: List exercises
      tags:
        - exercise
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Exercise'
    put:
      operationId: updateExercise
      summary: Update exercise
      description: |
        Updates to the referenced collections `instructionPhoto` and `externalLink` are applied directly in the context of the exercise. That means, if the provided list is empty, all contained elements are removed. Updates to the ordering are also applied. 

        - Elements that were removed from the list are deleted.
        - Elements with an ID are resolved and their ordering is updated. If they could not be found, a status 404 is returned
        - Elements without an ID are new elements and will be added to the collection.

        Existing elements can be updated by removing their ID and updating the fields. This will effectively remove the existing element and create a new element at the specified position.
      tags:
        - exercise
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Exercise'
      responses:
        '200':
          description: OK
        '404':
          description: Not Found. The referenced exercise could not be found. Alternatively, it is possible that the request body contained references that could not be resolved.
  /s/exercise/{id}:
    parameters:
      - $ref: '#/components/parameters/id'
    get:
      operationId: getExercise
      summary: Get exercise
      tags:
        - exercise
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Exercise'
    delete:
      operationId: deleteExercise
      summary: Delete exercise
      tags:
        - exercise
      parameters:
        - $ref: '#/components/parameters/removeRefs'
      responses:
        '204':
          description: OK
        '409':
          description: |
            Conflict. Exercise could not be deleted due to existing references. References are provided in response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConflictSummary'
  /s/exercise/{id}/merge:
    post:
      operationId: mergeExercises
      summary: Merge two exercises and delete the source exercise
      description: Replaces all references to the source exercise with the exercise identified by `id`
      tags:
        - exercise
      parameters:
        - $ref: '#/components/parameters/id'
        - name: source
          in: query
          required: true
          description: ID of the exercise to merge into the exercise identified by `id`
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MergeResultExercise'
  /s/unit:
    get:
      operationId: listUnits
      summary: List units
      tags:
        - unit
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Unit'
  /s/exercisepreset:
    get:
      operationId: listExercisePresets
      summary: List exercise presets
      tags:
        - workout
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ExercisePreset'
  /s/exercisepreset/{id}:
    parameters:
      - $ref: '#/components/parameters/id'
    get:
      operationId: getExercisePreset
      summary: Get exercise preset
      tags:
        - workout
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExercisePreset'
    delete:
      operationId: deleteExercisePreset
      summary: Delete exercise preset
      tags:
        - workout
      parameters:
        - $ref: '#/components/parameters/removeRefs'
      responses:
        '204':
          description: OK
        '409':
          description: |
            Conflict. Exercise preset could not be deleted due to existing references. References are provided in response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConflictSummary'
  /s/workout/report:
    get:
      operationId: getWorkoutReport
      summary: Workouts for a specified date range
      tags:
        - report
      parameters:
        - $ref: '#/components/parameters/timeMin'
        - $ref: '#/components/parameters/timeMax'
        - $ref: '#/components/parameters/timeZone'
        - name: teamId
          in: query
          schema:
            type: array
            items:
              type: string
        - name: athlete
          in: query
          schema:
            type: array
            items:
              type: string
        - name: with
          in: query
          description: |
            Provide additional include parameters to receive additional content in the response body
               - `exercise.image`: Include `instructionPhotos` in the workout exercise
               - `exercise.description`: Include `descr` in the workout exercise
          schema:
            type: array
            items:
              enum:
                - exercise.image
                - exercise.description
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/WorkoutReport'
  /s/calendar/event:
    get:
      operationId: getCalendarEvents
      summary: Get calendar events
      description: You can filter events by parent calendars, date ranges, or event types.
      tags:
        - calendar
      parameters:
        - $ref: '#/components/parameters/timeMin'
        - $ref: '#/components/parameters/timeMax'
        - $ref: '#/components/parameters/timeZone'
        - name: calendarId
          in: query
          description: The ID(s) of the calendar
          schema:
            type: array
            items:
              type: string
        - name: exclude
          in: query
          schema:
            type: array
            items:
              $ref: '#/components/schemas/EventGadgetType'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/EventInfo'
  /s/calendar/event/{id}:
    patch:
      operationId: updateCalendarEventPartial
      summary: Update calendar event
      tags:
        - calendar
      parameters:
        - $ref: '#/components/parameters/id'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                calendar:
                  type: string
                  description: New calendar ID
      responses:
        '200':
          description: OK
        '400':
          description: No supported fields updated or new calendar ID matches old ID
  /s/calendar/event/{id}/tracking:
    get:
      operationId: getTrackingForCalendarEvent
      summary: Get tracking information for calendar event
      tags:
        - calendar
      parameters:
        - $ref: '#/components/parameters/id'
        - $ref: '#/components/parameters/start'
        - $ref: '#/components/parameters/max'
      responses:
        '200':
          description: |
            List of calendar IDs and event IDs containing workouts that link to the event in question
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: array
                  items:
                    type: string
                examples:
                  - calendarEventId-1:
                      - derived-cal-evt-a
                      - derived-cal-evt-b
                    calendarEventId-2:
                      - derived-cal-evt-c
  /s/calendar/event/competition:
    get:
      operationId: listCompetitions
      summary: Get competitions
      description: Competitions with relative competition information - MD+ and MD-
      tags:
        - calendar
      parameters:
        - $ref: '#/components/parameters/timeMin'
        - $ref: '#/components/parameters/timeMax'
        - $ref: '#/components/parameters/timeZone'
        - name: calendarId
          in: query
          description: The ID(s) of the calendar
          schema:
            type: array
            items:
              type: string
        - name: teamId
          in: query
          description: The ID(s) of the team that owns the corresponding calendar
          schema:
            type: array
            items:
              type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/CompetitionInfo'
  /s/trainingzone:
    get:
      operationId: listTrainingZones
      summary: List training zones
      tags:
        - exercise
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/TrainingZone'
    post:
      operationId: createTrainingZone
      summary: Create training zone
      tags:
        - exercise
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TrainingZone'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TrainingZone'
        '409':
          description: |
            Feature activation required. Training zone could not be updated, because certain properties need additional 
            features to be activated:

            - More than 1 training zone model
            - More than 1 training zone definition (parameter) in a training zone model
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FeatureActivationRequired'
    put:
      operationId: updateTrainingZone
      summary: Update training zone
      tags:
        - exercise
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TrainingZone'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TrainingZone'
        '409':
          description: |
            Feature activation required. Training zone could not be updated, because certain properties need additional 
            features to be activated:

            - More than 1 training zone model
            - More than 1 training zone definition (parameter) in a training zone model
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FeatureActivationRequired'
  /s/trainingzone/{id}:
    get:
      operationId: getTrainingZone
      summary: Get training zone
      tags:
        - exercise
      parameters:
        - $ref: '#/components/parameters/id'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TrainingZone'
  /s/trainingzone/{id}/update-derived:
    post:
      operationId: updateDerivedPerformanceMeasurements
      summary: Update derived performance measurements for training zone
      tags:
        - exercise
      parameters:
        - $ref: '#/components/parameters/id'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: array
                  items:
                    $ref: '#/components/schemas/PerformanceMeasurement'
  /s/performance/definition/{id}:
    get:
      operationId: getPerformanceDefinition
      summary: Get performance definition
      tags:
        - test
      parameters:
        - $ref: '#/components/parameters/id'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PerformanceDefinition'
  /s/performance/definition/{id}/merge:
    get:
      operationId: mergePerformanceDefinition
      summary: Merge two performance definitions and delete source definition
      description: |
        Updates all references to the source performance definition with the target definition: - Training zones: base definition on definition and zones pdMin and pdMax derivedFrom - Exercise presets and workout exercise presets - Tenant performance config - 
        Additionally, performance measurements are migrated. If there are duplicates, they will be deleted and are included in the `conflicts`.
      tags:
        - test
      parameters:
        - $ref: '#/components/parameters/id'
        - name: source
          in: query
          schema:
            type: string
          description: The id of the source performance definition
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PerformanceDefinition'
  /s/performance/measurement/athlete:
    get:
      operationId: listPerformanceMeasurementsForMultipleAthletes
      summary: List performance measurements for multiple or all athletes
      description: |
        This will return the latest performance measurements for the given athletes. If no athlete was provided and the
        requesting user has appropriate permissions to query all athletes, all athletes are returned.
      tags:
        - test
      parameters:
        - $ref: '#/components/parameters/start'
        - $ref: '#/components/parameters/max'
        - $ref: '#/components/parameters/timeMin'
        - $ref: '#/components/parameters/timeMax'
        - $ref: '#/components/parameters/athlete'
        - name: zone
          description: ID of the training zone model to be used as a result filter.
          in: query
          schema:
            type: string
        - name: definition
          description: ID of the performance definition to be used as a result filter.
          in: query
          schema:
            type: string
        - name: all
          description: Include all results, not only the latest.
          in: query
          schema:
            type: boolean
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/PerformanceMeasurement'
        '403':
          description: Forbidden. Not allowed to access information for specific athlete or all athletes.
  /s/performance/measurement/athlete/{id}:
    parameters:
      - $ref: '#/components/parameters/id'
    get:
      operationId: listPerformanceMeasurementsForAthlete
      summary: List performance measurements for athlete
      description: |
        This will return the latest performance measurements for the given athlete. You can filter measurements by time,
        performance definition, and training zone model. If you want to retrieve all historic results, add the `all` parameter
      tags:
        - test
      parameters:
        - $ref: '#/components/parameters/start'
        - $ref: '#/components/parameters/max'
        - $ref: '#/components/parameters/timeMin'
        - $ref: '#/components/parameters/timeMax'
        - name: zone
          description: ID of the training zone model to be used as a result filter.
          in: query
          schema:
            type: string
        - name: definition
          description: ID of the performance definition to be used as a result filter.
          in: query
          schema:
            type: string
        - name: all
          description: Include all results, not only the latest.
          in: query
          schema:
            type: boolean
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/PerformanceMeasurement'
    post:
      operationId: createPerformanceMeasurement
      summary: Create performance measurement
      tags:
        - test
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PerformanceMeasurement'
      responses:
        '200':
          description: OK
  /s/performance/measurement:
    get:
      operationId: listPerformanceMeasurements
      summary: List performance measurements
      tags:
        - test
      parameters:
        - $ref: '#/components/parameters/timeMax'
        - $ref: '#/components/parameters/timeMin'
        - $ref: '#/components/parameters/max'
        - $ref: '#/components/parameters/start'
        - name: athlete
          in: query
          description: Athlete ID
          schema:
            type: string
        - name: athleteId
          in: query
          description: Athlete ID, alias of athlete
          schema:
            type: string
        - name: definition
          in: query
          description: Performance definition ID
          schema:
            type: string
        - name: zone
          in: query
          description: Training zone model ID
          schema:
            type: string
        - name: test
          in: query
          description: Test ID
          schema:
            type: string
        - name: team
          in: query
          description: Team ID
          schema:
            type: string
        - name: all
          in: query
          description: Include all measurements
          schema:
            type: boolean
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/PerformanceMeasurement'
    post:
      operationId: createPerformanceMeasurements
      summary: Create multiple performance measurements
      tags:
        - test
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PerformanceMeasurementContainer'
      responses:
        '200':
          description: OK
  /s/test/{id}:
    get:
      operationId: getTest
      summary: Get test
      tags:
        - test
      parameters:
        - $ref: '#/components/parameters/id'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Test'
  /s/test/{id}/days:
    get:
      operationId: listTestDays
      summary: List days on which test results have been recorded
      description: List all test days with number of athletes and performance measurements
      tags:
        - test
      parameters:
        - $ref: '#/components/parameters/id'
        - $ref: '#/components/parameters/max'
        - $ref: '#/components/parameters/start'
        - $ref: '#/components/parameters/timeMin'
        - $ref: '#/components/parameters/timeMax'
        - name: team
          in: query
          description: Team ID
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/TestDay'
  /s/test/{id}/importconfig:
    get:
      operationId: getTestImportConfig
      summary: Get import configuration for a test
      parameters:
        - $ref: '#/components/parameters/id'
      tags:
        - test
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TestImportConfiguration'
        '404':
          $ref: '#/components/responses/NotFound'
  /s/test/{id}/threshold:
    get:
      operationId: getTestMeasureThresholds
      summary: Get all thresholds for the referenced test
      tags:
        - test
      parameters:
        - $ref: '#/components/parameters/id'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: string
                    threshold:
                      $ref: '#/components/schemas/IdRef'
                    level:
                      $ref: '#/components/schemas/IdRef'
                    testMeasure:
                      $ref: '#/components/schemas/IdRef'
                    min:
                      type: number
                    max:
                      type: number
    put:
      operationId: updateTestMeasureThresholds
      summary: Update threshold values for test measures associated with this test
      tags:
        - test
      parameters:
        - $ref: '#/components/parameters/id'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateSet'
  /s/test/threshold:
    get:
      tags:
        - test
      summary: Get all thresholds
      operationId: getThresholds
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  allOf:
                    - $ref: '#/components/schemas/Threshold'
    put:
      operationId: updateThresholds
      summary: Create/Update/Delete thresholds
      tags:
        - test
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateSet'
  /s/test/level:
    get:
      tags:
        - test
      summary: Get all assessment levels for thresholds
      operationId: getThresholdLevels
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  allOf:
                    - $ref: '#/components/schemas/ThresholdLevel'
    put:
      operationId: updateThresholdLevels
      summary: Create/Update/Delete levels
      tags:
        - test
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateSet'
  /s/microcycle:
    get:
      operationId: getMicroTemplates
      summary: List micro templates
      tags:
        - micro
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/MicroTemplate'
    post:
      operationId: createMicroTemplate
      summary: Create micro template
      tags:
        - micro
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MicroTemplate'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/MicroTemplate'
  /s/microcycle/{id}:
    parameters:
      - $ref: '#/components/parameters/id'
    get:
      operationId: getMicroTemplate
      summary: Get micro template
      tags:
        - micro
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MicroTemplate'
    patch:
      operationId: updateMicroTemplate
      summary: Update a micro template
      tags:
        - micro
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MicroTemplate'
      responses:
        '200':
          description: OK
    delete:
      operationId: deleteMicroTemplate
      summary: Delete a micro template
      tags:
        - micro
      parameters:
        - $ref: '#/components/parameters/id'
      responses:
        '204':
          description: OK
  /s/microcycle/assignment:
    get:
      operationId: getMicroTemplateAssignments
      summary: List micro template assignments
      tags:
        - micro
      parameters:
        - $ref: '#/components/parameters/dateFromMin'
        - $ref: '#/components/parameters/dateFromMax'
        - $ref: '#/components/parameters/dateToMin'
        - $ref: '#/components/parameters/dateToMax'
        - name: id
          in: query
          description: List of micro template IDs to include
          schema:
            type: array
            items:
              type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/MicroTemplateAssignmentWithUser'
    post:
      operationId: createMicroTemplateAssignment
      summary: Create micro template assignment
      tags:
        - micro
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MicroTemplateAssignment'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/MicroTemplateAssignmentWithUser'
  /s/microcycle/assignment/{id}:
    parameters:
      - $ref: '#/components/parameters/id'
    get:
      operationId: getMicroTemplateAssignment
      summary: Get micro template assignment
      tags:
        - micro
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MicroTemplateAssignment'
    delete:
      operationId: deleteMicroTemplateAssignment
      summary: Delete a micro template assignment
      tags:
        - micro
      parameters:
        - $ref: '#/components/parameters/id'
      responses:
        '204':
          description: OK
  /s/macro/templates:
    get:
      operationId: getMacroTemplates
      summary: List macro template
      tags:
        - macro
      parameters:
        - $ref: '#/components/parameters/calendar-list'
        - $ref: '#/components/parameters/start'
        - $ref: '#/components/parameters/max'
        - $ref: '#/components/parameters/timeMin'
        - $ref: '#/components/parameters/timeMax'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/MacroTemplate'
    post:
      operationId: createMacroTemplate
      summary: Create a macro template
      tags:
        - macro
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MacroTemplateFull'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/MacroTemplate'
    put:
      operationId: updateMacroTemplate
      summary: Update a macro template
      tags:
        - macro
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MacroTemplate'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MacroTemplate'
  /s/macro/templates/{id}:
    get:
      operationId: getMacroTemplate
      summary: Get a macro template
      tags:
        - macro
      parameters:
        - $ref: '#/components/parameters/id'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MacroTemplate'
    delete:
      operationId: deleteMacroTemplate
      summary: Delete a macro template
      tags:
        - macro
      parameters:
        - $ref: '#/components/parameters/id'
      responses:
        '204':
          description: OK
  /s/macro/templates/{id}/config/workload:
    get:
      operationId: getMacroWorkloadConfigs
      summary: Get workload configs for macro
      description: Get workload configs for a macro template which specify the rows
      tags:
        - macro
      parameters:
        - $ref: '#/components/parameters/id'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/MacroWorkloadConfig'
    put:
      operationId: updateMacroWorkloadConfigs
      summary: Update workload configs of a macro template
      tags:
        - macro
      parameters:
        - $ref: '#/components/parameters/id'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateSet'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/MacroWorkloadConfig'
  /s/macro/templates/{id}/periods:
    get:
      operationId: getMacroPeriods
      summary: Get periodization for macro
      tags:
        - macro
      parameters:
        - $ref: '#/components/parameters/id'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/MacroTemplatePeriod'
    put:
      operationId: updateMacroPeriods
      summary: Update periodization model of a macro template
      tags:
        - macro
      parameters:
        - $ref: '#/components/parameters/id'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateSet'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/MacroTemplatePeriod'
  /s/macro/templates/{id}/values:
    get:
      operationId: getMacroValues
      summary: Get values for macro
      description: Get values associated with a macro template
      tags:
        - macro
      parameters:
        - $ref: '#/components/parameters/id'
        - $ref: '#/components/parameters/start'
        - $ref: '#/components/parameters/max'
        - name: indexMin
          in: query
          description: Minimum index in relation to the start of the macro template.
          schema:
            type: integer
        - name: indexMax
          in: query
          description: Maximum index in relation to the start of the macro template.
          schema:
            type: integer
        - name: includeDate
          in: query
          description: Whether to include effective dates or not. Defaults to `false`
          schema:
            type: boolean
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/MacroTemplateValue'
    put:
      operationId: updateMacroValues
      summary: Update values of a macro template
      tags:
        - macro
      parameters:
        - $ref: '#/components/parameters/id'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateSet'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/MacroTemplateValue'
  /s/attendance:
    get:
      operationId: listAttendanceAggregation
      summary: List attendance aggregations
      tags:
        - attendance
      parameters:
        - name: aggregation
          in: query
          required: false
          schema:
            type: string
            default: week
            enum:
              - week
              - month
              - year
        - name: weekstart
          in: query
          required: false
          schema:
            type: string
            default: monday
            enum:
              - monday
              - sunday
        - $ref: '#/components/parameters/user'
        - $ref: '#/components/parameters/timeMinLocal'
        - $ref: '#/components/parameters/timeMaxLocal'
        - $ref: '#/components/parameters/start'
        - $ref: '#/components/parameters/max'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/AttendanceAggregation'
  /s/attendance/calendar:
    get:
      operationId: listCalendarAttendance
      summary: Get calendar attendance
      tags:
        - attendance
      parameters:
        - $ref: '#/components/parameters/calendar-list'
        - $ref: '#/components/parameters/user'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Attendance'
  /s/attendance/event/{id}/{date}:
    get:
      operationId: listEventAttendances
      summary: Get attendances for event
      tags:
        - attendance
      parameters:
        - $ref: '#/components/parameters/id'
        - name: date
          in: path
          required: true
          schema:
            type: string
            format: date
        - $ref: '#/components/parameters/timeMinLocal'
        - $ref: '#/components/parameters/timeMaxLocal'
        - $ref: '#/components/parameters/start'
        - $ref: '#/components/parameters/max'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Attendance'
  /s/attendance/types:
    get:
      operationId: listAttendanceTypes
      summary: List attendance types
      tags:
        - attendance
      parameters:
        - $ref: '#/components/parameters/start'
        - $ref: '#/components/parameters/max'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/AttendanceType'
    post:
      operationId: createAttendanceType
      summary: Create an attendance type
      tags:
        - attendance
      requestBody:
        description: Attendance type to create
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AttendanceType'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AttendanceType'
    put:
      operationId: updateAttendanceType
      summary: Update an attendance type
      tags:
        - attendance
      requestBody:
        description: Attendance type to update
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AttendanceType'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AttendanceType'
  /s/attendance/types/{id}:
    get:
      operationId: getAttendanceType
      summary: Get attendance type
      tags:
        - attendance
      parameters:
        - $ref: '#/components/parameters/id'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AttendanceType'
    delete:
      operationId: deleteAttendanceType
      summary: Delete attendance type
      tags:
        - attendance
      parameters:
        - $ref: '#/components/parameters/id'
      responses:
        '204':
          description: No Content
  /s/questionnaire:
    get:
      operationId: listQuestionnaires
      summary: List questionnaires
      tags:
        - questionnaries
      parameters:
        - $ref: '#/components/parameters/start'
        - $ref: '#/components/parameters/max'
        - $ref: '#/components/parameters/timeMinLocal'
        - $ref: '#/components/parameters/timeMaxLocal'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Questionnaire'
  /s/questionnaire/{id}:
    get:
      operationId: getQuestionnaire
      summary: Get questionnaire
      tags:
        - questionnaires
      parameters:
        - $ref: '#/components/parameters/id'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Questionnaire'
  /s/questionnaire/{id}/responses:
    get:
      operationId: listQuestionnaireResponses
      summary: List questionnaire responses
      tags:
        - questionnaires
      parameters:
        - $ref: '#/components/parameters/id'
        - $ref: '#/components/parameters/user'
        - $ref: '#/components/parameters/timeMinLocal'
        - $ref: '#/components/parameters/timeMaxLocal'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/QuestionnaireResponse'
  /s/questionnaire/{id}/test:
    post:
      operationId: processQuestionnaireTestUpdates
      summary: Trigger test updates from questionnaire responses
      tags:
        - questionnaires
      parameters:
        - $ref: '#/components/parameters/id'
        - $ref: '#/components/parameters/user'
        - $ref: '#/components/parameters/timeMinLocal'
        - $ref: '#/components/parameters/timeMaxLocal'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: integer
                description: Number of updates that were triggered
components:
  schemas:
    Role:
      description: User role
      type: string
      enum:
        - ATHLETE
        - TRAINER
        - TENANTTRAINER
        - TENANTADMIN
    Identifiable:
      description: Object with id
      type: object
      properties:
        id:
          type: string
    IdRef:
      description: Reference to an object identified by ID
      type: object
      required:
        - id
      allOf:
        - $ref: '#/components/schemas/Identifiable'
    UserSettings:
      description: User
      type: object
      required:
        - roles
        - features
        - tenant
      properties:
        roles:
          type: array
          items:
            $ref: '#/components/schemas/Role'
        features:
          type: array
          items:
            type: string
        tenant:
          type: object
        teams:
          type: array
          items:
            $ref: '#/components/schemas/IdRef'
    UserMinimal:
      description: Smaller user representation
      type: object
      required:
        - id
        - roles
      allOf:
        - $ref: '#/components/schemas/Identifiable'
        - properties:
            firstname:
              type: string
            lastname:
              type: string
            shortUsername:
              type: string
            externalId:
              type: string
            ext:
              type: object
              description: Custom 'extension' properties.
            disabled:
              type: boolean
            roles:
              type: array
              items:
                $ref: '#/components/schemas/Role'
    User:
      description: User
      type: object
      required:
        - id
        - roles
      allOf:
        - $ref: '#/components/schemas/UserMinimal'
        - properties:
            birthday:
              type: string
    PersonName:
      description: Person with name
      type: object
      required:
        - firstName
        - lastName
      properties:
        firstName:
          type: string
        lastName:
          type: string
    Person:
      description: Person with name and email
      type: object
      required:
        - firstName
        - lastName
        - email
      allOf:
        - $ref: '#/components/schemas/PersonName'
        - properties:
            email:
              type: string
              format: email
    UserCreate:
      description: User creation model
      type: object
      required:
        - firstName
        - lastName
        - email
      allOf:
        - $ref: '#/components/schemas/Person'
        - properties:
            roles:
              type: array
              items:
                $ref: '#/components/schemas/Role'
            teams:
              type: array
              items:
                $ref: '#/components/schemas/IdRef'
            invite:
              type: boolean
              default: false
              description: Set this to `true` to send an invitation via email
            message:
              type: string
              description: Use this together with `invite=false` to send a personalized message
    LoginTokenReset:
      type: object
      properties:
        invalidateLoginTokens:
          type: boolean
          description: If true, all login tokens for the user will be invalidated.
          default: false
    ResetPassword:
      description: Information to reset a password
      type: object
      allOf:
        - $ref: '#/components/schemas/LoginTokenReset'
        - type: object
          required:
            - newPassword
          properties:
            currentPassword:
              type: string
              description: The user's current password. If the current user can manage the target user, this field is optional.
            newPassword:
              type: string
            invalidateLoginTokens:
              type: boolean
              description: If true, all login tokens for the user will be invalidated.
              default: false
    MergeResult:
      title: Result of a merge operation
      properties:
        summary:
          additionalProperties:
            type: integer
        conflicts:
          additionalProperties:
            type: array
            items:
              type: object
        result:
          type: object
    MergeResultUser:
      allOf:
        - $ref: '#/components/schemas/MergeResult'
        - properties:
            result:
              $ref: '#/components/schemas/UserMinimal'
    UserUpdate:
      description: User update model
      type: object
      allOf:
        - $ref: '#/components/schemas/UserMinimal'
        - properties:
            birthday:
              type: string
              format: date
            mailNotification:
              type: string
            mailNotificationOnTeamUpdate:
              type: string
            enableSync:
              type: boolean
            selfManaged:
              type: boolean
            tutorials:
              type: array
              items:
                type: string
            billingAdmin:
              type: boolean
    IdName:
      description: Object with id and name
      type: object
      allOf:
        - $ref: '#/components/schemas/Identifiable'
        - properties:
            name:
              type: string
    Calendar:
      description: Calendar as container for events
      type: object
      allOf:
        - $ref: '#/components/schemas/IdName'
        - properties:
            type:
              description: Team or personal calendar
              enum:
                - PERSONAL
                - TEAM
            user:
              description: Owner of the calendar, if type=PERSONAL
              type: object
              properties:
                id:
                  type: string
                firstname:
                  type: string
                lastname:
                  type: string
                shortUsername:
                  type: string
            team:
              description: Owner of the calendar, if type=TEAM
              properties:
                id:
                  type: string
                name:
                  type: string
    Assignment:
      description: Generic assignment
      type: object
      properties:
        start:
          type: string
          format: date
          description: Start date of the assignment
        end:
          type: string
          format: date
          description: End date of the assignment
    MicroAssignment:
      description: Micro plan assigned to a user
      type: object
      allOf:
        - $ref: '#/components/schemas/IdName'
        - $ref: '#/components/schemas/Assignment'
        - properties:
            eventCount:
              type: integer
              description: Number of events in this assignment
    WorkoutAssignment:
      description: Workout assigned to a user
      type: object
      properties:
        user:
          $ref: '#/components/schemas/UserMinimal'
        workout:
          $ref: '#/components/schemas/IdName'
    LoginInfo:
      description: Information on an issued login token
      type: object
      required:
        - id
      properties:
        createdOn:
          type: string
          format: date-time
          description: The time when this token was created
        info:
          type: string
          description: Additional information related to the creation of the token, e.g. host.
    DeveloperToken:
      allOf:
        - $ref: '#/components/schemas/IdName'
        - properties:
            iat:
              type: string
              format: date-time
              description: The time when this token was created ("Issued At")
            exp:
              type: string
              format: date-time
              description: The maximum validity of this token created ("Expiration time")
    DeveloperTokenCreateParams:
      properties:
        password:
          type: string
          description: The current password of the user performing the request
        name:
          type: string
          description: The name of the token to create
      required:
        - password
        - name
    DeveloperTokenCreateResult:
      allOf:
        - $ref: '#/components/schemas/DeveloperToken'
        - properties:
            token:
              type: string
              description: The generated token
    ActivityLogEntry:
      description: Entry in the activity log
      type: object
      allOf:
        - $ref: '#/components/schemas/Identifiable'
        - properties:
            type:
              type: string
            message:
              type: string
            subject:
              type: string
              description: Subject/initiator of the activity
            user:
              type: string
              description: ID of the user affected by the activity
            team:
              type: string
              description: ID of the team affected by the activity
            createdOn:
              type: string
              format: date-time
              description: The time when this entry was created
    SearchDocumentType:
      description: Document type to restrict search results
      enum:
        - EXERCISE
        - ROUTINE
        - MICROTEMPLATE
        - USER
    UserSearch:
      description: Result of a search request for users
      type: object
      allOf:
        - $ref: '#/components/schemas/Person'
        - properties:
            externalId:
              type: string
    AthleteVisibility:
      description: Visibility of athletes for other team members
      type: string
      enum:
        - TENANT
        - TEAM
        - TRAINER
    Team:
      description: Team
      type: object
      required:
        - name
        - trainerIdentity
      allOf:
        - $ref: '#/components/schemas/IdName'
        - properties:
            athleteLimit:
              type: number
            athleteVisibility:
              $ref: '#/components/schemas/AthleteVisibility'
            calendar:
              $ref: '#/components/schemas/IdRef'
            trainerIdentity:
              type: array
              items:
                $ref: '#/components/schemas/IdRef'
    TeamRole:
      description: User role
      type: string
      enum:
        - ATHLETE
        - TRAINER
    IdNameDescr:
      description: Object with id, name, and description
      type: object
      allOf:
        - $ref: '#/components/schemas/IdName'
        - properties:
            descr:
              type: string
    Exercise:
      description: Exercise
      type: object
      allOf:
        - $ref: '#/components/schemas/IdName'
        - properties:
            note:
              type: string
            instructionPhoto:
              type: array
              items:
                allOf:
                  - $ref: '#/components/schemas/Identifiable'
                  - properties:
                      contentType:
                        type: string
                      fileSize:
                        type: number
                      fileName:
                        type: string
                      fileUrl:
                        type: string
                      downloadUrl:
                        type: string
            externalLink:
              type: array
              items:
                allOf:
                  - $ref: '#/components/schemas/IdNameDescr'
                  - properties:
                      url:
                        type: string
                      linkType:
                        type: string
                        enum:
                          - VIDEO
                          - HTML
                          - IMAGE
    ConflictElement:
      description: Details related to a conflict response
      type: object
      allOf:
        - $ref: '#/components/schemas/IdName'
        - properties:
            type:
              type: string
            url:
              type: string
    ConflictReferenceType:
      description: Conflict reference type
      type: string
      enum:
        - WorkoutExercisePreset
        - TrackedPreset
        - TestConstraint
        - TrackingSummary.PresetReference
    ConflictSummary:
      description: Details related to a conflict response
      type: object
      allOf:
        - $ref: '#/components/schemas/ConflictElement'
        - properties:
            referenceCount:
              description: Number of conflicting references
              type: integer
              example: 33
        - oneOf:
            - properties:
                referenceTypes:
                  type: object
                  propertyNames:
                    $ref: '#/components/schemas/ConflictReferenceType'
                  additionalProperties:
                    type: integer
                  example:
                    WorkoutExercisePreset: 26
                    TrackedPreset: 7
            - properties:
                references:
                  type: array
                  description: |
                    List of conflicting references. May be included, if no reference types are provided
                  items:
                    $ref: '#/components/schemas/ConflictElement'
    MergeResultExercise:
      allOf:
        - $ref: '#/components/schemas/MergeResult'
        - properties:
            result:
              $ref: '#/components/schemas/Exercise'
    Unit:
      description: Unit
      type: object
      allOf:
        - $ref: '#/components/schemas/IdName'
        - properties:
            shortcut:
              type: string
            unitGroup:
              $ref: '#/components/schemas/IdRef'
            measureType:
              type: string
              enum:
                - NEUTRAL
                - METRIC
                - IMPERIAL
    IdNameShort:
      description: Object with id, name, and short name
      type: object
      allOf:
        - $ref: '#/components/schemas/IdName'
        - properties:
            short:
              type: string
              description: Abbreviated name
    ExercisePreset:
      description: Preset/parameter for exercise
      type: object
      allOf:
        - $ref: '#/components/schemas/IdNameShort'
        - properties:
            integer:
              type: boolean
              description: Whether this preset should only provide integer values (e.g. repetitions)
            excludeAggregation:
              type: boolean
              description: Exclude from aggregation when calculating summary
            multiplicator:
              type: number
              description: Multiplier for the value
    EventGadgetType:
      description: Type of content associated with an event
      enum:
        - WORKOUT
        - ABSENCE
        - COMPETITION
        - TRACKING
    EventGadget:
      description: Information attached to an event
      type: object
      properties:
        id:
          type: string
        descr:
          type: string
        gadgetType:
          $ref: '#/components/schemas/EventGadgetType'
        metadata:
          type: array
          items:
            properties:
              key:
                type: string
              value:
                type: string
    EventInfo:
      description: Reduced information for an event
      type: object
      allOf:
        - $ref: '#/components/schemas/IdNameDescr'
        - properties:
            allDay:
              type: boolean
              description: Whether the event is specified for the day
            start:
              type: string
              format: date-time
              description: Start of the event
            end:
              type: string
              format: date-time
              description: End of the event
            date:
              type: string
              format: date-time
              description: Alias for 'start'
            gadget:
              $ref: '#/components/schemas/EventGadget'
            gadgets:
              type: array
              items:
                $ref: '#/components/schemas/EventGadget'
    ResourceRef:
      description: Reference to a resource that can be retrieved via an URL
      type: object
      allOf:
        - $ref: '#/components/schemas/IdRef'
        - properties:
            contentType:
              type: string
            downloadUrl:
              type: string
              description: URL to download the resource
            fileName:
              type: string
              description: Name of the file
            fileSize:
              type: number
              description: Size in bytes
    UnitInfo:
      description: Smaller representation of a unit in the context of a workout
      type: object
      allOf:
        - $ref: '#/components/schemas/IdName'
        - properties:
            shortcut:
              type: string
            group:
              type: string
              description: ID of the unit group
            time:
              type: boolean
              description: Whether the unit is a time unit (e.g. hours, seconds, pace)
    WorkoutExercisePresetValue:
      description: Value for a
      type: object
      properties:
        planned:
          type: string
          description: The planned value as shown to the user
        actual:
          type: string
          description: The actual value as provided by the user
        min:
          type: number
          description: The lower bound of the planned value
        max:
          type: number
          description: The upper bound of the planned value
        plannedRaw:
          type: number
          description: The value normalized for the standardized unit (1 hour → 1,000,000 millis)
    WorkoutExercisePreset:
      description: Preset/parameter for workout exercise
      type: object
      allOf:
        - $ref: '#/components/schemas/IdName'
        - properties:
            exercisePresetId:
              type: string
              description: ID of the referenced exercise preset
            unit:
              $ref: '#/components/schemas/UnitInfo'
            values:
              description: One value per set
              type: array
              items:
                $ref: '#/components/schemas/WorkoutExercisePresetValue'
    WorkoutExercise:
      description: |
        Single exercise within a workout. This points to an exercise and puts it in context with presets
      type: object
      allOf:
        - $ref: '#/components/schemas/IdNameDescr'
        - properties:
            workoutExerciseId:
              type: string
              description: Alias for id
            exerciseId:
              type: string
              description: ID of the referenced exercise
            instructionPhotos:
              description: Array of resource references to retrieve the associated images
              type: array
              items:
                $ref: '#/components/schemas/ResourceRef'
            presets:
              type: array
              items:
                $ref: '#/components/schemas/WorkoutExercisePreset'
    ExerciseSet:
      description: Set of exercises
      type: object
      properties:
        id:
          type: string
          description: ID of the exercise set
        exercises:
          type: array
          items:
            $ref: '#/components/schemas/WorkoutExercise'
    WorkoutReportEvent:
      description: Workout with date information
      type: object
      allOf:
        - $ref: '#/components/schemas/EventInfo'
      properties:
        exerciseSets:
          type: array
          items:
            $ref: '#/components/schemas/ExerciseSet'
    AthleteWorkoutReport:
      description: Aggregation of workouts for an individual athlete. Property 'id' refers to the athlete and 'name' contains the full name of the athlete.
      type: object
      allOf:
        - $ref: '#/components/schemas/IdName'
        - $ref: '#/components/schemas/PersonName'
        - properties:
            events:
              type: array
              items:
                $ref: '#/components/schemas/WorkoutReportEvent'
    WorkoutReport:
      description: Aggregation of workouts
      type: object
      properties:
        name:
          type: string
          description: Title of the report
        athleteWorkouts:
          type: array
          items:
            $ref: '#/components/schemas/AthleteWorkoutReport'
    CompetitionInfo:
      description: Information related to a competition
      type: object
      allOf:
        - $ref: '#/components/schemas/IdNameDescr'
        - properties:
            date:
              type: string
              format: date
              description: The date
            competitionDaysBefore:
              type: integer
              description: The number of days before the competition (MD-)
            competitionDaysAfter:
              type: integer
              description: The number of days after a competition (MD+)
            competitions:
              type: array
              items:
                type: object
                allOf:
                  - $ref: '#/components/schemas/IdNameDescr'
                  - properties:
                      opponent:
                        type: string
                      locationType:
                        enum:
                          - HOME
                          - AWAY
                        type: string
    TrainingZoneRow:
      title: Training Zone Row
      type: object
      allOf:
        - $ref: '#/components/schemas/IdNameDescr'
        - properties:
            color:
              type: string
              description: RGB in hexadecimal notation
              pattern: ^#(?:[0-9a-fA-F]{3}){1,2}$
    TrainingZoneDefinition:
      title: Training Zone Definition
      type: object
      allOf:
        - $ref: '#/components/schemas/IdName'
        - type: object
          properties:
            baseDefinition:
              $ref: '#/components/schemas/IdRef'
            baseUnit:
              $ref: '#/components/schemas/IdRef'
        - oneOf:
            - type: object
              properties:
                staticBoundaries:
                  type: boolean
                  default: true
                boundaries:
                  type: array
                  items:
                    type: boolean
            - type: object
              properties:
                staticBoundaries:
                  type: boolean
                  default: false
                boundaries:
                  type: array
                  items:
                    type: array
                    minItems: 2
                    maxItems: 2
                    items:
                      type: number
                      format: float
                  examples:
                    - - - null
                        - 0.6
                      - - 0.6
                        - 0.72
                      - - 0.72
                        - 0.83
                      - - 0.83
                        - 0.95
                      - - 0.95
                        - null
    TrainingZone:
      title: Training Zone
      type: object
      allOf:
        - $ref: '#/components/schemas/IdNameDescr'
        - properties:
            rows:
              type: array
              description: The order of rows is relevant
              items:
                $ref: '#/components/schemas/TrainingZoneRow'
            definitions:
              type: array
              description: The order of elements in this array controls the order of columns in the UI
              items:
                $ref: '#/components/schemas/TrainingZoneDefinition'
    FeatureActivationRequired:
      description: Operation needs a feature to be activated
      type: object
      properties:
        feature:
          type: string
          description: Name of the feature that needs to be activated
        details:
          type: string
          description: Additional details related to the operation that requires the feature
    PerformanceMeasurement:
      title: Performance Measurement
      description: Generic term for a test result. This associates an athlete at a date with a certain value attained for a performance definition.
      properties:
        id:
          type: string
        performanceDefinition:
          $ref: '#/components/schemas/IdRef'
        unit:
          $ref: '#/components/schemas/IdRef'
        athleteIdentity:
          $ref: '#/components/schemas/IdRef'
        day:
          type: string
          format: date
        value:
          type: number
    PerformanceDefinition:
      description: Performance Definition
      type: object
      allOf:
        - $ref: '#/components/schemas/IdName'
        - properties:
            shortcut:
              type: string
            unit:
              type: array
              items:
                $ref: '#/components/schemas/IdRef'
            exerciseSpecific:
              type: boolean
    PerformanceRef:
      title: Performance Reference
      description: Reference to a performance definition or a training zone
      oneOf:
        - type: object
          properties:
            performanceDefinition:
              $ref: '#/components/schemas/IdRef'
        - type: object
          properties:
            trainingZoneModel:
              $ref: '#/components/schemas/IdRef'
            sequenceIndex:
              type: number
        - type: object
          properties:
            trainingZoneDefinition:
              $ref: '#/components/schemas/IdRef'
    MinMaxWithIndex:
      title: Min/Max Value with Index
      properties:
        sequenceIndex:
          type: number
          description: References the index of zone within the model. If omitted, the position within the array is used.
        value:
          type: number
        min:
          type: number
        max:
          type: number
    MeasurementValue:
      title: Measurement Value
      oneOf:
        - type: object
          properties:
            value:
              type: number
        - type: object
          properties:
            baseValue:
              type: number
            values:
              type: array
              items:
                $ref: '#/components/schemas/MinMaxWithIndex'
    MeasurementRef:
      title: Measurement Reference
      allOf:
        - type: object
          properties:
            unit:
              $ref: '#/components/schemas/IdRef'
        - $ref: '#/components/schemas/PerformanceRef'
        - $ref: '#/components/schemas/MeasurementValue'
    PerformanceMeasurementContainer:
      required:
        - date
        - user
        - measurements
      properties:
        date:
          type: string
          format: date
        user:
          $ref: '#/components/schemas/IdRef'
        measurements:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/MeasurementRef'
          examples:
            - performanceDefinition:
                id: pd-1
              value: 123
            - trainingZoneDefinition:
                id: tzDef-1
              values:
                - min: 119
                  max: 142
                - min: 135
                  max: 170
            - trainingZoneModel:
                id: tzModel-1
              value:
                - sequenceIndex: 0
                  min: 4
                  max: 10
                - sequenceIndex: 3
                  min: 50
                  max: 55
    Test:
      title: Test
      description: Test with associated measures and constraints
      allOf:
        - $ref: '#/components/schemas/IdName'
        - properties:
            measure:
              type: array
              items:
                type: object
                allOf:
                  - $ref: '#/components/schemas/Identifiable'
                properties:
                  performanceDefinition:
                    $ref: '#/components/schemas/IdRef'
                  unit:
                    $ref: '#/components/schemas/IdRef'
            constraint:
              type: array
              items:
                type: object
                allOf:
                  - $ref: '#/components/schemas/Identifiable'
                properties:
                  performanceDefinition:
                    $ref: '#/components/schemas/IdRef'
                  exercisePreset:
                    $ref: '#/components/schemas/IdRef'
                  unit:
                    $ref: '#/components/schemas/IdRef'
                  value:
                    type: number
            exercise:
              $ref: '#/components/schemas/IdRef'
    TestDay:
      title: Test Day
      description: Date with associated number of athletes and measurements
      properties:
        day:
          type: string
          format: date
        athletes:
          type: integer
        measurements:
          type: integer
    TestImportConfiguration:
      title: Test Import Configuration
      description: Import configuration with mappings from CSV columns to test measures
      properties:
        id:
          type: string
        descr:
          type: string
        userColumn:
          description: Name of the column in the CSV file that identifies the user
          type: string
        userIdentityField:
          description: Type of information in the `userColumn` field
          enum:
            - ID
            - LASTNAME
            - FIRSTNAME
            - SHORTUSERNAME
            - FIRST_LAST_COMMA
            - LAST_FIRST_COMMA
            - PRIMARYEMAILADDRESS
            - BIRTHDAY
        dateColumn:
          description: Name of the column in the CSV file that identifies the date of the test
          type: string
        mappings:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
              csvColumn:
                type: string
                description: The name of the column in the CSV file
              testMeasure:
                $ref: '#/components/schemas/IdRef'
    UpdateSet:
      title: Wrapper for combined create, update, destroy operationId
      properties:
        create:
          type: array
          items:
            properties:
              name:
                type: string
        delete:
          type: array
          items:
            $ref: '#/components/schemas/Identifiable'
        update:
          type: array
          items:
            $ref: '#/components/schemas/Identifiable'
    Threshold:
      title: Threshold
      description: Threshold for a test measure
      allOf:
        - $ref: '#/components/schemas/IdNameShort'
      properties:
        sequenceIndex:
          type: integer
    ThresholdLevel:
      title: Threshold Level
      description: Assessment level for a test thresholds
      allOf:
        - $ref: '#/components/schemas/IdNameShort'
      properties:
        sequenceIndex:
          type: integer
    MicroTemplate:
      title: Micro template
      allOf:
        - $ref: '#/components/schemas/IdNameDescr'
        - properties:
            keywords:
              type: string
            duration:
              description: Duration in days
              type: integer
              minimum: 0
              maximum: 300
            published:
              type: boolean
    MicroTemplateAssignment:
      description: Assignment of micro template to a calendar
      type: object
      allOf:
        - $ref: '#/components/schemas/Identifiable'
        - $ref: '#/components/schemas/Assignment'
        - properties:
            parent:
              description: Micro template
              $ref: '#/components/schemas/IdRef'
            calendar:
              description: Target calendar
              $ref: '#/components/schemas/IdRef'
            lastSync:
              type: string
              format: date-time
              description: Last synchronization date
    MicroTemplateAssignmentWithUser:
      description: Micro template assignment with user information
      type: object
      allOf:
        - $ref: '#/components/schemas/MicroTemplateAssignment'
        - properties:
            user:
              description: User information for this assignment
              $ref: '#/components/schemas/User'
    MacroTemplate:
      title: Macro template
      allOf:
        - $ref: '#/components/schemas/IdNameDescr'
      properties:
        duration:
          type: integer
          minimum: 0
          maximum: 52
          description: Duration of plan in weeks
        start:
          type: string
          format: date
          description: The macro's start date, must be a monday
          examples:
            - '2022-12-05'
        calendar:
          $ref: '#/components/schemas/Calendar'
    MacroWorkloadConfig:
      title: Macro workload config
      allOf:
        - $ref: '#/components/schemas/IdName'
      properties:
        sequenceIndex:
          type: integer
        type:
          enum:
            - UNIT
            - PERCENT
            - DISCRETE
            - TEXT
            - NB_WORKOUTS
            - NB_WORKOUT_DAYS
          description: Type of the workload config
        levels:
          type: array
          items:
            type: string
          description: Define multiple values for each interval for distinct levels.
        trainingAreas:
          type: array
          items:
            type: string
            format: ID
          description: Define multiple values for each interval for training areas.
        visualization:
          enum:
            - TEXT
            - BAR
            - STEPS
            - LINE
            - DOT
            - DASH
          description: Presentation of data in table, availability depends on type
        stacked:
          type: boolean
          description: Control if values separated by levels should be displayed in a stacked chart
        discreteValues:
          type: object
          description: Map of pre-defined values if type=DISCRETE
        distribute:
          type: boolean
          description: If true, allow to specify values with interval=DAY for this row, only available if type=UNIT
    MacroTemplateValue:
      title: Macro template value
      properties:
        id:
          type: string
        configId:
          type: string
          description: ID of the associated workload config
        interval:
          enum:
            - DAY
            - WEEK
        index:
          type: integer
          minimum: 0
          description: Relative position to the macro's start date
        date:
          type: string
          format: date
          description: Effective date corresponding to the macro's start date plus index
        value:
          type: integer
        text:
          type: string
    MacroWorkloadConfigWithValues:
      title: Macro workload config with values
      allOf:
        - $ref: '#/components/schemas/MacroWorkloadConfig'
      properties:
        values:
          type: array
          items:
            $ref: '#/components/schemas/MacroTemplateValue'
          description: Values for the workload config
    MacroTemplateSubPeriod:
      title: Macro template periodization sub-segment
      allOf:
        - $ref: '#/components/schemas/IdNameShort'
      properties:
        start:
          type: integer
          description: Index of start week, must be same or higher than that of the parent
        target:
          type: string
          description: Free text field to describe targets of that period
    MacroTemplatePeriod:
      title: Macro template periodization segment
      allOf:
        - $ref: '#/components/schemas/IdNameShort'
      properties:
        start:
          type: integer
          description: Index of start week
        target:
          type: string
          description: Free text field to describe targets of that period
        periodType:
          enum:
            - PREPARATION
            - COMPETITION
            - TRANSITION
        subPeriods:
          type: array
          items:
            $ref: '#/components/schemas/MacroTemplateSubPeriod'
    MacroTemplateFull:
      title: Macro template
      allOf:
        - $ref: '#/components/schemas/MacroTemplate'
      properties:
        configs:
          type: array
          items:
            $ref: '#/components/schemas/MacroWorkloadConfigWithValues'
        periods:
          type: array
          items:
            $ref: '#/components/schemas/MacroTemplatePeriod'
    AttendanceAggregation:
      title: AttendanceType
      description: Type of attendance
      properties:
        start:
          type: string
          format: date
          description: Start of the aggregation period
        end:
          type: string
          format: date
          description: End of the aggregation period
        attendances:
          type: array
          description: Number of attendances for every type in the aggregation period
          items:
            type: object
            properties:
              type:
                $ref: '#/components/schemas/IdRef'
              sum:
                type: integer
                description: Number of attendances for the type in the aggregation period
    Attendance:
      title: Attendance
      description: Attendance
      allOf:
        - $ref: '#/components/schemas/Identifiable'
        - properties:
            type:
              $ref: '#/components/schemas/IdRef'
            user:
              $ref: '#/components/schemas/IdRef'
            event:
              $ref: '#/components/schemas/IdRef'
            date:
              type: string
              format: date
    AttendanceType:
      title: AttendanceType
      description: Type of attendance
      allOf:
        - $ref: '#/components/schemas/IdNameDescr'
        - properties:
            short:
              type: string
              description: Abbreviated name
            attending:
              type: boolean
    LocalizedString:
      title: LocalizedString
      description: Holds localized strings
      additionalProperties:
        type: string
      example:
        en: Hello!
        de: Bonjour !
    QuestionType:
      description: Type of question in the context of questionnaire
      enum:
        - numeric
        - static
        - boolean
        - user
        - text
    QuestionnaireQuestion:
      title: QuestionnaireQuestion
      description: Question
      allOf:
        - $ref: '#/components/schemas/IdName'
        - properties:
            name_i18n:
              $ref: '#/components/schemas/LocalizedString'
              example:
                en: Sleep quality
                de: Schlafqualität
            unitLabel:
              type: string
            optional:
              type: boolean
            type:
              $ref: '#/components/schemas/QuestionType'
            values:
              type: array
              items:
                type: object
                properties:
                  label:
                    type: string
                  label_i18n:
                    $ref: '#/components/schemas/LocalizedString'
                  value:
                    type: number
      example:
        id: abcd1234
        name: Sleep quality
        name_i18n:
          en: Sleep quality
          de: Schlafqualität
        type: static
        values:
          - label: Good
            value: 1
            label_i18n:
              en: Good
              de: Gut
          - label: Bad
            value: 5
            label_i18n:
              en: Bad
              de: Schlecht
    QuestionnaireTemplate:
      title: QuestionnaireTemplate
      description: Questionnaire template
      allOf:
        - $ref: '#/components/schemas/IdNameDescr'
        - properties:
            questions:
              type: array
              items:
                $ref: '#/components/schemas/QuestionnaireQuestion'
    Questionnaire:
      title: Questionnaire
      description: Questionnaire
      allOf:
        - $ref: '#/components/schemas/IdNameDescr'
        - properties:
            start:
              type: string
              format: date
            end:
              type: string
              format: date
            days:
              type: array
              items:
                type: string
                enum:
                  - MO
                  - TU
                  - WE
                  - TH
                  - FR
                  - SA
                  - SU
            reminders:
              type: array
              items:
                type: number
            template:
              $ref: '#/components/schemas/QuestionnaireTemplate'
    QuestionnaireAnswer:
      title: QuestionnaireAnswer
      description: Question
      properties:
        questionId:
          type: string
          description: The id of the question
        testMeasure:
          type: string
          description: The id of the test measure
        value:
          oneOf:
            - type: boolean
            - type: number
            - type: string
    QuestionnaireResponse:
      title: QuestionnaireResponse
      description: Response to a questionnaire
      allOf:
        - $ref: '#/components/schemas/Identifiable'
        - properties:
            id:
              type: string
            questionnaire:
              type: string
            user:
              type: string
            date:
              type: string
              format: date
            answers:
              type: array
              items:
                $ref: '#/components/schemas/QuestionnaireAnswer'
  parameters:
    start:
      name: start
      in: query
      schema:
        type: number
    max:
      name: max
      in: query
      schema:
        type: number
    id:
      name: id
      in: path
      required: true
      schema:
        type: string
    user:
      name: user
      in: query
      description: User ID
      schema:
        type: string
    dateFromMin:
      name: fromMin
      in: query
      schema:
        type: string
        format: date
    dateFromMax:
      name: fromMax
      in: query
      schema:
        type: string
        format: date
    dateToMin:
      name: toMin
      in: query
      schema:
        type: string
        format: date
    dateToMax:
      name: toMax
      in: query
      schema:
        type: string
        format: date
    all:
      name: all
      in: query
      schema:
        type: boolean
        default: false
        description: |
          Whether to include all results.
    workout:
      name: workout
      in: query
      description: Workout ID
      schema:
        type: string
    id-multiple:
      name: id
      in: query
      required: true
      description: Multiple IDs
      schema:
        type: array
        items:
          type: string
    timeMin:
      name: timeMin
      in: query
      schema:
        type: string
        format: date-time
    role:
      name: role
      in: query
      schema:
        $ref: '#/components/schemas/Role'
    search-order-by:
      name: orderBy
      in: query
      description: Order for search results
      schema:
        type: string
        default: relevance
        enum:
          - createdon
          - lastmodified
          - lastname
          - relevance
    role-list:
      name: role
      in: query
      schema:
        type: array
        description: List of user roles
        items:
          $ref: '#/components/schemas/Role'
    removeRefs:
      name: removeReferences
      in: query
      description: Whether to force removal of references
      schema:
        type: boolean
        default: false
    timeMax:
      name: timeMax
      in: query
      schema:
        type: string
        format: date-time
    timeZone:
      name: tz
      in: query
      schema:
        type: string
        description: |
          The time zone in which the time parameters are specified. Formatted as an  [IANA Time Zone Database](https://www.iana.org/time-zones) name.
        examples:
          - Europe/Vienna
    athlete:
      name: athleteId
      in: query
      description: Athlete ID
      schema:
        type: string
    calendar-list:
      name: calendar
      in: query
      required: true
      description: Calendar IDs
      schema:
        type: array
        items:
          type: string
    timeMinLocal:
      name: timeMin
      in: query
      schema:
        type: string
        format: date
    timeMaxLocal:
      name: timeMax
      in: query
      schema:
        type: string
        format: date
  responses:
    NotFound:
      description: The specified resource was not found
  securitySchemes:
    bearerAuth:
      description: Provide JWT (without `Bearer` prefix)
      type: http
      scheme: bearer
      bearerFormat: JWT
    tokenAuth:
      description: Provide personal API key as `Token {api-key}`
      type: apiKey
      name: Authorization
      in: header
