import * as types from './mutation-types'
import {
	setOpenId,
	setUserId,
	setToken,
	setPersonData,
	setPersonPopedom,
	setMenuList,
	setCommonMenuList,
	setPersonTemp,
	setFunList,
	setAuthFunList,
	setRegisterFormData,
	setAppVersion,
	setPersionHomeModel,
	setOldRelationFormData,
	setWxPayBackUrl,
	setWdMessageNum,
	setInvitationCode,
	setDefaultExaminePerson,
	setActivityFormData,
	setApiType,
	setParkingMerchantId,
	setParkingMerchantData,
	setParkingCompanyId,
} from '../utils/storage'
 
var storage_prefix = process.env.VUE_APP_LOCAL_STORAGE_PREFIX;

const mutations = {
	[types.SET_WEIXIN_OPENID](state, openid) {
		setOpenId(openid)
		state.weixin_openid = openid
	},

	[types.SET_ALI_OPENID](state, openid) {
		setUserId(openid)
		state.ali_openid = openid
	},

	[types.SET_TOKEN](state, data) {
		setToken(data)
		state.token = data
	},

	[types.SET_PERSON_DATA](state, data) {
		setPersonData(storage_prefix, data)
		state.person_data = data
	},

	[types.SET_PERSON_POPEDOM](state, data) {
		setPersonPopedom(storage_prefix, data)
		state.person_popedom = data
	},

	[types.SET_ADD_PERSON_DATA](state, data) {
		state.add_person_data = data
	},
	setControlAbnormalStatisticsStartTime(state, data) {
		state.control_abnormal_statistics_startTime = data
	},
	setControlAbnormalStatisticsEndTime(state, data) {
		state.control_abnormal_statistics_endTime = data
	},

	[types.SET_MENI_LIST](state, data) {
		setMenuList(storage_prefix, data)
		state.menu_list = data
	},

	[types.SET_COMMON_MENU_LIST](state, data) {
		setCommonMenuList(storage_prefix, data)
		state.common_menu_list = data
	},

	[types.SET_PERSON_TEMP](state, data) {
		setPersonTemp(storage_prefix, data)
		state.person_temp = data
	},

	[types.SET_FUN_LIST](state, data) {
		setFunList(storage_prefix, data)
		state.fun_list = data
	},

	[types.SET_AUTH_FUN_LIST](state, data) {
		setAuthFunList(storage_prefix, data)
		state.auth_fun_list = data
	},

	[types.SET_REGISTER_FORM_DATA](state, data) {
		setRegisterFormData(storage_prefix, data)
		state.register_form_data = data
	},

	[types.SET_APP_VERSION](state, data) {
		setAppVersion(storage_prefix, data)
		state.app_version = data
	},

	[types.SET_PERSION_HOME_MODEL](state, data) {
		setPersionHomeModel(storage_prefix, data)
		state.persion_home_model = data
	},

	[types.SET_OLD_RELATION_FORM_DATA](state, data) {
		setOldRelationFormData(storage_prefix, data)
		state.old_relation_form_data = data
	},

	[types.SET_WX_PAY_BACK_URL](state, data) {
		setWxPayBackUrl(storage_prefix, data)
		state.wx_pay_back_url = data
	},

	[types.SET_REGISTER_EXAMINE_FORM](state, data) {
		state.register_examine_form = data
	},

	[types.SET_WD_MESSAGE_NUM](state, data) {
		setWdMessageNum(storage_prefix, data)
		state.wd_message_num = data
	},

	[types.SET_INVITATION_CODE](state, data) {
		setInvitationCode(storage_prefix, data)
		state.invitation_code = data
	},

	[types.SET_DEFAULT_EXAMINE_PERSON](state, data) {
		setDefaultExaminePerson(storage_prefix, data)
		state.default_examine_person = data
	},

	[types.SET_ACTIVITY_FORM_DATA](state, data) {
		setActivityFormData(storage_prefix, data)
		state.activity_form_data = data
	},

	[types.SET_KEEP_ALIVE_COMPONENTS](state, data) {
		state.keep_alive_components = data
	},
	[types.SET_API_TYPE](state, data) {
		setApiType(storage_prefix, data)
		state.api_type = data
	},

	[types.SET_PARKING_MERCHANT_ID](state, data) {
		setParkingMerchantId(storage_prefix, data)
		state.parking_merchant_id = data
	},

	[types.SET_PARKING_MERCHANT_DATA](state, data) {
		setParkingMerchantData(storage_prefix, data)
		state.parking_merchant_data = data
	},

	[types.SET_PARKING_COMPANY_ID](state, data) {
		setParkingCompanyId(storage_prefix, data)
		state.parking_company_id = data
	},

}

export default mutations
