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

export const useHomeStore = defineStore('home', () => {
	let amplify = ref(true)
  // 景区信息数据
  let scenicData = ref({
    scenicSpot: [
      { value: 24, name: '全县景区数量' },
      { value: 5, name: '4A及以上景区总数' },
      { value: 3, name: '核心景区总数' }
    ],
    data: [
      { name: '预定今日票：', value: 0 },
      { name: '今日购票数：', value: 0 },
      // { name: '购三天后票数：', value: 0 }
    ]
  })
  //直通车购票
  let trainData = ref({
	  data: [
	    { name: '购今日票数：', value: 0 },
	    { name: '购未来三天票数：', value: 0 },
	    { name: '购三天后票数：', value: 0 }
	  ]
  })
  // 景区排队数据
  let scenicQueueData = ref({
    dataList: [],
    info: []
  })
  // 景区承载量
  let scenicBearData = ref({
    dataList: [],
    info: []
  })
  // 用户画像数据
  let userPortraitData = ref({
    genderRate: [],
    provinceRate: [],
    channel: [],
    ageRate: []
  })
  // 景区游客统计
  let visitorInfoData = ref({
    total_count_this_year: 0,
    total_count_today: 0,
    total_count_today_within_three_hours: 0
  })
  // 景区拥堵情况统计
  let visitorInfoList = ref([])
  // 百度地图数据
  let baiduMapData = ref(null)
  // 工单列表
  let wordkOrderList = ref([])
  // 工单统计
  let wordkOrderData = ref({
    toDayData: { count: 0, end: 0, rate: '0.0' },
    warnData: { count: 0, end: 0, rate: '0.0' }
  })
  // 交通信息
  let trafficInfoData = ref({
    data: {
      congestion: [],
      congestionList: [],
      countItem: {
        max_congestion_duration: 0,
        now_yongdu_sum: 0,
        yongdu_luduan_count: 0,
        yongdu_sum: 0
      },
      countRate: [],
      timeRate: []
    },
    info: {
      dqydld: 0,
      ldzs: 0,
      zdydsc: 0,
      zydcs: 0
    }
  })
  // 停车信息
  let carStopInfoData = ref({
    countInfo: { ckzs: 0, ysycws: 0, zcws: 0 },
    dataList: [],
    dataList1: [],
    dataList2: [],
    spotInfo: []
  })
  // 车船信息
  // {
  //   car: {
  //     count: 0,
  //     info: [],
  //     list: []
  //   },
  //   ship: {
  //     count: 0,
  //     info: [],
  //     list: []
  //   }
  // }
  let carShipData = ref(null)
  // 酒店数据
  let hotelData = ref(null)

  // 异常消息提醒
  let notifyInfo = ref([
    { name: '安全异常', value: 0 },
    { name: '排队异常', value: 0 },
    { name: '停车异常', value: 0 },
    { name: '舆论异常', value: 0 }
  ])
  const setAmplify = (val)=>{
	  amplify.value = val
  }
  const setNotifyInfo = (val) => {
    notifyInfo.value = val
  }
  const setVisitorInfoList = (val) => {
    visitorInfoList.value = val
  }
  const setHotelData = (val) => {
    hotelData.value = val
  }
  const setCarShipData = (val) => {
    carShipData.value = val
  }
  const setCarStopInfoData = (val) => {
    carStopInfoData.value = val
  }
  const setTrafficInfoData = (val) => {
    trafficInfoData.value = val
  }
  const setVisitorInfoData = (val) => {
    visitorInfoData.value = val
  }
  const setScenicBearData = (val) => {
    scenicBearData.value = val
  }
  const setScenicQueueData = (val) => {
    scenicQueueData.value = val
  }
  const setWordkOrderData = (val) => {
    wordkOrderData.value = val
  }
  const setWordkOrderList = (val) => {
    wordkOrderList.value = val
  }
  const setBaiduMapData = (val) => {
    baiduMapData.value = val
  }
  const setScenicData = (val) => {
    scenicData.value = val
  }
  // 直通车
  const setTrainData = (val)=>{
	  trainData.value = val
  }
  const setUserPortraitData = (val) => {
    userPortraitData.value = val
  }
  return {
	  amplify,
	trainData,
	setTrainData,
    scenicData,
    userPortraitData,
    baiduMapData,
    wordkOrderList,
    wordkOrderData,
    scenicQueueData,
    scenicBearData,
    visitorInfoData,
    visitorInfoList,
    trafficInfoData,
    carStopInfoData,
    carShipData,
    hotelData,
    notifyInfo,
    setNotifyInfo,
    setScenicData,
    setUserPortraitData,
    setBaiduMapData,
    setWordkOrderList,
    setWordkOrderData,
    setScenicQueueData,
    setScenicBearData,
    setVisitorInfoData,
    setVisitorInfoList,
    setTrafficInfoData,
    setCarStopInfoData,
    setCarShipData,
    setHotelData,
	setAmplify,
  }
})
