openapi: 3.0.3
info:
  title: CAS API
  version: 1.0.0
components:
  schemas: {}
paths:
  /action:
    post:
      description: Notify CAS about win/bet action from user. This request means that
        balance on CAS should be updated
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                session:
                  type: string
                currency:
                  description: ISO 4217 currency code
                  type: string
                amount:
                  type: integer
                  minimum: 0
                denomination:
                  type: integer
                type:
                  enum:
                    - win
                    - bet
                    - refund
                transaction:
                  type: string
                  description: Transaction ID, generated by Game Server
                  pattern: ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$
                betTransactionId:
                  type: string
                  description: Related Bet Transaction ID
                  pattern: ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$
                roundId:
                  type: integer
                  minimum: 0
                sign:
                  type: string
                timestamp:
                  description: Milliseconds-wise UNIX-epoch timestamp
                  type: integer
                machine:
                  description: Machine identifier, on which the game was played
                  type: string
                buffer:
                  type: string
              required:
                - session
                - currency
                - amount
                - denomination
                - type
                - transaction
        required: true
      responses:
        "200":
          description: Default Response
          content:
            application/json:
              schema:
                oneOf:
                  - type: object
                    properties:
                      transaction:
                        type: string
                        description: Transaction ID, must be equal to the request's `transaction`
                          property
                        pattern: ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$
                      balance:
                        type: integer
                      denomination:
                        type: integer
                    required:
                      - transaction
                      - balance
                      - denomination
                  - type: object
                    properties:
                      message:
                        type: string
                    required:
                      - message
  /action/log:
    post:
      description: Notify CAS about win/bet action from machine. The balance on CAS
        shouldn't be updated, this request is just for logging/stats collection
        purpose
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                session:
                  type: string
                currency:
                  description: ISO 4217 currency code
                  type: string
                amount:
                  type: integer
                  minimum: 0
                denomination:
                  type: integer
                type:
                  enum:
                    - win
                    - bet
                    - refund
                transaction:
                  type: string
                sign:
                  type: string
                timestamp:
                  description: Milliseconds-wise UNIX-epoch timestamp
                  type: integer
                buffer:
                  type: string
              required:
                - session
                - currency
                - amount
                - denomination
                - type
                - transaction
        required: true
      responses:
        "200":
          description: Default Response
  /wallet:
    post:
      description: Wallet
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                session:
                  type: string
                currency:
                  description: ISO 4217 currency code
                  type: string
                denomination:
                  type: integer
                transaction:
                  type: string
                  description: Transaction ID, generated by Game Server
                  pattern: ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$
                sign:
                  type: string
                timestamp:
                  description: Milliseconds-wise UNIX-epoch timestamp
                  type: integer
                buffer:
                  type: string
              required:
                - session
                - currency
                - denomination
                - transaction
        required: true
      responses:
        "200":
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  transaction:
                    type: string
                    description: Transaction ID, must be equal to the request's `transaction`
                      property
                    pattern: ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$
                  balance:
                    type: integer
                  denomination:
                    type: integer
                  buffer:
                    type: string
                required:
                  - transaction
                  - balance
                  - denomination
