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

public class UITabs : MonoBehaviour
{
    public Dropdown titleDropdown;
    [Space]
    public GameObject connectorStatePanel;
    public GameObject connectPanel;
    public GameObject authenticatePanel;
    public GameObject createUserPanel;
    public GameObject loginPanel;
    public GameObject echoPanel;
    public GameObject roomPanel;
    [Space]
    public GameObject managerStatePanel;
    public GameObject setupPanel;
    public GameObject setupRoomPanel;

    public enum Tab { MANAGER_TAB, CONNECTOR_TAB }

    public void Start()
    {
        titleDropdown.onValueChanged.AddListener(OnDropdownValueChanged);
        ChangeTab(Tab.MANAGER_TAB);
    }

    public void OnDropdownValueChanged(int option)
    {
        ChangeTab((Tab)option);
    }
    
    public void ChangeTab(Tab tab)
    {
        connectorStatePanel.SetActive(tab == Tab.CONNECTOR_TAB);
        connectPanel.SetActive(tab == Tab.CONNECTOR_TAB);
        authenticatePanel.SetActive(tab == Tab.CONNECTOR_TAB);
        createUserPanel.SetActive(tab == Tab.CONNECTOR_TAB);
        loginPanel.SetActive(tab == Tab.CONNECTOR_TAB);
        echoPanel.SetActive(tab == Tab.CONNECTOR_TAB);
        roomPanel.SetActive(tab == Tab.CONNECTOR_TAB);
        
        managerStatePanel.SetActive(tab == Tab.MANAGER_TAB);
        setupPanel.SetActive(tab == Tab.MANAGER_TAB);
        setupRoomPanel.SetActive(tab == Tab.MANAGER_TAB);
    }
}
