openapi: 3.0.0
info:
  title: Tivoli centralbank API
  description: API for managing users, groups, amusements, and transactions in Tivoli.
  version: 1.0.0

paths:
  /users:
    get:
      summary: "Get a list of users"
      responses:
        "200":
          description: "List of users"
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: number
                      description: "Unique identifier for the user"
                    name:
                      type: string
                    email:
                      type: string
                    group_id:
                      type: string
                    balance:
                      type: number
                      format: float
                      description: "User's balance"
                      example: 25.00
                    github:
                      type: string
                    url:
                      type: string
  /users/{id}:
    get:
      summary: "Get a specific user by ID"
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        "200":
          description: "User details"
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: number
                    description: "Unique identifier for the user"
                  name:
                    type: string
                  email:
                    type: string
                  group_id:
                    type: string
                  balance:
                    type: number
                    format: float
                    description: "User's balance"
                    example: 25.00
                  github:
                    type: string
                  url:
                    type: string
        "404":
          description: "User not found"
  /groups:
    get:
      summary: "Get a list of groups"
      responses:
        "200":
          description: "List of groups"
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: number
                      description: "Unique identifier for the group"
                    members:
                      type: array
                      items:
                        type: string
  /groups/{id}:
    get:
      summary: "Get a specific group by ID"
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        "200":
          description: "Group details"
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: number
                    description: "Unique identifier for the group"
                  members:
                    type: array
                    items:
                      type: string
                      example: ["user1", "user2"]
  /amusements:
    get:
      summary: "Get a list of amusements"
      responses:
        "200":
          description: "List of amusements"
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: string
                      description: "Unique identifier for the amusement"
                    group_id:
                      type: string
                    name:
                      type: string
                    type:
                      type: string
                      enum:
                        - game
                        - attraction
                    image_url:
                      type: string
                      description: "url to the image of the amusement"
                    url:
                      type: string
                      description: "url to the amusement page"
                    stamp_id:
                      type: string
                      description: "premium_attibute + animal, ex. gold tucan"
                    description:
                      type: string
  /amusements/{id}:
    get:
      summary: "Get a specific amusement by ID"
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        "200":
          description: "Amusement details"
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                  group_id:
                    type: string
                  name:
                    type: string
                  type:
                    type: string
                    enum:
                      - game
                      - attraction
                  image_url:
                    type: string
                    description: "url to the image of the amusement"
                  url:
                    type: string
                    description: "url to the amusement page"
                  stamp_id:
                    type: string
                    description: "premium_attibute + animal, ex. gold tucan"
        "404":
          description: "Amusement not found"
  /stamps:
    get:
      summary: "Get a list of stamps"
      responses:
        "200":
          description: "List of stamps"
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: number
                      description: "Unique identifier for the stamp"
                    stamp:
                      type: string
  /stamps/{id}:
    get:
      summary: "Get a specific stamp by ID"
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        "200":
          description: "Stamp details"
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: number
                    description: "Unique identifier for the stamp"
                  stamp:
                    type: string
        "404":
          description: "Stamp not found"
  /transactions:
    get:
      summary: "Get a list of transactions"
      responses:
        "200":
          description: "List of transactions"
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: number
                      description: "Unique identifier for the transaction"
                    amusement_id:
                      type: string
                      description: "ID of the amusement"
                    stake_amount:
                      type: number
                      format: float
                      description: "Stake amount the user wants to bet (only when paying)"
                    payout_amount:
                      type: number
                      format: float
                      description: "Payout amount the user will receive (only when winning a game)"
                    stamp_id:
                      type: string
                      description: "ID of the stamp the user won (only when winning)"
    post:
      summary: "Create a new transaction"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                amusement_id:
                  type: string
                  description: "ID of the amusement"
                stake_amount:
                  type: number
                  format: float
                  description: "Stake amount the user wants to bet (only when paying)"
                payout_amount:
                  type: number
                  format: float
                  description: "Payout amount the user will receive (only when winning a game)"
                stamp_id:
                  type: string
                  description: "ID of the stamp the user won (only when winning)"
      responses:
        "201":
          description: "Transaction created successfully"
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: number
                    description: "Unique identifier for the transaction"
  /transactions/{id}:
    get:
      summary: "Get a specific transaction by ID"
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        "200":
          description: "Transaction details"
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: number
                    description: "Unique identifier for the transaction"
                  amusement_id:
                    type: string
                    description: "ID of the amusement"
                  stake_amount:
                    type: number
                    format: float
                    description: "Stake amount the user wants to bet (only when paying)"
                  payout_amount:
                    type: number
                    format: float
                    description: "Payout amount the user will receive (only when winning)"
                  stamp_id:
                    type: string
                    description: "ID of the stamp the user won (only when winning)"
        "404":
          description: "Transaction not found"
