package com.interplug.qcast.biz.roofmaterial;

import com.interplug.qcast.biz.roofmaterial.dto.RoofMaterialInfoResponse;
import com.interplug.qcast.biz.trestle.dto.TrestleInfoResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequiredArgsConstructor
@RequestMapping("/api/roof-material/roof-material-infos")
@Tag(name = "RoofMaterialInfoController", description = "지붕재 정보 API")
public class RoofMaterialInfoController {
  private final RoofMaterialInfoService roofMaterialInfoService;

  @Operation(description = "지붕재 목록들을 조회한다.")
  @GetMapping
  public List<RoofMaterialInfoResponse> getRoofMaterials() {
    return roofMaterialInfoService.getRoofMaterials();
  }

  @Operation(description = "지붕재ID에 따라 설치 가능한 가대 목록을 가져온다.")
  @GetMapping("/{roofMaterialId}/trestles")
  public List<TrestleInfoResponse> getTrestlesByRoofMaterialId(
      @PathVariable Integer roofMaterialId) {
    return roofMaterialInfoService.getTrestlesByRoofMaterialId(roofMaterialId);
  }
}
