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

#pragma once
#include "../libs.h"
#include "fuck.h"
#include "poker.h"

/**
 * Returns the index of the first player that remains to bet for the current
 * round. This is based on whatever current better player index you provide.
 * 
 * @param poker Poker game instance.
 * @param current Current better player index.
 * @return The player index of the next remaining player, otherwise 0xFF.
 */
uint8_t pokerBetGetNextPlayer(poker_t *poker);

/**
 * Returns the count of players remaining to bet.
 * 
 * @param poker Poker game instance.
 * @return Count of players left to bet.
 */
uint8_t pokerBetGetRemainingBetterCount(poker_t *poker);

/**
 * Let a player bet chips into the pot.
 * 
 * @param poker Poker game instance.
 * @param pot Poker pot to bet in to.
 * @param playerIndex The players' index that is betting.
 * @param chips The amount of chips the player is betting.
 */
void pokerBet(
  poker_t *poker, pokerpot_t *pot, uint8_t playerIndex, int32_t chips
);

/**
 * Let a player bet chips into the current pot.
 * 
 * @param bet Poker game instance.
 * @param playerIndex The players' index that is betting.
 * @param chips The amount of chips the player is betting.
 */
void pokerBetForPlayer(poker_t *poker, uint8_t playerIndex, int32_t chips);

/**
 * Gets the amount of chips necessary to call the current bet.
 * 
 * @param poker Poker game instance.
 * @return Chips necessary to call the current bet.
 */
int32_t pokerBetGetCurrentCallValue(poker_t *poker);

/**
 * Get the bet necessary for a specific player to make a call. This takes the 
 * players current bet and the bet necessary to call into the pot and will
 * return the difference.
 * 
 * @param poker Poker game instance.
 * @param player Player instance to get the call value for.
 * @return The count of chips needed to call into the current active pot.
 */
int32_t pokerPlayerGetCallBet(poker_t *poker, pokerplayer_t *player);