package com.interplug.qcast.biz.canvasGridSetting;

import com.interplug.qcast.biz.canvasGridSetting.dto.CanvasGridSettingInfo;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

import java.util.Map;

import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("/api/canvas-management")
@RequiredArgsConstructor
@Tag(name = "CanvasGridSettingController", description = "Canvas Grid Setting 관련 API")
public class CanvasGridSettingController {
  private final CanvasGridSettingService canvasGridSettingService;
  
  @Operation(description = "Canvas Grid Setting 정보를 조회 한다.")
  @GetMapping("/canvas-grid-settings/by-object/{objectNo}")
  public CanvasGridSettingInfo selectCanvasGridSetting(@PathVariable String objectNo) {
	  	  
	  log.debug("Grid Setting 조회 ::::: " + objectNo);
	  
	  return canvasGridSettingService.selectCanvasGridSetting(objectNo);
  }
  
  @Operation(description = "Canvas Grid Setting 정보를 등록 한다.")
  @PostMapping("/canvas-grid-settings")
  @ResponseStatus(HttpStatus.CREATED)
  public Map<String, String> insertCanvasGridStatus(@RequestBody CanvasGridSettingInfo csi) {
	  
	  log.debug("Grid Setting 등록 ::::: " + csi.getObjectNo());
	  
      return canvasGridSettingService.insertCanvasGridSetting(csi);
  }
  
}
