package com.jwipc.sys.controller.pc;

import com.jwipc.sys.dto.PrintTempBaseDTO;
import com.jwipc.sys.logic.PrintTempLogic;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import static com.jwipc.sys.constant.ModuleConst.MODULE_ROOT;

@RequestMapping(MODULE_ROOT + "/printTemp/page")
@RequiredArgsConstructor
@Controller
public class PrintTempPageController {
    private final PrintTempLogic printTempLogic;

    @GetMapping("index")
    public String index() {
        return MODULE_ROOT + "/printTemp/index";
    }

    @GetMapping("detail")
    public String detail(Long id, Model model) {
        PrintTempBaseDTO printTempBaseDTO = printTempLogic.getDetail(id);
        model.addAttribute("detail", printTempBaseDTO);
        return MODULE_ROOT + "/printTemp/detail";
    }

    @GetMapping("design")
    public String design(Long id, Model model) {
        PrintTempBaseDTO printTempBaseDTO = printTempLogic.getDetail(id);
        model.addAttribute("detail", printTempBaseDTO);
        return MODULE_ROOT + "/printTemp/design";
    }
}
