package main

type procFeedbackDef struct {
	chatProcedureID
}

var procFeedback = procFeedbackDef{}

func (m *procFeedbackDef) init(ss *openIDSessionData) {
	ss.Procedure = m.getID()
	ss.refreshExpire(600)
}

func (m *procFeedbackDef) clean(ss *openIDSessionData) {
	ss.Procedure = ""
}

func (m *procFeedbackDef) start(ss *openIDSessionData, in *InWechatMsg) {
	m.clean(ss)
}

func (m *procFeedbackDef) serve(ss *openIDSessionData, in *InWechatMsg) (processed bool) {
	switch msg := in.body.(type) {
	case TextMsg:
		processed = true
		in.transfer2KF()
		kfSendTxt(ss.OpenID, "文字收到，已转接校友会，稍后答复您")
	case PicMsg:
		processed = true
		in.transfer2KF()
		kfSendTxt(ss.OpenID, "图片收到，已转接校友会投诉部门，稍后答复您")
	case VoiceMsg:
		processed = true
		in.transfer2KF()
		kfSendTxt(ss.OpenID, "语音收到，已转接校友会，尽快答复您")

	case EventMsg:
		processed = true
		if msg.Event == "LOCATION" {
			onLocation(in)
		}
		if msg.Event == "CLICK" {
			processed = false //we might need to process other menu command.
		}
	default:
		processed = false
	}
	return
}
func (m *procFeedbackDef) summary(ss *openIDSessionData) {
	kfSendTxtAs(ss.OpenID, "投诉内容结束，我们将尽快答复您的咨询", "孙鹏")
}

func (m *procFeedbackDef) intro(ss *openIDSessionData, in *InWechatMsg) {
	in.replyText("请输入您要投诉，反馈，意见，建议。\n可以针对校友会，也可以及针对某位校友个人。 也可以提出请求，比如希望某某校友多给校友会捐点钱,/::D. \n\n校友会将尽快作出回应，\n\n欢迎您的反馈和监督")
}
