package com.yida.data.user.feign;

import com.yida.data.common.core.common.ResultBean;
import com.yida.data.common.core.entity.constant.FebsServerConstant;
import com.yida.data.common.core.entity.user.EduUserDevice;

import com.yida.data.user.fallback.RemoteUserDeviceServiceFallback;
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.util.List;

@FeignClient(name = FebsServerConstant.EDU_USER, contextId = "userDeviceService",
        fallbackFactory = RemoteUserDeviceServiceFallback.class)
public interface RemoteUserDeviceService {

    @PostMapping("/in/userDevice/batchSave")
    ResultBean batchSave(@RequestBody List<EduUserDevice> list);

    /**
     * 获取设备和人员关联信息
     *
     * @param userId      用户id
     * @param type        用户类型. 0-学生，1-职工
     * @param deviceId    设备id
     * @param faceGroupId 人脸组id
     * @return com.yida.data.common.core.common.ResultBean<java.util.List < com.yida.data.common.core.entity.user.EduUserDevice>>
     * @author ZYJ
     * @date 2023/2/3 17:21
     */
    @GetMapping("/in/userDevice/listUserDevice")
    ResultBean<List<EduUserDevice>> listUserDevice(@RequestParam Long userId,
                                                   @RequestParam Integer type,
                                                   @RequestParam Long deviceId,
                                                   @RequestParam Long faceGroupId);

    /**
     * 删除设备和人员关联信息
     *
     * @param userDevice 删除信息
     * @return com.yida.data.common.core.common.ResultBean<java.lang.String>
     * @author ZYJ
     * @date 2023/2/23 17:32
     */
    @PostMapping("/in/userDevice/deleteRelation")
    ResultBean<String> deleteRelation(@RequestBody EduUserDevice userDevice);
}
