package com.yonge.cooleshow.api.feign;

import com.yonge.cooleshow.api.feign.dto.CouponInfoApi;
import com.yonge.cooleshow.api.feign.dto.EmployeeApi;
import com.yonge.cooleshow.api.feign.dto.StudentApi;
import com.yonge.cooleshow.api.feign.dto.TeacherApi;
import com.yonge.cooleshow.api.feign.dto.UserFriendInfoVO;
import com.yonge.cooleshow.api.feign.fallback.AdminFeignServiceFallback;
import com.yonge.cooleshow.common.constant.AppConstant;
import com.yonge.cooleshow.common.entity.ContractDto;
import com.yonge.cooleshow.common.entity.HttpResponseResult;
import com.yonge.cooleshow.common.entity.MallOrderItemDto;
import com.yonge.cooleshow.common.enums.UserFirstTimeTypeEnum;
import com.yonge.toolset.feign.config.FeignConfiguration;
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.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * Description
 *
 * @author liujunchi
 * @date 2022-05-06
 */
@FeignClient(name = AppConstant.APPLICATION_ADMIN + AppConstant.SERVER, configuration = FeignConfiguration.class,
        fallback = AdminFeignServiceFallback.class)
public interface AdminFeignService {
    /***
     * 轮询用户订单
     * @author liweifan
     * @updateTime 2022/3/28 15:34
     * @return: java.lang.Object
     */
    @GetMapping(value = "/task/pollingOrder")
    Object pollingOrder();

    /***
     * 一日一次，凌晨执行
     * @author liweifan
     * @updateTime 2022/3/28 15:34
     * @return: java.lang.Object
     */
    @GetMapping(value = "/task/daysTask")
    Object daysTask();

    /**
     * 老师作业布置通知
     */
    @PostMapping("/task/teacherSend")
    HttpResponseResult<Object> sendTodayNotRepliedAndNotDecorateHomework();

    //老师课酬
    @PostMapping(value = "/task/teacherEarning")
    HttpResponseResult<Object> sendTeacherEarning();


    /**
     * 设置商城收入分润
     */
    @PostMapping("/open/mallRecord")
    public HttpResponseResult<Boolean> mallRecord(@RequestBody List<MallOrderItemDto> shareDto);

    /**
     * 设置商城收入状态
     */
    @PostMapping("/open/mallRecordState")
    public HttpResponseResult<Boolean> mallRecordState(@RequestBody List<MallOrderItemDto> shareDto);


    //老师课酬
    @PostMapping(value = "/task/refreshBlackList")
    HttpResponseResult refreshBlackList();

    @GetMapping(value = "/sysConfig/findConfigValue")
    HttpResponseResult<String> findConfigValue(String paramName);


    /**
     * 签协议 商城调用
     */
    @GetMapping("/open/userOrder/contractRecord")
    HttpResponseResult<Boolean> contractRecord(@RequestBody ContractDto contract);

    /**
     * 营销活动
     *
     * @return
     */
    @PostMapping(value = "/task/activityState")
    HttpResponseResult activityState();

    /**
     * 活动中定时轮询
     *
     * @return
     */
    @PostMapping(value = "/task/activityIng")
    HttpResponseResult activityIng();

    @GetMapping(value = "/open/adminClient/recordTime")
    HttpResponseResult recordTime(
            @RequestParam("userId") Long userId,
            @RequestParam("userType") String userType,
            @RequestParam("firstTimeType") UserFirstTimeTypeEnum firstTimeType);

    @GetMapping(value = "/open/adminClient/getTeacher")
    HttpResponseResult<TeacherApi> getTeacher(@RequestParam("userId") Long userId);

    @GetMapping(value = "/open/adminClient/getStudent")
    HttpResponseResult<StudentApi> getStudent(@RequestParam("userId") Long userId);

    @GetMapping(value = "/open/adminClient/getEmployee")
    HttpResponseResult<EmployeeApi> getEmployee(@RequestParam("userId") Long userId);


    @PostMapping(value = "/open/adminClient/orderUpdate", consumes="application/json", produces="application/json")
    HttpResponseResult<Boolean> updateCouponOrderInfo(@RequestParam("couponIssueId") String couponIssueId,
                                                      @RequestParam("returnCoupon") Boolean returnCoupon,
                                                      @RequestParam("orderNo") String orderNo);

    @PostMapping(value = "/open/adminClient/orderInfo", consumes="application/json", produces="application/json")
    HttpResponseResult<CouponInfoApi> queryCouponOrderPageInfo(@RequestParam("userId") Long userId,
                                                               @RequestParam("issueIds") String issueIds,
                                                               @RequestParam("orderAmount") BigDecimal orderAmount,
                                                               @RequestParam("client") String client);

    /**
     * 新用户添加客服好友
     * @param info UserFriendInfoVO
     * @return HttpResponseResult<Boolean>
     */
    @PostMapping(value = "/open/im/customerService")
    HttpResponseResult<Boolean> customerService(@RequestBody UserFriendInfoVO info);
}
