import { GlobalStateProps } from './index'

type BasicInfo = Pick<GlobalStateProps, 'basicInfo'>['basicInfo']

export default {
  SET_LOADING(state: GlobalStateProps, val: boolean) {
    state.showLoading = val
  },
  SET_AUTH(state: GlobalStateProps, val: any) {
    state.auth = val
  },
  SET_MENUS(state: GlobalStateProps, data: any) {
    state.menus = data
  },
  SET_SHOW_TAG(state: GlobalStateProps, val: boolean) {
    state.showTag = val
  },
  SET_CUR_TAG(state: GlobalStateProps, val: string) {
    state.curTag = val
  },
  SET_SHOW_BASIC_INFO(state: GlobalStateProps, val: boolean) {
    state.showBasicInfo = val
  },
  SET_FILTER_DRAWER(state: GlobalStateProps, val: boolean) {
    state.showFilterDrawer = val
  },
  SET_ACTIVITY_DRAWER(state: GlobalStateProps, val: boolean) {
    state.showActivityDrawer = val
  },
  SET_NEW_ACTIVITY_DRAWER(state: GlobalStateProps, val: boolean) {
    state.showNewActivityDrawer = val
  },
  SET_BUILDING_DRAWER(state: GlobalStateProps, val: boolean) {
    state.showBuildingDrawer = val
  },
  SET_ACTIVITY_LIST_MODAL(state: GlobalStateProps, val: boolean) {
    state.showActivityListModal = val
  },
  SET_STRUCT_MODAL(state: GlobalStateProps, val: boolean) {
    state.showStructModal = val
  },
  SET_BASIC_INFO(state: GlobalStateProps, data: BasicInfo) {
    state.basicInfo = data
  },
  SET_FILTER_PATH(state: GlobalStateProps, val: string) {
    state.filterPath = val
  },
  SET_MAP_POINTS(state: GlobalStateProps, data: any[] = []) {
    state.mapPoints = data
  },
}
