using UnityEngine;

namespace MaskShop
{
    /// <summary>
    /// Represents a mask mold with its associated texture type
    /// </summary>
    [CreateAssetMenu(fileName = "New Mask Mold", menuName = "Mask Shop/Mask Mold")]
    public class MaskMold : ScriptableObject
    {
        [Header("Mold Information")]
        [SerializeField] private string moldName;
        [SerializeField, TextArea] private string description;
        [SerializeField] private GameObject moldPrefab;

        [Header("Texture Association")]
        [SerializeField] private MaskTexture associatedTexture;

        [Header("Decoration Slots")]
        [Tooltip("Transform names in the prefab where decorations can be attached")]
        [SerializeField] private string[] decorationSlotNames;

        [Header("Unlock Requirements")]
        [SerializeField] private int requiredLevel = 1;
        [SerializeField] private bool isUnlocked = true;

        // Properties
        public string MoldName => moldName;
        public string Description => description;
        public GameObject MoldPrefab => moldPrefab;
        public MaskTexture AssociatedTexture => associatedTexture;
        public string[] DecorationSlotNames => decorationSlotNames;
        public int RequiredLevel => requiredLevel;
        public bool IsUnlocked => isUnlocked;

        /// <summary>
        /// Checks if this mold matches the requested texture
        /// </summary>
        public bool MatchesTexture(MaskTexture requestedTexture)
        {
            if (requestedTexture == null) return true; // No texture specified = any is valid
            return associatedTexture == requestedTexture;
        }

        /// <summary>
        /// Unlocks this mold
        /// </summary>
        public void Unlock()
        {
            isUnlocked = true;
        }
    }
}