<script>
import { defineStore } from 'pinia'
import {ref, computed} from 'vue'

// the first argument is a unique id of the store across your application

export const mainStore = defineStore('store', () => {
  const isOpen = ref(false)
  const modal = ref(false)
  const promo_display = []

  function changeGallery(isopen, n, val, promo) {
    modal.value = val
    if (n == 0) {
        isOpen.value = !isopen
    } 
    if (!(promo === null)) {
      promo_display.push(promo);
      if (promo_display.length > 1) {
        promo_display.shift();
      }
    }
  }

  return { isOpen, modal, changeGallery, promo_display}
})
</script>