using UnityEngine;
using System.Collections.Generic;

[System.Serializable()]
public struct AppleCategoryToMaterial {
    public AppleCategory category;
    public Material material;
}

public class AppleProgressGroup : MonoBehaviour {

    public AppleCategoryProgress progressPrefab;
    public List<AppleCategoryToMaterial> categories;

    private Dictionary<AppleCategory, AppleCategoryProgress> progressPerCategory;

    void Awake() {
        progressPerCategory = new Dictionary<AppleCategory, AppleCategoryProgress>();
        AppleCategoryProgress progress;
        foreach (AppleCategoryToMaterial catMat in categories) {
            progress = Instantiate<AppleCategoryProgress>(progressPrefab);
            progress.transform.SetParent(this.transform);
            progress.ActiveColor = catMat.material.color;
            progressPerCategory[catMat.category] = progress;
        }
    }

    public void InitCategoryProgress(AppleCategory category, int count) {
        progressPerCategory[category].SetupApples(count);
    }

    public void MarkProgress(AppleCategory category, int count) {
        progressPerCategory[category].MarkPickedupApples(count);
    }
}
