using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class RewardTemplateManager : MonoBehaviour
{
    public GameObject major;
    public GameObject minor;

    public RawImage minorBG;
    public RawImage minorIcon;

    private RawImage majorBG;
    private RawImage majorIcon;

    public RawImage lockedState;

    public GameObject rewardPreview;

    // Use this for initialization
    void Awake ()
    {
        majorBG = major.transform.GetChild(0).GetComponent<RawImage>();
        majorIcon = major.transform.GetChild(1).GetComponent<RawImage>();

        minorBG = minor.transform.GetChild(0).GetComponent<RawImage>();
        minorIcon = minor.transform.GetChild(1).GetComponent<RawImage>();
    }

    public void FillTemplate(BattlePassReward reward)
    {
        //If it is a Minor Reward
        if (reward.rewardType == 0)
        {
            //Turn off the major
            major.SetActive(false);

            //Set the background and icon images
            minorBG.texture = reward.RewardBackground;
            minorIcon.texture = reward.RewardIcon;

            //Get the reward's preview prefab
            rewardPreview = reward.RewardPreview;
        }
        else
        {
            //Turn off the major
            minor.SetActive(false);

            //Set the background and icon images
            majorBG.texture = reward.RewardBackground;
            majorIcon.texture = reward.RewardIcon;

            //Get the reward's preview prefab
            rewardPreview = reward.RewardPreview;
        }
    }
}
