package org.dromara.mp.handler;

import me.chanjar.weixin.common.session.WxSessionManager;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage;
import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * 关注事件处理器
 *
 * @author pengles
 */
@Component
public class SubscribeHandler extends AbstractHandler {

    @Override
    protected WxMpXmlOutMessage doHandle(WxMpXmlMessage wxMessage,
                                         Map<String, Object> context,
                                         WxMpService wxMpService,
                                         WxSessionManager sessionManager) {

        String welcomeMsg = "感谢您关注我们的公众号！\n\n" +
                "您可以发送以下关键词获取帮助：\n" +
                "• 你好 - 获取欢迎信息\n" +
                "• 帮助 - 获取帮助信息\n" +
                "• 联系我们 - 获取联系方式\n\n" +
                "我们将为您提供优质的服务！";

        return buildTextMessage(welcomeMsg, wxMessage, wxMpService);
    }
}
