package com.zd.system.api.laboratory;

import com.zd.common.core.constant.ServiceNameConstants;
import com.zd.common.core.domain.R;
import com.zd.system.api.domain.SubQueryConfig;
import com.zd.system.api.factory.RemoteSubQueryFallbackFactory;
import com.zd.system.api.laboratory.domain.CabinetLock;
import com.zd.system.api.laboratory.domain.LabSubject;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;
import java.util.Map;

/**
 * 实验室feign调用服务
 */
@FeignClient(contextId = "remoteSubQueryService", value = ServiceNameConstants.LABORATORY_SERVICE, fallbackFactory = RemoteSubQueryFallbackFactory.class)
public interface RemoteSubQueryService {

    /**
     * 查询实验室详情
     */
    @ApiOperation(value = "查询实验室详情")
    @PostMapping("/subject/manger/V2/diy/{id}/common")
    R<Object> getSafeWarnCount(@PathVariable("id") Long id,@RequestBody SubQueryConfig subQueryConfig);



    /**
     * 查询实验室控制数据列表- 数据权限（包括负责人）
     */
    @ApiOperation("查询实验室控制数据列表- 数据权限（包括负责人）")
    @PostMapping("/subject/manger/V2/list")
    R<Object> querySubCListVO(@RequestBody Map<String,Object> appSubQuery);

    /**
     * 查询实验室控制数据列表- 数据权限（包括负责人）
     */
    @ApiOperation("查询实验室控制数据列表- 数据权限（包括负责人）")
    @GetMapping("/subject/manger/V2/admin/subandwran/count")
    R<Map<String,Object>> querySubCListVO();

    @PostMapping("/subject/manger/V2/list/ids")
    R<List<LabSubject>> listByIds(@RequestBody List<Long> ids);

    @GetMapping("/subject/manger/V2/list/name")
    R<List<LabSubject>> listByName(@RequestParam("name") String name);

    @PostMapping("/device/remote/cabinetLock")
    R cabinetLock(@RequestBody @Valid CabinetLock cabinetLock);

    /**
     * 柜锁开锁 V2
     */
    @PostMapping("/device/remote/V2/openLock")
    R cabinetV2OpenLock(@RequestBody @Valid CabinetV2Lock cabinetV2Lock);

    /**
     * 柜锁关锁锁 V2
     */
    @PostMapping("/device/remote/V2/closeLock")
    R cabinetV2CloseLock(@RequestBody @Valid CabinetV2Lock cabinetV2Lock);
}
