package com.sptg.gateway.controller.device;


import com.sptg.common.core.beans.ResultBean;
import com.sptg.common.security.annotation.Security;
import com.sptg.common.security.enums.DataFormatEnum;
import com.sptg.device.api.constant.DeviceSecurityToken;
import com.sptg.device.api.entity.Device;
import com.sptg.device.api.entity.FlowCardDevice;
import com.sptg.device.api.feigns.FlowCardDeviceFeign;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@AllArgsConstructor
public class FlowCardDeviceController {
    private final FlowCardDeviceFeign flowCardDeviceFeign;

    @GetMapping(value = "/flowCardDevice/getList")
    @Security(token = DeviceSecurityToken.DEVICE_FLOWCARD_MANAGE,format = DataFormatEnum.JSON)
    public List<FlowCardDevice> getList(FlowCardDevice flowCardDevice){
        return this.flowCardDeviceFeign.getList(flowCardDevice);
    }

    @GetMapping(value = "/flowCardDevice/getOne")
    @Security(token = DeviceSecurityToken.DEVICE_FLOWCARD_MANAGE,format = DataFormatEnum.JSON)
    public FlowCardDevice getOne(FlowCardDevice flowCardDevice){
        return this.flowCardDeviceFeign.getOne(flowCardDevice);
    }

    @GetMapping(value = "/flowCardDevice/getDeviceByCardId")
    @Security(token = DeviceSecurityToken.DEVICE_FLOWCARD_MANAGE,format = DataFormatEnum.JSON)
    public ResultBean<Device> getDeviceByCardId(FlowCardDevice flowCardDevice){
        return this.flowCardDeviceFeign.getDeviceByCardId(flowCardDevice);
    }
}
