{
	"info": {
		"_postman_id": "rgs-api-collection",
		"name": "RGS API",
		"description": "Remote Gaming Server API collection for testing game integration.\n\n## Setup\n1. Set the `base_url` variable to your RGS instance (default: https://rgs.cloudvlt.com)\n2. Set the `token` variable to a valid wallet session token\n3. Run `load_game` first to get a `game_session`\n4. Use the `game_session` for subsequent `play` calls\n\n## Flow\n1. load_game → get game_session + balance\n2. play → execute game round\n3. get_accountsum → check balance\n4. ack_game_session → acknowledge completed round",
		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
	},
	"variable": [
		{
			"key": "base_url",
			"value": "https://rgs.cloudvlt.com",
			"type": "string"
		},
		{
			"key": "token",
			"value": "YOUR_WALLET_SESSION_TOKEN",
			"type": "string"
		},
		{
			"key": "game_session",
			"value": "",
			"type": "string"
		},
		{
			"key": "game_id",
			"value": "dd",
			"type": "string"
		},
		{
			"key": "table_id",
			"value": "",
			"type": "string",
			"description": "Multiplayer blackjack table ID"
		},
		{
			"key": "player_id",
			"value": "test_player_1",
			"type": "string",
			"description": "External player ID for multiplayer games"
		}
	],
	"item": [
		{
			"name": "Health Check",
			"request": {
				"method": "GET",
				"header": [],
				"url": {
					"raw": "{{base_url}}/api/health",
					"host": ["{{base_url}}"],
					"path": ["api", "health"]
				},
				"description": "Check if the RGS server is running and healthy."
			},
			"response": []
		},
		{
			"name": "load_game",
			"event": [
				{
					"listen": "test",
					"script": {
						"exec": [
							"var jsonData = pm.response.json();",
							"if (jsonData.game_session) {",
							"    pm.collectionVariables.set('game_session', jsonData.game_session);",
							"    console.log('Game session saved:', jsonData.game_session);",
							"}",
							"if (jsonData.status === 'OK') {",
							"    pm.test('load_game successful', function() {",
							"        pm.expect(jsonData.status).to.eql('OK');",
							"        pm.expect(jsonData.game_session).to.be.a('string');",
							"        pm.expect(jsonData.accountsum).to.be.a('string');",
							"    });",
							"}"
						],
						"type": "text/javascript"
					}
				}
			],
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Content-Type",
						"value": "application/x-www-form-urlencoded"
					}
				],
				"body": {
					"mode": "urlencoded",
					"urlencoded": [
						{
							"key": "rquest",
							"value": "load_game",
							"type": "text"
						},
						{
							"key": "token",
							"value": "{{token}}",
							"type": "text"
						},
						{
							"key": "game_id",
							"value": "{{game_id}}",
							"type": "text"
						}
					]
				},
				"url": {
					"raw": "{{base_url}}/api/rgs",
					"host": ["{{base_url}}"],
					"path": ["api", "rgs"]
				},
				"description": "Initialize a game session. Returns game configuration, bet limits, and player balance.\n\n**Required before any play calls.**\n\nThe `game_session` from the response is automatically saved to collection variables."
			},
			"response": []
		},
		{
			"name": "play (Dice Duel)",
			"event": [
				{
					"listen": "test",
					"script": {
						"exec": [
							"var jsonData = pm.response.json();",
							"if (jsonData.new_game_session) {",
							"    pm.collectionVariables.set('game_session', jsonData.new_game_session);",
							"    console.log('New game session saved:', jsonData.new_game_session);",
							"}",
							"if (jsonData.status === 'OK') {",
							"    pm.test('play successful', function() {",
							"        pm.expect(jsonData.status).to.eql('OK');",
							"        pm.expect(jsonData.accountsum).to.be.a('string');",
							"    });",
							"}"
						],
						"type": "text/javascript"
					}
				}
			],
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Content-Type",
						"value": "application/x-www-form-urlencoded"
					}
				],
				"body": {
					"mode": "urlencoded",
					"urlencoded": [
						{
							"key": "rquest",
							"value": "play",
							"type": "text"
						},
						{
							"key": "token",
							"value": "{{token}}",
							"type": "text"
						},
						{
							"key": "game_session",
							"value": "{{game_session}}",
							"type": "text"
						},
						{
							"key": "game_id",
							"value": "{{game_id}}",
							"type": "text"
						},
						{
							"key": "bet_amount",
							"value": "1.00",
							"type": "text"
						},
						{
							"key": "guess",
							"value": "high",
							"type": "text",
							"description": "Dice Duel: 'low' (2-6) or 'high' (8-12)"
						}
					]
				},
				"url": {
					"raw": "{{base_url}}/api/rgs",
					"host": ["{{base_url}}"],
					"path": ["api", "rgs"]
				},
				"description": "Play a round of Dice Duel.\n\n**Parameters:**\n- `bet_amount`: Stake for this round (decimal)\n- `guess`: 'low' (totals 2-6) or 'high' (totals 8-12)\n\n**Response:**\n- `dice`: Array of two dice values\n- `total`: Sum of dice\n- `won`: Whether the guess was correct\n- `winamount`: Payout amount (0 if lost)\n- `new_game_session`: Session for next round"
			},
			"response": []
		},
		{
			"name": "play (Blackjack - bet)",
			"event": [
				{
					"listen": "test",
					"script": {
						"exec": [
							"var jsonData = pm.response.json();",
							"if (jsonData.status === 'OK') {",
							"    pm.test('blackjack bet successful', function() {",
							"        pm.expect(jsonData.status).to.eql('OK');",
							"    });",
							"}"
						],
						"type": "text/javascript"
					}
				}
			],
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Content-Type",
						"value": "application/x-www-form-urlencoded"
					}
				],
				"body": {
					"mode": "urlencoded",
					"urlencoded": [
						{
							"key": "rquest",
							"value": "play",
							"type": "text"
						},
						{
							"key": "token",
							"value": "{{token}}",
							"type": "text"
						},
						{
							"key": "game_session",
							"value": "{{game_session}}",
							"type": "text"
						},
						{
							"key": "game_id",
							"value": "bj",
							"type": "text"
						},
						{
							"key": "bet_amount",
							"value": "5.00",
							"type": "text"
						},
						{
							"key": "continue",
							"value": "0",
							"type": "text"
						},
						{
							"key": "action",
							"value": "bet",
							"type": "text"
						}
					]
				},
				"url": {
					"raw": "{{base_url}}/api/rgs",
					"host": ["{{base_url}}"],
					"path": ["api", "rgs"]
				},
				"description": "Start a new Blackjack round by placing a bet.\n\n**Parameters:**\n- `bet_amount`: Stake for this round\n- `continue`: 0 (new round)\n- `action`: 'bet'\n\n**Response includes:**\n- `dealercards`: Dealer's visible card(s)\n- `playercards`: Player's cards\n- `actions`: Available actions (hit, stand, double, split, insurance)"
			},
			"response": []
		},
		{
			"name": "play (Blackjack - hit)",
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Content-Type",
						"value": "application/x-www-form-urlencoded"
					}
				],
				"body": {
					"mode": "urlencoded",
					"urlencoded": [
						{
							"key": "rquest",
							"value": "play",
							"type": "text"
						},
						{
							"key": "token",
							"value": "{{token}}",
							"type": "text"
						},
						{
							"key": "game_session",
							"value": "{{game_session}}",
							"type": "text"
						},
						{
							"key": "game_id",
							"value": "bj",
							"type": "text"
						},
						{
							"key": "continue",
							"value": "1",
							"type": "text"
						},
						{
							"key": "action",
							"value": "hit",
							"type": "text"
						}
					]
				},
				"url": {
					"raw": "{{base_url}}/api/rgs",
					"host": ["{{base_url}}"],
					"path": ["api", "rgs"]
				},
				"description": "Draw another card in Blackjack.\n\n**Parameters:**\n- `continue`: 1 (continuing round)\n- `action`: 'hit'"
			},
			"response": []
		},
		{
			"name": "play (Blackjack - stand)",
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Content-Type",
						"value": "application/x-www-form-urlencoded"
					}
				],
				"body": {
					"mode": "urlencoded",
					"urlencoded": [
						{
							"key": "rquest",
							"value": "play",
							"type": "text"
						},
						{
							"key": "token",
							"value": "{{token}}",
							"type": "text"
						},
						{
							"key": "game_session",
							"value": "{{game_session}}",
							"type": "text"
						},
						{
							"key": "game_id",
							"value": "bj",
							"type": "text"
						},
						{
							"key": "continue",
							"value": "1",
							"type": "text"
						},
						{
							"key": "action",
							"value": "stand",
							"type": "text"
						}
					]
				},
				"url": {
					"raw": "{{base_url}}/api/rgs",
					"host": ["{{base_url}}"],
					"path": ["api", "rgs"]
				},
				"description": "Stand (keep current hand) in Blackjack.\n\n**Parameters:**\n- `continue`: 1 (continuing round)\n- `action`: 'stand'\n\nDealer will draw cards and the round will complete."
			},
			"response": []
		},
		{
			"name": "play (Blackjack - double)",
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Content-Type",
						"value": "application/x-www-form-urlencoded"
					}
				],
				"body": {
					"mode": "urlencoded",
					"urlencoded": [
						{
							"key": "rquest",
							"value": "play",
							"type": "text"
						},
						{
							"key": "token",
							"value": "{{token}}",
							"type": "text"
						},
						{
							"key": "game_session",
							"value": "{{game_session}}",
							"type": "text"
						},
						{
							"key": "game_id",
							"value": "bj",
							"type": "text"
						},
						{
							"key": "continue",
							"value": "1",
							"type": "text"
						},
						{
							"key": "action",
							"value": "double",
							"type": "text"
						}
					]
				},
				"url": {
					"raw": "{{base_url}}/api/rgs",
					"host": ["{{base_url}}"],
					"path": ["api", "rgs"]
				},
				"description": "Double down in Blackjack (double bet, receive one card, then stand).\n\n**Available when:** Player score is 9, 10, or 11\n\n**Parameters:**\n- `continue`: 1\n- `action`: 'double'"
			},
			"response": []
		},
		{
			"name": "play (Blackjack - split)",
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Content-Type",
						"value": "application/x-www-form-urlencoded"
					}
				],
				"body": {
					"mode": "urlencoded",
					"urlencoded": [
						{
							"key": "rquest",
							"value": "play",
							"type": "text"
						},
						{
							"key": "token",
							"value": "{{token}}",
							"type": "text"
						},
						{
							"key": "game_session",
							"value": "{{game_session}}",
							"type": "text"
						},
						{
							"key": "game_id",
							"value": "bj",
							"type": "text"
						},
						{
							"key": "continue",
							"value": "1",
							"type": "text"
						},
						{
							"key": "action",
							"value": "split",
							"type": "text"
						}
					]
				},
				"url": {
					"raw": "{{base_url}}/api/rgs",
					"host": ["{{base_url}}"],
					"path": ["api", "rgs"]
				},
				"description": "Split a pair into two hands in Blackjack.\n\n**Available when:** Player has a pair (same card type)\n\n**Parameters:**\n- `continue`: 1\n- `action`: 'split'\n\nAfter split, use `hit_hand1`, `stand_hand1`, `hit_hand2`, `stand_hand2` actions."
			},
			"response": []
		},
		{
			"name": "play (Blackjack - insurance)",
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Content-Type",
						"value": "application/x-www-form-urlencoded"
					}
				],
				"body": {
					"mode": "urlencoded",
					"urlencoded": [
						{
							"key": "rquest",
							"value": "play",
							"type": "text"
						},
						{
							"key": "token",
							"value": "{{token}}",
							"type": "text"
						},
						{
							"key": "game_session",
							"value": "{{game_session}}",
							"type": "text"
						},
						{
							"key": "game_id",
							"value": "bj",
							"type": "text"
						},
						{
							"key": "continue",
							"value": "1",
							"type": "text"
						},
						{
							"key": "action",
							"value": "insurance",
							"type": "text"
						}
					]
				},
				"url": {
					"raw": "{{base_url}}/api/rgs",
					"host": ["{{base_url}}"],
					"path": ["api", "rgs"]
				},
				"description": "Take insurance in Blackjack.\n\n**Available when:** Dealer shows an Ace\n\n**Cost:** Half of original bet\n**Payout:** 2:1 if dealer has blackjack"
			},
			"response": []
		},
		{
			"name": "get_accountsum",
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Content-Type",
						"value": "application/x-www-form-urlencoded"
					}
				],
				"body": {
					"mode": "urlencoded",
					"urlencoded": [
						{
							"key": "rquest",
							"value": "get_accountsum",
							"type": "text"
						},
						{
							"key": "token",
							"value": "{{token}}",
							"type": "text"
						}
					]
				},
				"url": {
					"raw": "{{base_url}}/api/rgs",
					"host": ["{{base_url}}"],
					"path": ["api", "rgs"]
				},
				"description": "Get the current player balance.\n\n**Response:**\n- `accountsum`: Current balance (decimal string)"
			},
			"response": []
		},
		{
			"name": "ack_game_session",
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Content-Type",
						"value": "application/x-www-form-urlencoded"
					}
				],
				"body": {
					"mode": "urlencoded",
					"urlencoded": [
						{
							"key": "rquest",
							"value": "ack_game_session",
							"type": "text"
						},
						{
							"key": "token",
							"value": "{{token}}",
							"type": "text"
						},
						{
							"key": "game_session",
							"value": "{{game_session}}",
							"type": "text"
						}
					]
				},
				"url": {
					"raw": "{{base_url}}/api/rgs",
					"host": ["{{base_url}}"],
					"path": ["api", "rgs"]
				},
				"description": "Acknowledge a completed game session.\n\nCall this after the client has finished animating the result. Marks the session as fully consumed."
			},
			"response": []
		},
		{
			"name": "Games List",
			"request": {
				"method": "GET",
				"header": [],
				"url": {
					"raw": "{{base_url}}/api/games",
					"host": ["{{base_url}}"],
					"path": ["api", "games"]
				},
				"description": "Get list of all available games.\n\n**Response:**\n- `games`: Array of game objects with id, name, category, rtp, min_bet, max_bet"
			},
			"response": []
		},
		{
			"name": "MP Blackjack - List Tables",
			"request": {
				"method": "GET",
				"header": [],
				"url": {
					"raw": "{{base_url}}/api/multiplayer/blackjack/tables",
					"host": ["{{base_url}}"],
					"path": ["api", "multiplayer", "blackjack", "tables"]
				},
				"description": "Get list of all available multiplayer blackjack tables.\n\n**Response:**\n- `tables`: Array of table objects with table_id, name, type, min_bet, max_bet, seat_count, available_seats, current_phase"
			},
			"response": []
		},
		{
			"name": "MP Blackjack - Create Table",
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Content-Type",
						"value": "application/json"
					}
				],
				"body": {
					"mode": "raw",
					"raw": "{\n    \"name\": \"Test Table\",\n    \"type\": \"standard\",\n    \"min_bet\": 5,\n    \"max_bet\": 500,\n    \"seat_count\": 6\n}"
				},
				"url": {
					"raw": "{{base_url}}/api/multiplayer/blackjack/tables",
					"host": ["{{base_url}}"],
					"path": ["api", "multiplayer", "blackjack", "tables"]
				},
				"description": "Create a new multiplayer blackjack table.\n\n**Parameters:**\n- `name`: Table name (optional)\n- `type`: 'standard' or 'vip' (optional, default: standard)\n- `min_bet`: Minimum bet amount (optional, default: 1)\n- `max_bet`: Maximum bet amount (optional, default: 500)\n- `seat_count`: Number of seats 1-7 (optional, default: 6)"
			},
			"response": []
		},
		{
			"name": "MP Blackjack - Get Table State",
			"request": {
				"method": "GET",
				"header": [],
				"url": {
					"raw": "{{base_url}}/api/multiplayer/blackjack/tables/{{table_id}}?player_id={{player_id}}",
					"host": ["{{base_url}}"],
					"path": ["api", "multiplayer", "blackjack", "tables", "{{table_id}}"],
					"query": [
						{
							"key": "player_id",
							"value": "{{player_id}}"
						}
					]
				},
				"description": "Get current state of a multiplayer blackjack table.\n\n**Query Parameters:**\n- `player_id`: Your player ID to get personalized data (is_me, available_actions)\n\n**Response includes:**\n- `current_phase`: betting, player_turn, settling, completed\n- `dealer_cards`: Dealer's visible cards\n- `seats`: Array of seat states with cards, bets, status"
			},
			"response": []
		},
		{
			"name": "MP Blackjack - Join Table",
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Content-Type",
						"value": "application/json"
					}
				],
				"body": {
					"mode": "raw",
					"raw": "{\n    \"seat_number\": 1,\n    \"player_id\": \"{{player_id}}\",\n    \"player_name\": \"Test Player\",\n    \"token\": \"{{token}}\"\n}"
				},
				"url": {
					"raw": "{{base_url}}/api/multiplayer/blackjack/tables/{{table_id}}/join",
					"host": ["{{base_url}}"],
					"path": ["api", "multiplayer", "blackjack", "tables", "{{table_id}}", "join"]
				},
				"description": "Join a multiplayer blackjack table at a specific seat.\n\n**Parameters:**\n- `seat_number`: Seat to join (1 to seat_count)\n- `player_id`: Your external player ID\n- `player_name`: Display name\n- `token`: Wallet session token (for real money play)"
			},
			"response": []
		},
		{
			"name": "MP Blackjack - Leave Table",
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Content-Type",
						"value": "application/json"
					}
				],
				"body": {
					"mode": "raw",
					"raw": "{\n    \"seat_number\": 1,\n    \"player_id\": \"{{player_id}}\"\n}"
				},
				"url": {
					"raw": "{{base_url}}/api/multiplayer/blackjack/tables/{{table_id}}/leave",
					"host": ["{{base_url}}"],
					"path": ["api", "multiplayer", "blackjack", "tables", "{{table_id}}", "leave"]
				},
				"description": "Leave a multiplayer blackjack table.\n\n**Note:** Can only leave during betting phase if no bet placed."
			},
			"response": []
		},
		{
			"name": "MP Blackjack - Place Bet",
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Content-Type",
						"value": "application/json"
					}
				],
				"body": {
					"mode": "raw",
					"raw": "{\n    \"seat_number\": 1,\n    \"bet_amount\": 25,\n    \"player_id\": \"{{player_id}}\"\n}"
				},
				"url": {
					"raw": "{{base_url}}/api/multiplayer/blackjack/tables/{{table_id}}/bet",
					"host": ["{{base_url}}"],
					"path": ["api", "multiplayer", "blackjack", "tables", "{{table_id}}", "bet"]
				},
				"description": "Place a bet for the current round.\n\n**Parameters:**\n- `seat_number`: Your seat number\n- `bet_amount`: Bet amount (must be within table min/max)\n- `player_id`: Your player ID\n\n**Note:** Round starts automatically when all seated players have placed bets."
			},
			"response": []
		},
		{
			"name": "MP Blackjack - Player Action",
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Content-Type",
						"value": "application/json"
					}
				],
				"body": {
					"mode": "raw",
					"raw": "{\n    \"seat_number\": 1,\n    \"action\": \"hit\",\n    \"player_id\": \"{{player_id}}\"\n}"
				},
				"url": {
					"raw": "{{base_url}}/api/multiplayer/blackjack/tables/{{table_id}}/action",
					"host": ["{{base_url}}"],
					"path": ["api", "multiplayer", "blackjack", "tables", "{{table_id}}", "action"]
				},
				"description": "Perform a game action during your turn.\n\n**Parameters:**\n- `seat_number`: Your seat number\n- `action`: 'hit', 'stand', 'double', 'split', or 'insurance'\n- `player_id`: Your player ID\n\n**Note:** Can only act when it's your turn (current_seat matches your seat)."
			},
			"response": []
		},
		{
			"name": "MP Blackjack - New Round",
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Content-Type",
						"value": "application/json"
					}
				],
				"body": {
					"mode": "raw",
					"raw": "{}"
				},
				"url": {
					"raw": "{{base_url}}/api/multiplayer/blackjack/tables/{{table_id}}/new-round",
					"host": ["{{base_url}}"],
					"path": ["api", "multiplayer", "blackjack", "tables", "{{table_id}}", "new-round"]
				},
				"description": "Start a new round after the current round completes.\n\n**Note:** Only works when current_phase is 'completed'."
			},
			"response": []
		}
	]
}
