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


public class TogglePanel : MonoBehaviour
{
    [SerializeField] private CheckBottomOfModel toggles;
    [SerializeField] private RoscanModelUnity model;


    /// <summary> When the button is pressed and Status of any toggle (in any layer) is active - active the layer instead </summary>
    public void OnlyOne()
    {
        if (toggles.status)
        {
            CloseEveryToggle();

            switch (model.ActualLayer)
            {
                case RoscanModelUnity.ModelLayers.SURFACE:
                    toggles.checkBox1.isOn = true;
                    break;
                case RoscanModelUnity.ModelLayers.REFLECTIVITY:
                    toggles.checkBox2.isOn = true;
                    break;
                case RoscanModelUnity.ModelLayers.REFL_WIDTH:
                    toggles.checkBox3.isOn = true;
                    break;
                case RoscanModelUnity.ModelLayers.COLOR:
                    toggles.checkBox4.isOn = true;
                    break;
                case RoscanModelUnity.ModelLayers.TEMPERATURE:
                    toggles.checkBox5.isOn = true;
                    break;
                default:
                    CloseEveryToggle();
                    break;
            }
        }
    }

    /// <summary> Deactivating all toggles </summary>
    private void CloseEveryToggle()
    {
        toggles.checkBox1.isOn = false;
        toggles.checkBox2.isOn = false;
        toggles.checkBox3.isOn = false;
        toggles.checkBox4.isOn = false;
        toggles.checkBox5.isOn = false;
    }
}
