namespace BuildingDirectory.Model;
///
/// Represents a company with employees
///
public sealed class Company
{
private readonly MyDictionary _employeeRooms;
///
/// Creates a new instance of a company with the given name and the employees together
/// with their room numbers.
/// Employees are represented/identified by their
///
/// Employees and assigned room numbers
/// Name of the company
public Company(MyDictionary employeeRooms, string name)
{
_employeeRooms = employeeRooms;
Name = name;
}
///
/// Gets the name of the company
///
public string Name { get; }
///
/// Gets the number of employees working for the company
///
public int NoOfEmployees => _employeeRooms.Count;
///
/// Returns the room number the clerk identified by the provided
/// resides at - if known
///
/// Identification of the employee
/// Room number if found; null otherwise
public int? AskForRoom(BusinessCard businessCard)
{
bool found = _employeeRooms.TryGetValue(businessCard, out int room);
return found ? room : null;
}
}