package com.yiqi.common.config;


import cn.binarywang.wx.miniapp.api.WxMaService;
import me.chanjar.weixin.common.service.WxService;
import me.chanjar.weixin.mp.api.WxMpService;

import java.util.Map;

public class CompositeWxMaService {

    private final Map<String, WxService> serviceMap;

    private final WxMaService defaultService;

    public CompositeWxMaService(Map<String, WxService> serviceMap, WxMaService defaultService) {
        this.serviceMap = serviceMap;
        this.defaultService = defaultService;
    }

    public WxMaService get() {
        return defaultService;
    }

    public WxMaService getWxapp() {
        return (WxMaService) serviceMap.get(WxMaConfig.WXAPP);
    }

    public WxMpService getPublic(){
        return (WxMpService) serviceMap.get(WxMaConfig.PUBLIC);
    }
}