<script setup lang="ts">
import { ref, onMounted } from 'vue'
import MainPage from './components/pages/MainPage.vue';
import VideoPage from './components/pages/VideoPage.vue';
import VerticalTabs from './components/tabs/VerticalTabs.vue';
import Tab from './components/tabs/Tab.vue';
import LightingPage from './components/pages/LightingPage.vue';
import ServisPage from './components/pages/ServisPage.vue';


let urlParams = new URLSearchParams(window.location.search);

const currentRoom = ref(urlParams.get('room') || 'none') // if no param specified

// should also check if valid room parameter ampak se ne mudi
// TODO does this make sense al se naj naprej defaulta kr na p01?


const pageNum = ref(0)
const srvcUnlocked = ref(true) 
const showPinPopup = ref(false)



function lockServicePage() {
  srvcUnlocked.value = false
}


</script>

<template>
  <div v-if="currentRoom == 'none'">
    <h1>Incorrect or missing room parameter!</h1>
  </div>
  <div v-else id="wrapper">
    <header class="sidebar">

      <img class="logo" src="https://fri.uni-lj.si/sites/all/themes/fri_theme/images/fri_logo.png"  />
      <h1>{{ currentRoom.toUpperCase() }}</h1>

      <VerticalTabs id="nav">
        <Tab @click="pageNum=0; lockServicePage()" :selected="pageNum==0">Priprava</Tab>
        <Tab @click="pageNum=1; lockServicePage()" :selected="pageNum==1">Video</Tab>
        <Tab @click="pageNum=2; lockServicePage()" :selected="pageNum==2">Audio</Tab>
        <Tab @click="pageNum=3; lockServicePage()" :selected="pageNum==3">Lučke</Tab>
        <Tab @click="pageNum=4; lockServicePage()" :selected="pageNum==4">Servis</Tab>
      </VerticalTabs>
      <large style="display: flex;">turbo odličen super mega kontrol panel</large>
    </header>
    <main>
      <MainPage v-if="pageNum == 0" :room="currentRoom" />
      <VideoPage v-else-if="pageNum == 1" :room="currentRoom" />
      
      <LightingPage v-else-if="pageNum == 3" :room="currentRoom" />

      <ServisPage v-else-if="pageNum == 4" :room="currentRoom" />
    </main>
  </div>
</template>

<style scoped>

#wrapper {
  width: 100%;
  height: 100%;
  display: flex;
}

main {
  flex: 1;
  padding: 1rem;
}

h1 {
  text-align: center;
}

.sidebar {
  max-width: 20vw;
}
.logo {
  max-width: 100%;
  padding: .4rem;
}

* {
cursor: none;
}

</style>
