using MultiversalDiplomacy.Model;
namespace MultiversalDiplomacy.Map;
///
/// A collection of provinces. Provides shortcut functions for referencing provinces.
///
public abstract class Map
{
public abstract IEnumerable Provinces { get; }
///
/// Returns the sole army-accessible location of a province.
///
public Location Land(string provinceName)
=> Provinces
.Single(p => p.Name == provinceName || p.Abbreviations.Contains(provinceName))
.Locations.Single(l => l.Type == LocationType.Land);
///
/// Returns the sole fleet-accessible location of a province.
///
public Location Water(string provinceName)
=> Provinces
.Single(p => p.Name == provinceName || p.Abbreviations.Contains(provinceName))
.Locations.Single(l => l.Type == LocationType.Water);
///
/// Returns the specified fleet-accessible location of a province with distinct coasts.
///
public Location Coast(string provinceName, string coastName)
=> Provinces
.Single(p => p.Name == provinceName || p.Abbreviations.Contains(provinceName))
.Locations.Single(l => l.Name == coastName || l.Abbreviation == coastName);
}