package net.vtstar.zhongtong.avi.ledlamp.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import net.vtstar.utils.domain.Return;
import net.vtstar.zhongtong.avi.ledlamp.domain.RoomInfo;
import net.vtstar.zhongtong.avi.ledlamp.domain.vo.LedStationVO;
import net.vtstar.zhongtong.avi.ledlamp.service.LedService;
import net.vtstar.zhongtong.avi.monitoring.domain.Warning;
import net.vtstar.zhongtong.avi.monitoring.domain.enums.StationState;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.util.ArrayList;

@Slf4j
@Api(description = "led大屏监控模块")
@RequestMapping("/api/led")
@RestController
public class LedController {

    @Autowired
    private LedService ledService;

    @ApiOperation(value = "工位级led大屏信息监控", response = LedStationVO.class)
    @GetMapping(value = "/ledInfo")
    private Return getLEDStationInfo(@RequestParam(value = "ledNo") String ledNo) {
        LedStationVO ledStationVO = new LedStationVO();
        ArrayList<Warning> warnings = new ArrayList<>();
        Warning warning = new Warning();
        warning.setInfo("报警信息1111111111111111111111111111111111111");
        warning.setName("报警1");
        Warning warning1 = new Warning();
        warning1.setInfo("报警信息2222222222222222222222222222222222222222222");
        warning1.setName("报警2");
        warnings.add(warning);
        warnings.add(warning1);

        ledStationVO.setBusIn(new BigDecimal(33));
        ledStationVO.setBusOut(new BigDecimal(44));
        ledStationVO.setWarningList(warnings);

        ArrayList<RoomInfo> roomInfos = new ArrayList<>();
        RoomInfo roomInfo = new RoomInfo();
        roomInfo.setName("喷漆室1");
        roomInfo.setStationState(StationState.USE);
        roomInfo.setWorkingHours(new BigDecimal(30));

        RoomInfo roomInfo2= new RoomInfo();
        roomInfo2.setName("喷漆室2");
        roomInfo2.setStationState(StationState.FREE);
        roomInfo2.setWorkingHours(new BigDecimal(22));

        roomInfos.add(roomInfo);
        roomInfos.add(roomInfo2);
        ledStationVO.setRoomInfoList(roomInfos);
        return Return.success(ledStationVO);
    }

}
