namespace MultiversalDiplomacy.Model;
///
/// Represents a single province as it exists across all timelines.
///
public class Province
{
///
/// The province's full human-readable name.
///
public string Name { get; }
///
/// The province's shorthand abbreviation.
///
public string[] Abbreviations { get; }
///
/// Whether the province contains a supply center.
///
public bool IsSupplyCenter { get; }
///
/// Whether the province contains a time center.
///
public bool IsTimeCenter { get; }
///
/// The occupiable locations in this province. Only one location can be occupied at a time.
///
public IEnumerable Locations => LocationList;
private List LocationList { get; set; }
public Province(string name, string[] abbreviations, bool isSupply, bool isTime)
{
this.Name = name;
this.Abbreviations = abbreviations;
this.IsSupplyCenter = isSupply;
this.IsTimeCenter = isTime;
this.LocationList = [];
}
public override string ToString()
{
return this.Name;
}
///
/// Create a new province with no supply center.
///
public static Province Empty(string name, params string[] abbreviations)
=> new(name, abbreviations, isSupply: false, isTime: false);
///
/// Create a new province with a supply center.
///
public static Province Supply(string name, params string[] abbreviations)
=> new(name, abbreviations, isSupply: true, isTime: false);
///
/// Create a new province with a time center.
///
public static Province Time(string name, params string[] abbreviations)
=> new(name, abbreviations, isSupply: true, isTime: true);
///
/// Create a new land location in this province.
///
public Province AddLandLocation()
{
Location location = new(this, "land", "l", LocationType.Land);
this.LocationList.Add(location);
return this;
}
///
/// Create a new ocean location.
///
public Province AddOceanLocation()
{
Location location = new(this, "water", "w", LocationType.Water);
this.LocationList.Add(location);
return this;
}
///
/// Create a new coastal location. Coastal locations must have names to disambiguate them
/// from the single land location in coastal provinces.
///
public Province AddCoastLocation(string name, string abbreviation)
{
Location location = new(this, name, abbreviation, LocationType.Water);
this.LocationList.Add(location);
return this;
}
}