package com.yida.data.system.feign;

import com.yida.data.common.core.common.ResultBean;
import com.yida.data.common.core.entity.Dict;
import com.yida.data.common.core.entity.constant.FebsServerConstant;
import com.yida.data.common.core.entity.system.EduArea;
import com.yida.data.common.core.entity.system.EduDeptWxPublic;
import com.yida.data.common.core.entity.system.EduSysFile;
import com.yida.data.common.core.entity.system.EduWxPublicTemplateMsg;
import com.yida.data.system.fallback.RemoteCommonServiceFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(value = FebsServerConstant.FEBS_SERVER_SYSTEM, contextId = "commonServiceClient",
        fallbackFactory = RemoteCommonServiceFallback.class)
public interface RemoteCommonService {

    /**
     * 上传图片
     *
     * @param code base64
     * @return
     */
    @PostMapping("/in/common/uploadImg")
    ResultBean<String> uploadImg(String code);

    @PostMapping("/common/upload")
    ResultBean<EduSysFile> uploadFile();

    @GetMapping("/in/common/getDeptWxPublic")
    ResultBean<EduDeptWxPublic> getDeptWxPublic(@RequestParam("deptId") Long deptId);

    @GetMapping("/in/common/saveReceiveMsg")
    void saveReceiveMsg();

    /**
     * 查询公众号模板消息
     */
    @GetMapping("/in/common/getWxTemplateMsg")
    ResultBean<EduWxPublicTemplateMsg> getWxTemplateMsg(@RequestParam("wxPublicAppId") String wxPublicAppId,
                                                        @RequestParam("templateMsgType") Integer templateMsgType);

    /**
     * 查询字典值
     *
     * @param type 字典类型
     */
    @GetMapping("/in/common/getDict")
    ResultBean<List<Dict>> getDict(@RequestParam("type") String type);

    /**
     * 查询区域
     *
     * @param id
     * @return
     */
    @GetMapping("/in/common/getArea")
    ResultBean<EduArea> getArea(@RequestParam("id") Long id);
}
