using System;
using System.Collections.Generic;
using PokerTournamentManager.Framework.Exceptions;
namespace PokerTournamentManager.Framework
{
public class Tournament
{
#region Properties
///
/// The players enrolled in the tournament
///
private readonly List _Players = new List();
public List Players
{
get { return _Players; }
}
private readonly TournamentSettings _Settings;
public TournamentSettings Settings
{
get { return _Settings; }
}
private Money _PrizePool = new Money(0);
public Money PrizePool
{
get { return _PrizePool; }
protected set { _PrizePool = value; }
}
private readonly List _Tables = new List();
public List Tables
{
get { return _Tables; }
}
#endregion
#region Constructors
public Tournament(TournamentSettings settings)
{
this._Settings = settings;
}
#endregion
#region Methods
public ChipCount Register(Player player)
{
if(player == null) throw new ArgumentNullException("player");
if(Players.Contains(player)) throw new DuplicatePlayerException();
// TODO: Verify the money has actually been received?
// Add this buyin to the prize pool
PrizePool += Settings.BuyInAmount;
// Add the player to the list of players
Players.Add(player);
// Give 'em their chips
return this.Settings.StartingChipsAmount;
}
#endregion
///
/// Assigns players to their seats
///
public void AssignSeating()
{
Table table = new Table();
table.SeatPlayers(Players);
// (Re)Create the necessary number of tables
_Tables.Clear();
_Tables.Add(table);
}
}
}