using Sony.ChartBot.Entities; using Sony.ChartBot.Entities.ChartApi; using Sony.ChartBot.Entities.MessengerApi; using Sony.ChartBot.Entities.Storage; using Sony.ChartBot.Repository; namespace Sony.ChartBot.Client.InputParsers { public class CountryInputParser : IInputParser { private readonly CountryRepository _countryRepository; public CountryInputParser(CountryRepository countryRepository) { _countryRepository = countryRepository; } public SupportedCountry ParseInput(string text) { var supportedCountry = _countryRepository.FindSupportedCountry(text); if (supportedCountry == null) { throw new InvalidInputException(InvalidInputType.Country, text); } return supportedCountry; } } }