package com.interplug.qcast.biz.canvasGridSetting;

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

import lombok.RequiredArgsConstructor;

import java.util.HashMap;
import java.util.Map;

import org.springframework.stereotype.Service;

@Service
@RequiredArgsConstructor
public class CanvasGridSettingService {
	private final CanvasGridSettingMapper canvasGridSettingMapper;

	// Canvas Setting 조회(objectNo)
	public CanvasGridSettingInfo selectCanvasGridSetting(String objectNo) {
		return canvasGridSettingMapper.selectCanvasGridSetting(objectNo);
	}

	// Canvas Setting 등록
	public Map<String, String> insertCanvasGridSetting(CanvasGridSettingInfo csi) {
		
		Map<String, String> response = new HashMap<>();

		try { 
			canvasGridSettingMapper.insertCanvasGridSetting(csi);
			
			response.put("objectNo", csi.getObjectNo());
			response.put("returnMessage", "common.message.confirm.mark");
			
		} catch (Exception e) {
			response.put("objectNo", csi.getObjectNo());
			response.put("returnMessage", "common.message.save.error");
		}

		// 생성된 objectNo 반환
		return response;

	}

}
