/**
 * Copyright (c) 2021 Dominic Masters
 * 
 * This software is released under the MIT License.
 * https://opensource.org/licenses/MIT
 */

#pragma once
#include "../libs.h"
#include "bet.h"
#include "dealer.h"
#include "player.h"
#include "card.h"
#include "winner.h"

/** Rounds that the game can be in */
#define POKER_ROUND_MATCH 0x00
#define POKER_ROUND_START 0x01
#define POKER_ROUND_BLINDS 0x02
#define POKER_ROUND_DEAL 0x03
#define POKER_ROUND_BET0 0x04
#define POKER_ROUND_FLOP 0X05
#define POKER_ROUND_BET1 0x06
#define POKER_ROUND_TURN 0x07
#define POKER_ROUND_BET2 0x08
#define POKER_ROUND_RIVER 0x09
#define POKER_ROUND_BET3 0x0A
#define POKER_ROUND_WINNER 0x0B

/** How many cards to deal each player during the deal round */
#define POKER_DEAL_CARD_EACH 2

/** How many cards are dealt for the flop, turn and river */
#define POKER_FLOP_CARD_COUNT 3
#define POKER_TURN_CARD_COUNT 1
#define POKER_RIVER_CARD_COUNT 1

typedef struct {
  /** Poker betting state */
  pokerbet_t bet;
  
  /** Player States */
  pokerdealer_t dealer;
  pokerplayer_t players[POKER_PLAYER_COUNT];

  /** Winning player states */
  pokerwinner_t winner;

  /** The current player that is the dealer */
  uint8_t roundDealer;

  /** Which player is the small blind for this round */
  uint8_t roundSmallBlind;
  /** Which player is the big blind for this round */
  uint8_t roundBigBlind;
} poker_t;