package com.its.api.bis.controller;

import com.its.api.bis.model.dto.BitDto;
import com.its.api.bis.service.BisProcessService;
import com.its.api.bis.service.BitService;
import com.its.api.its.model.dto.common.FcltSttsDto;
import com.its.api.its.model.dto.common.FcltSttsListDto;
import com.its.api.its.model.dto.common.FcltSttsSummaryDto;
import com.its.api.its.model.dto.common.SttsCommErrDto;
import com.its.api.its.model.dto.unit.TbUnitSystSttsDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "91.BIS")
@Validated
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/bis")
public class BisController {

    private final BisProcessService bisService;
    private final BitService bitService;

    @ApiOperation(value = "BIT 정보조회(목록)", response = BitDto.class, responseContainer = "ArrayList")
    @GetMapping(value = "/bit", produces = {"application/json; charset=utf8"})
    public List<BitDto> findAllBitList() {
        return bitService.findAllList();
    }

    @ApiOperation(value = "BIT 상태현황(Summary)", response = FcltSttsSummaryDto.class, responseContainer = "ArrayList")
    @GetMapping(value = "/stts/bit/summary", produces = {"application/json; charset=utf8"})
    public FcltSttsSummaryDto findAllRseSttsSummary() {
        return this.bitService.findAllSttsSummary();
    }

    @ApiOperation(value = "BIT 상태현황(Summary+List)", response = FcltSttsListDto.class, responseContainer = "ArrayList")
    @GetMapping(value = "/stts/bit/total", produces = {"application/json; charset=utf8"})
    public FcltSttsListDto findAllBitSttsTotal() {
        return this.bitService.findAllListSttsTotal();
    }

    @ApiOperation(value = "BIT 통신상태(장애)", response = SttsCommErrDto.class, responseContainer = "ArrayList")
    @GetMapping(value = "/stts/bit/error", produces = {"application/json; charset=utf8"})
    public List<SttsCommErrDto> findAllBitCommError() {
        return this.bitService.findAllListCommError();
    }

    @ApiOperation(value = "BIT 상태현황(List)", response = FcltSttsDto.class, responseContainer = "ArrayList")
    @GetMapping(value = "/stts/bit", produces = {"application/json; charset=utf8"})
    public List<FcltSttsDto> findAllBitListCommStts() {
        return this.bitService.findAllListCommStts();
    }

    @ApiOperation(value = "BIS 프로세스 상태", response = TbUnitSystSttsDto.class, responseContainer = "ArrayList")
    @GetMapping(value = "/stts/process", produces = {"application/json; charset=utf8"})
    public List<TbUnitSystSttsDto> findAllBisProcessStts() {
        return this.bisService.findAllStts();
    }

}
