# TODO save appeal
# TODO load appeal into page for viewing
# TODO give option to reload appeal if user didnt finish it (or verify it) based on cookies
# TODO on validation send mail to us
# TODO if they dont validate their email add a button to change it, this should change the mail in the appeal as well

UpdateMail:
  post:
    tags:
      - appeals
    summary: Update a mail for an appeal
    description: Update a mail for an appeal that was made earlier
    operationId: updateMail
    requestBody:
      required: true
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/UpdateMail'
    responses:
      '200':
        description: Email updated
        content:
          application/json:
            schema:
              $ref: '../../generic/components.yml#/components/schemas/FormResponse'
      default:
        description: Unexpected error
        content:
          application/json:
            schema:
              $ref: '../../generic/errors.yml#/components/schemas/ApiError'
MinecraftAppeal:
  post:
    tags:
      - appeals
    summary: Submit a Minecraft appeal
    description: Submit an appeal for a Minecraft punishment
    operationId: submitMinecraftAppeal
    requestBody:
      required: true
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/MinecraftAppeal'
    responses:
      '201':
        description: Appeal created please verify email
        content:
          application/json:
            schema:
              $ref: '../../generic/components.yml#/components/schemas/FormResponse'
      default:
        description: Unexpected error
        content:
          application/json:
            schema:
              $ref: '../../generic/errors.yml#/components/schemas/ApiError'
DiscordAppeal:
  post:
    tags:
      - appeals
    summary: Submit a Discord appeal
    description: Submit an appeal for a Discord punishment
    operationId: submitDiscordAppeal
    requestBody:
      required: true
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/DiscordAppeal'
    responses:
      '201':
        description: Appeal created please verify email
        content:
          application/json:
            schema:
              $ref: '../../generic/components.yml#/components/schemas/FormResponse'
      default:
        description: Unexpected error
        content:
          application/json:
            schema:
              $ref: '../../generic/errors.yml#/components/schemas/ApiError'

components:
  schemas:
    MinecraftAppeal:
      type: object
      description: Schema for Minecraft ban/punishment appeals
      required:
        - username
        - email
        - punishmentId
        - punishmentType
        - appeal
      properties:
        username:
          type: string
          description: Minecraft username of the appealing player
        uuid:
          type: string
          format: uuid
          description: Minecraft player's unique identifier
        email:
          type: string
          description: Contact email address of the appealing player
        punishmentId:
          type: integer
          description: Unique identifier of the punishment being appealed
        punishmentType:
          type: string
          enum: [ ban, mute, kick, warn ]
          description: Unique identifier of the punishment being appealed
        appeal:
          type: string
          description: Appeal text explaining why the punishment should be reconsidered
    DiscordAppeal:
      type: object
      description: Schema for Discord ban/punishment appeals
      required:
        - email
        - punishmentId
        - appeal
      properties:
        userId:
          type: integer
          format: int64
          description: Discord user ID of the appealing user
        email:
          type: string
          description: Contact email address of the appealing user
        punishmentId:
          type: integer
          description: Unique identifier of the punishment being appealed
        appeal:
          type: string
          description: Appeal text explaining why the punishment should be reconsidered
    UpdateMail:
      type: object
      required:
        - id
        - mail
      properties:
        id:
          type: string
          description: Unique identifier of the appeal you wish to update
        mail:
          type: string
          description: The new mail address to use
