import { store } from '@/store'
import { defineStore } from 'pinia'

interface TrafficType {
  waves: string[], // 标注车辆，事件相关等
  nowEvents: any[], // 当前事件标注
  oldEvents: any[] // 回溯事件标注
}

export const useTrafficStore = defineStore('traffic', {

  state: (): TrafficType => ({
    waves: [],
    nowEvents: [],
    oldEvents: []
  }),
  getters: {

    getWaves () {
      return this.waves
    },

    getNowEvents () {
      return this.nowEvents
    },

    getOldEvents () {
      return this.oldEvents
    }

  },

  actions: {

    setWaves (e) {
      this.waves = e || []
    },

    setNowEvents (e) {
      this.nowEvents = e || []
    },

    setOldEvents (e) {
      this.oldEvents = e || []
    }

  }

})

export const useTrafficStoreOut = () => {
  return useTrafficStore(store)
}