package com.interplug.qcast.biz.canvasBasicSetting;

import com.interplug.qcast.biz.canvasBasicSetting.dto.CanvasBasicSettingInfo;
import com.interplug.qcast.biz.canvasBasicSetting.dto.CanvasBasicSettingResponse;

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.List;
import java.util.Map;

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

@Slf4j
@RestController
@RequestMapping("/api/canvas-management")
@RequiredArgsConstructor
@Tag(name = "CanvasBasicSettingController", description = "Canvas Basic Setting 관련 API")
public class CanvasBasicSettingController {
  private final CanvasBasicSettingService canvasBasicSettingService;
  
  @Operation(description = "Canvas Basic Setting 정보를 조회 한다.")
  @GetMapping("/canvas-basic-settings/by-object/{objectNo}")
  public List<CanvasBasicSettingResponse> selectCanvasBasicSetting(@PathVariable String objectNo) {
	  	  
	  log.debug("Basic Setting 조회 ::::: " + objectNo);
	  
	  return canvasBasicSettingService.selectCanvasBasicSetting(objectNo);
  }
  
  @Operation(description = "Canvas Basic Setting 정보를 등록 한다.")
  @PostMapping("/canvas-basic-settings")
  @ResponseStatus(HttpStatus.CREATED)
  public  Map<String, String> insertCanvasBasicSetting(@RequestBody CanvasBasicSettingInfo csi) {
	  
	  log.debug("Basic Setting 등록 ::::: " + csi.getObjectNo());
	  
      return canvasBasicSettingService.insertCanvasBasicSetting(csi);
  }
  
}
