openapi: 3.0.3

info:
  title: Minecraft Network API
  version: 1.0.0

servers:
  - url: http://localhost:8080/api

tags:
  - name: chat
    description: Data for displaying Chat messages to clients

paths:
  /chat/send/chat/message:
    post:
      tags:
        - chat
      summary: Sends one or more chat messages
      operationId: sendChatMessages
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: "#/components/schemas/ChatMessage"
      responses:
        "202":
          description: Accepted

  /chat/send/servers/state:
    post:
      tags:
        - chat
      summary: Update server states
      operationId: updateServerStates
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ServerState"
      responses:
        "202":
          description: Accepted
components:
  schemas:
    User:
      type: object
      required:
        - uuid
        - name
        - styledName

      properties:
        uuid:
          type: string
          format: uuid
        name:
          type: string
        styledName:
          type: string

    ChatMessage:
      type: object
      required:
        - uuid
        - message
        - server
        - type
        - timestamp
        - blocked
      properties:
        uuid:
          type: string
          format: uuid
        message:
          type: string
        server:
          type: string
        type:
          type: string
          enum:
            - PUBLIC
            - GLOBAL
            - PARTY
            - GAC
            - MSG
            - CUSTOM
        channel:
          type: string
          maxLength: 36
        receiver:
          type: string
          maxLength: 36
        timestamp:
          type: string
          format: date-time
        blocked:
          type: boolean

    PrivateMessage:
      type: object
      required:
        - sender
        - receiver
        - message
        - senderServer
        - receiverServer
      properties:
        sender:
          type: string
          format: uuid
        receiver:
          type: string
          format: uuid
        message:
          type: string
        senderServer:
          type: string
        receiverServer:
          type: string

    Server:
      type: object
      properties:
        name:
          type: string
        players:
          type: array
          items:
            $ref: "#/components/schemas/User"

    ServerState:
      type: object
      properties:
        servers:
          type: array
          items:
            $ref: "#/components/schemas/Server"
  parameters:
    From:
      name: from
      in: path
      required: true
      schema:
        type: string
        format: date-time
