import { ref } from 'vue'
import { defineStore } from 'pinia'

export const useScenicStore = defineStore('scenic', () => {
  // 车船数据
  let vehicleData = ref({})
  // 门票销售数据
  let scenicSpotData = ref({
    data: [
      { name: '预订今日票', value: 0 },

      { name: '今日购票数', value: 0 },
      { name: '预订未来三天票数', value: 0 },
      { name: '预订未来十五天票数', value: 0 }
    ],
    infoList: [
      { name: '游玩舒适度', type: 0, value: '空闲' },
      // { name: '景区安全', type: 0, value: '安全' },
      { name: '交通拥堵度', type: 0, value: '通畅' },
      { name: '停车场负荷', type: 0, value: '空闲' }
    ]
  })
  // 景区排队信息
  let scenicQueueData = ref({ dataList: [], header: { jrcp: 0, jrjdrs: 0,jrjdcy:0, pdcxsj: 0, pdrs: 0,pdrs_type:0 } })
  // 景区负载信息
  let scenicBearData = ref({ dataList: [], header: { jqRate: 0, jqzdcz: 0, jrjdrs: 0 } })
  // 景区停车信息
  let stopCarData = ref({
    dataList: [],
    dataLists: [],
    headList: [],
    info: {
      count: 0,
      remain: 0
    }
  })
  // 安全信息
  let secureData = ref({
    dataList: [],
    headList: [
      { name: '当前告警总数', count: 0, type: 0 },
      { name: '异常告警总数', count: 0, type: 0 },
      { name: '已解除告警数', count: 0, type: 0 }
    ]
  })
  // 交通信息
  let trafficData = ref({
    infoList: [
      { name: '总通景路段', value: 0 },
      { name: '通景路段拥堵', value: 0 },
      // { name: '通景拥堵开始时间', value: 0 },
      { name: '拥堵总持续时间(分钟)', value: 0 }
    ],
    data: {
      congestion: [],
      countRate: [],
      timeRate: []
    }
  })
  // 安全信息
  let userPortraitData = ref({
    data: {
      ageRate: [],
      channel: [],
      genderRate: [],
      provinceRate: []
    }
  })
  // 工单列表
  let wordkOrderList = ref([])
  // 工单统计
  let wordkOrderData = ref({
    toDayData: { count: 0, end: 0, rate: '0.0' },
    warnData: { count: 0, end: 0, rate: '0.0' }
  })
  // 车船信息
  let carShipData = ref({
    car: {
      count: { nonDrivingCount: 0, drivingCount: 0 },
      list: []
    },
    ship: {
      count: { nonDrivingCount: 0, drivingCount: 0 },
      list: []
    }
  })
  const setVehicleData = (val) =>{
	  vehicleData.value = val
  }
  const setCarShipData = (val) => {
    carShipData.value = val
  }
  const setWordkOrderData = (val) => {
    wordkOrderData.value = val
  }
  const setWordkOrderList = (val) => {
    wordkOrderList.value = val
  }
  const setUserPortraitData = (val) => {
    userPortraitData.value = val
  }
  const setTrafficData = (val) => {
    trafficData.value = val
  }
  const setSecureData = (val) => {
    secureData.value = val
  }
  const setStopCarData = (val) => {
	  stopCarData.value = val
  }
  const setScenicBearData = (val) => {
    scenicBearData.value = val
  }
  const setScenicQueueData = (val) => {
    scenicQueueData.value = val
  }
  const setScenicSpotData = (val) => {
    scenicSpotData.value = val
  }
  return {
    wordkOrderData,
    wordkOrderList,
    scenicSpotData,
    scenicQueueData,
    scenicBearData,
    stopCarData,
    secureData,
    trafficData,
    userPortraitData,
    carShipData,
    setWordkOrderData,
    setWordkOrderList,
    setScenicSpotData,
    setScenicQueueData,
    setScenicBearData,
    setStopCarData,
    setSecureData,
    setTrafficData,
    setUserPortraitData,
    setCarShipData,
	vehicleData,
	setVehicleData
  }
})
