using Microsoft.AspNetCore.Components;
using Portfolio.Domain.Features.Pokemon;

namespace Portfolio.WebUI.Server.Components.Component.Pokemon_Components
{
    public partial class PokemonCard
    {
        [Parameter]
        public Pokemon Pokemon { get; set; }

        private Pokemon _pokemon { get; set; }

        private bool isShiny = false;

        protected override void OnParametersSet()
        {
            if (Pokemon != null)
            {
                _pokemon = Pokemon;

            }
        }

        private void ToggleImage()
        {
            isShiny = !isShiny;
            StateHasChanged();
        }

        private string GetTypeImageUrl(string pokemonType)
        {
            if (string.IsNullOrEmpty(pokemonType))
            {
                return "https://www.serebii.net/pokemonsleep/pokemon/type/normal.png"; // Fallback image
            }

            return $"https://www.serebii.net/pokemonsleep/pokemon/type/{pokemonType.ToLower()}.png";
        }

        private string GetTypeCssClass(string type)
        {
            return "pokemon-type-" + type.ToLower();
        }


    }
}
