package com.yonge.cooleshow.api.feign;

import com.yonge.cooleshow.api.feign.dto.*;
import com.yonge.cooleshow.api.feign.fallback.AdminFeignServiceFallback;
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;

/**
 * Description
 *
 * @author liujunchi
 * @date 2022-05-06
 */
@FeignClient(name = "${app-config.open-feign.admin-server.name:admin-server}", url = "${app-config.open-feign.admin-server.url:}",
        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);

    /**
     * 机构信息
     * @param tenantId 机构ID
     * @return TenantWrapper.Tenant
     */
    @GetMapping(value = "/open/adminClient/getTenant")
    HttpResponseResult<TenantWrapper.Tenant> getTenantInfo(@RequestParam("tenantId") Long tenantId);

    /**
     * 机构员工信息
     * @param userId 用户ID
     * @return TenantWrapper.Staff
     */
    @GetMapping(value = "/open/adminClient/getTenantStaff")
    HttpResponseResult<TenantWrapper.Staff> getTenantStaff(@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);


    /**
     *  每日增加收藏/热度人数
     */
    @GetMapping("/task/virtualNumber")
    HttpResponseResult<Boolean> virtualNumber();

    /**
     * 群发消息
     */
    @GetMapping("/task/batchSending")
    HttpResponseResult<Boolean> batchSending();

    /**
     * 融云消息同步
     */
    @GetMapping("/task/rongyunImport")
    void rongyunImport();


    /**
     * 销毁直播间
     */
    @GetMapping("/task/destroyLiveRoom")
    HttpResponseResult<Object> destroyLiveRoom();


    @PostMapping("/open/adminClient/unionStudent")
    HttpResponseResult<StudentWrapper.UnionStudentResp> unionStudent(@RequestBody StudentWrapper.UnionStudent info);


    @PostMapping(value = "/open/im/register")
    ImUserInfo register(@RequestParam("userId") String userId, @RequestParam("clientType") String clientType, @RequestParam("username") String username, @RequestParam("avatar") String avatar);


    /**
     * 定时发送平台审核短信 下午5点
     */
    @GetMapping("/task/sendPlatformAuditMessage")
    HttpResponseResult<Object> sendPlatformAuditMessage();

    /**
     * 机构学生训练教材过期
     */
    @GetMapping("/task/sendTenantAlbumMessage")
    HttpResponseResult<Object> sendTenantAlbumMessage();

    /**
     * 作品过期设置
     */
    @GetMapping("/task/workOverdue")
    HttpResponseResult<Object> workOverdue();

    //课程开始前一20分组提醒
    @GetMapping("/task/courseStartRemind")
    HttpResponseResult<Object> courseStartRemind();


    /**
     * 账号注销校验
     */
    @PostMapping("/sysUser/logoffCheck")
    HttpResponseResult<List<ApiWrapper.LogOff>> accountLogoffCheck(@RequestParam(value = "phone") String phone);

    @PostMapping("/sysUser/logoffQuitImGroup")
    HttpResponseResult<Boolean> logoffQuitImGroup(@RequestParam(value = "phone") String phone);

    /**
     * 清除客服绑定关系
     * @param userId 用户ID
     * @param sysUserType 用户类型
     *
     * @return HttpResponseResult<Boolean>
     */
    @GetMapping("/employee/clearCustomerService")
    HttpResponseResult<Boolean> clearCustomerService(@RequestParam(value = "userId") Long userId,
                                                     @RequestParam("sysUserType") String sysUserType);
}
