export type timState = {
  isLogin: boolean,
  conversation: object,
  conversationList: array,
  conversationID: string,
  messageList: array,
  scrollTop: number,
  userInfo: object,
  imType:number,//0关闭 1问诊inquiry 2客服咨询 follow
  followId:string,
  orderId:string,
  orderType: number//1图文 2视频
  type:number,
};

const state: timState = {
  isLogin: false,
  conversationList: [],
  messageList: [],
  conversation: {},
  conversationID: '',
  scrollTop: 0,
};

export default {
  namespaced: true,
  state,
  getters: {
    userInfo: (state): string => {
      return state.userInfo;
    }
  },
  mutations: {
    setscrollTop(state: timState, payload: number): void {
      state.scrollTop = payload;
    },
	setImType(state: timState, payload: number): void {
	  state.imType = payload;
	},
	setType(state: timState, payload: string): void {
	  state.type = payload;
	},
	setOrderId(state: timState, payload: string): void {
	  state.orderId = payload;
	},
	setFollowId(state: timState, payload: string): void {
	  state.followId = payload;
	},
	setOrderType(state: timState, payload: number): void {
	  state.orderType = payload;
	},
    setConversationList(state: timState, payload: object): void {
      state.conversationList = payload;
    },
    setConversation(state: timState, payload: object): void {
      state.conversation = payload;
    },
    setConversationID(state: timState, payload: string): void {
      state.conversationID = payload;
    },
	resetConversationID(state: timState,): void {
	  state.conversationID = '';
	},
    setMessageList(state: timState, payload: object): void {
      state.messageList = payload;
    },
    resetChat(state: timState): void {
      state.messageList = [];
    },
  },
  actions: {
    // 

  },
};