using PokemonSleep.Web.Models;
using PokemonSleepAPI.Models;

namespace PokemonSleep.Web.Views.Pokemon
{
	public class PokemonIndex
	{
		PokemonDto Model = new PokemonDto();
		public int GetRatingForNature(PokemonNature nature)
		{
			return nature switch
			{
				var n when Model.Speciality == "Berries" => n.BerryRating,
				var n when Model.Speciality == "Ingredients" => n.IngredientRating,
				var n when Model.Speciality == "Skill" => n.SkillRating,
				_ => 0
			};
		}

		public string GetFitColorForNature(PokemonNature nature)
		{
			var rating = GetRatingForNature(nature);
			return rating > 0 ? "green" : rating < 0 ? "red" : "black";
		}
		public int GetRatingForSubskill(PokemonSubskill subskill)
		{
			return subskill switch
			{
				var s when Model.Speciality == "Berries" => s.BerryRank,
				var s when Model.Speciality == "Ingredients" => s.IngredientRank,
				var s when Model.Speciality == "Skill" => s.SkillRank,
				_ => 0
			};
		}

		public string GetFitColorForSubskill(PokemonSubskill subskill)
		{
			var rating = GetRatingForSubskill(subskill);
			return rating > 0 ? "green" : rating < 0 ? "red" : "black";
		}
	}
}
