getUserNames:
  get:
    tags:
      - history
    summary: Get user names
    description: Get all user names with punishment history of the specified type
    operationId: getUserNames
    parameters:
      - $ref: '#/components/parameters/UserType'
      - $ref: '#/components/parameters/HistoryType'
    responses:
      '200':
        description: Successful operation
        content:
          application/json:
            schema:
              type: array
              items:
                type: string
                description: A list of users
      default:
        description: Unexpected error
        content:
          application/json:
            schema:
              $ref: "../generic/errors.yml#/components/schemas/ApiError"
getHistoryForUsers:
  get:
    tags:
      - history
    summary: Get history for users
    description: >
      Get all users with punishment history of the specified type,
      where the user name starts with the search query, 100 records at a time
    operationId: getHistoryForUsers
    parameters:
      - $ref: '#/components/parameters/UserType'
      - $ref: '#/components/parameters/HistoryType'
      - $ref: '#/components/parameters/User'
      - $ref: '#/components/parameters/Page'
    responses:
      '200':
        description: Successful operation
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PunishmentHistory'
      default:
        description: Unexpected error
        content:
          application/json:
            schema:
              $ref: "../generic/errors.yml#/components/schemas/ApiError"
getHistoryForAll:
  get:
    tags:
      - history
    summary: Get history for users
    description: >
      Get all users with punishment history of the specified type,
      where the user name starts with the search query, 100 records at a time
    operationId: getHistoryForAll
    parameters:
      - $ref: '#/components/parameters/UserType'
      - $ref: '#/components/parameters/HistoryType'
      - $ref: '#/components/parameters/Page'
    responses:
      '200':
        description: Successful operation
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PunishmentHistory'
      default:
        description: Unexpected error
        content:
          application/json:
            schema:
              $ref: "../generic/errors.yml#/components/schemas/ApiError"
getHistoryForUuid:
  get:
    tags:
      - history
    summary: Get user
    description: >
      Get all users with punishment history of the specified type,
      where the user uuid matches, 100 records at a time
    operationId: getHistoryForUuid
    parameters:
      - $ref: '#/components/parameters/UserType'
      - $ref: '#/components/parameters/HistoryType'
      - $ref: '#/components/parameters/Uuid'
      - $ref: '#/components/parameters/Page'
    responses:
      '200':
        description: Successful operation
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PunishmentHistory'
      default:
        description: Unexpected error
        content:
          application/json:
            schema:
              $ref: "../generic/errors.yml#/components/schemas/ApiError"
components:
  parameters:
    HistoryType:
      name: type
      in: path
      required: true
      schema:
        type: string
        enum: [ all, bans, mutes, kicks ]
        description: The type of history to retrieve
    User:
      name: user
      in: path
      required: true
      schema:
        type: string
        description: The (partial) username to search for
    Uuid:
      name: uuid
      in: path
      required: true
      schema:
        type: string
        description: The uuid of the desired user
    UserType:
      name: userType
      in: path
      required: true
      schema:
        type: string
        enum: [ player, staff ]
        description: Indicates if this is a staff history or a player history look up
    Page:
      name: page
      in: path
      required: true
      schema:
        type: integer
        description: The page that should be retrieved
  schemas:
    PunishmentHistory:
      type: array
      items:
        type: object
        required:
          - username
          - uuid
          - reason
          - type
          - punishmentTime
          - punishmentUserUuid
        properties:
          username:
            type: string
            description: The username of the user
          uuid:
            type: string
            description: The UUID of the user
          reason:
            type: string
            description: The reason for the punishment
          type:
            type: string
            description: The type of punishment
          punishmentTime:
            type: integer
            format: int64
            description: The time when the punishment was given
          expiryTime:
            type: integer
            format: int64
            description: The time when the punishment expires
          punishmentUser:
            type: string
            description: The username of the punishment issuer
          punishmentUserUuid:
            type: string
            description: The UUID of the punishment issuer
          removedBy:
            type: string
            description: The name of the staff member who removed the punishment
          removedReason:
            type: string
            description: The reason why the punishment was removed
    Player:
      type: object
      properties:
        name:
          type: string
          description: The name of the player
          example: a_name
        uuid:
          type: string
          example: 0c35e520-927e-4c6a-87ad-ff0739c22e9d
          description: The uuid of the team player
      required:
        - name
        - uuid
