package com.interplug.qcast.biz.master;

import com.fasterxml.jackson.databind.JsonNode;
import com.interplug.qcast.biz.master.dto.*;
import com.interplug.qcast.biz.master.dto.construction.ApiConstructionResponse;
import com.interplug.qcast.biz.master.dto.moduletype.ApiModuleTpResponse;
import com.interplug.qcast.biz.master.dto.pcs.ApiPcsInfoRequest;
import com.interplug.qcast.biz.master.dto.pcs.autorecommend.ApiPcsAutoRecommendResponse;
import com.interplug.qcast.biz.master.dto.pcs.connoption.ApiPcsConnOptionRequest;
import com.interplug.qcast.biz.master.dto.pcs.connoption.ApiPcsConnOptionResponse;
import com.interplug.qcast.biz.master.dto.pcs.maker.ApiPcsMakerResponse;
import com.interplug.qcast.biz.master.dto.pcs.menualconf.ApiPcsMenualConfRequest;
import com.interplug.qcast.biz.master.dto.pcs.series.ApiPcsSeriesItemRequest;
import com.interplug.qcast.biz.master.dto.pcs.series.ApiPcsSeriesItemResponse;
import com.interplug.qcast.biz.master.dto.pcs.voltagestepup.ApiPcsVoltageStepUpResponse;
import com.interplug.qcast.biz.master.dto.roofmaterial.ApiRoofMaterialResponse;
import com.interplug.qcast.biz.master.dto.trestle.ApiTrestleResponse;
import com.interplug.qcast.biz.master.dto.trestle.detail.ApiTrestleDetailResponse;
import java.util.List;
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.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;

// @FeignClient(name = "master", url = "${feign.master.url}")
@FeignClient(name = "master", url = "${qsp.url}/api/master")
public interface MasterService {

  // 지붕재 목록 조회
  @GetMapping("/roofMaterialList")
  public ApiResponse<List<ApiRoofMaterialResponse>> getRoofMaterialList(
      @RequestHeader("Referer") String referer);

  // 모듈 타입별 아이템 목록 조회
  @GetMapping("/moduleTypeItemList")
  public ApiResponse<List<ApiModuleTpResponse>> getModuleTypeItemList(
      @RequestHeader("Referer") String referer,
      @RequestParam("arrRoofMatlCd") List<String> roofMaterialCd);

  // 가대 목록 조회
  @GetMapping("/trestle")
  public ApiResponse<List<ApiTrestleResponse>> getTrestleList(
      @RequestHeader("Referer") String referer,
      @RequestParam(required = false) String moduleTpCd,
      @RequestParam(required = false) String roofMatlCd,
      @RequestParam(required = false) String raftBaseCd,
      @RequestParam(required = false) String trestleMkrCd,
      @RequestParam(required = false) String constMthdCd,
      @RequestParam(required = false) String roofBaseCd);

  // 시공법 목록 조회
  @GetMapping("/construction")
  public ApiResponse<List<ApiConstructionResponse>> getConstructionList(
      @RequestHeader("Referer") String referer,
      @RequestParam String moduleTpCd,
      @RequestParam String roofMatlCd,
      @RequestParam String trestleMkrCd,
      @RequestParam String constMthdCd,
      @RequestParam String roofBaseCd,
      @RequestParam String illuminationTp,
      @RequestParam String instHt,
      @RequestParam String stdWindSpeed,
      @RequestParam String stdSnowLd,
      @RequestParam String inclCd,
      @RequestParam(required = false) String raftBaseCd,
      @RequestParam(required = false) Integer roofPitch);

  // 가대 상세 조회
  @GetMapping(value = "/trestle/detail", consumes = "application/json")
  public ApiResponse<ApiTrestleDetailResponse> getTrestleDetailList(
      @RequestHeader("Referer") String referer,
      @RequestParam String moduleTpCd,
      @RequestParam String roofMatlCd,
      @RequestParam String trestleMkrCd,
      @RequestParam String constMthdCd,
      @RequestParam String roofBaseCd,
      @RequestParam String illuminationTp,
      @RequestParam String instHt,
      @RequestParam String stdWindSpeed,
      @RequestParam String stdSnowLd,
      @RequestParam String inclCd,
      @RequestParam String constTp,
      @RequestParam(required = false) Integer mixMatlNo,
      @RequestParam(required = false) Integer roofPitch,
      @RequestParam(required = false) String workingWidth);

  // PCS Maker, 시리즈 목록 조회
  @GetMapping("/pcsMakerList")
  public ApiResponse<List<ApiPcsMakerResponse>> getPcsMakerList(
      @RequestHeader("Referer") String referer,
      @RequestParam(required = false) String pcsMkrCd,
      @RequestParam(required = false) String mixMatlNo);

  // PCS 시리즈 아이템 목록 조회
  @PostMapping("/pcsSeriesItemList")
  public ApiResponse<List<ApiPcsSeriesItemResponse>> getPcsSeriesItemList(
      @RequestHeader("Referer") String referer, @RequestBody ApiPcsSeriesItemRequest req);

  // 시리즈 중 자동으로 추천 PCS 정보 조회
  @PostMapping("/pcsAutoRecommendList")
  public ApiResponse<ApiPcsAutoRecommendResponse> getPcsAutoRecommendList(
      @RequestHeader("Referer") String referer, @RequestBody ApiPcsInfoRequest req);

  // 배치된 모듈을 선택한 PCS로 회로 구성 가능 여부 체크
  @PostMapping("/pcsVoltageChk")
  public ApiResponse<JsonNode> getPcsVoltageChk(
      @RequestHeader("Referer") String referer, @RequestBody ApiPcsInfoRequest req);

  // PCS 승압설정 정보 조회
  @PostMapping("/pcsVoltageStepUpList")
  public ApiResponse<ApiPcsVoltageStepUpResponse> getPcsVoltageStepUpList(
      @RequestHeader("Referer") String referer, @RequestBody ApiPcsInfoRequest req);

  // PCS 수동회로 확정 체크
  @PostMapping("/pcsMenualConfChk")
  public ApiResponse<JsonNode> getPcsMenualConfChk(
      @RequestHeader("Referer") String referer, @RequestBody ApiPcsMenualConfRequest req);

  // PCS 접속함 및 옵션 목록 조회
  @PostMapping("/pcsConnOptionItemList")
  public ApiResponse<ApiPcsConnOptionResponse> getPcsConnOptionItemList(
      @RequestHeader("Referer") String referer, @RequestBody ApiPcsConnOptionRequest req);
}
