using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Peoples;
using System.Linq;

[System.Serializable]
public class IconData
{
    public string id;
    public Sprite icon;
    public Sex sex;
}

[CreateAssetMenu(fileName = "IconsConfig", menuName = "Config/IconsConfig")]
public class IconConfig : ScriptableObject
{
    public List<IconData> icons = new List<IconData>(); 

    public IconData GetRandomIcon(Sex sex)
    {
        var availableIcons = icons.Where(x => x.sex == sex).ToList();

        return availableIcons[Random.Range(0, availableIcons.Count)];
    }

    public Sprite GetSpriteByID(string id) => icons.Find(x => x.id == id).icon;
}
