ex-int-04-shipping-cost/ShippingCosts/Contracts/ICountryDistanceProvider.cs
github-classroom[bot] 5db225db88
Initial commit
2025-04-29 15:01:53 +00:00

30 lines
1.5 KiB
C#

namespace ShippingCosts.Contracts;
/// <summary>
/// Allows to get information about the distance between the implicit starting country a given country.
/// Not all countries are available, so <see cref="IsPossibleCountry" /> should be used to check.
/// </summary>
public interface ICountryDistanceProvider
{
/// <summary>
/// Returns the distance to the given country, if it is possible to ship to it
/// </summary>
/// <param name="countryName">Name of the potential target country</param>
/// <returns>Distance and additional information about the target country</returns>
CountryDistanceInformation? GetDistanceTo(string countryName);
/// <summary>
/// Checks whether it is possible to ship to the given country
/// </summary>
/// <param name="countryName">Name of the potential target country</param>
/// <returns>True if shipping is possible; false otherwise</returns>
bool IsPossibleCountry(string countryName);
}
/// <summary>
/// Represents the distance to and additional regional information about a country
/// </summary>
/// <param name="ApproxDistance">Approximate distance to the target country</param>
/// <param name="IsDirectNeighbor">True if the target country shares a border with the source country; false otherwise</param>
/// <param name="IsEuMember">True if the target country is a member of the EU; false otherwise</param>
public readonly record struct CountryDistanceInformation(int ApproxDistance, bool IsDirectNeighbor, bool IsEuMember);