package com.jwipc.supplier.controller.pc;

import com.jwipc.supplier.dto.SupplierInvitationSaveDTO;
import com.jwipc.supplier.logic.SupplierInvitationLogic;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
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 org.springframework.web.bind.annotation.RequestParam;

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

/**
 * <p> </p>
 *
 * @author ZhangJie
 * @version 1.0
 * @since JDK 1.8
 */
@Controller
@RequestMapping(MODULE_ROOT + "/invitation/page")
@RequiredArgsConstructor
@Slf4j
public class SupplierInvitationPageController {
    private final SupplierInvitationLogic supplierInvitationLogic;

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

    @GetMapping("detail")
    public String detail(Model model, @RequestParam(required = false, defaultValue = "0") Long id)
    {
        SupplierInvitationSaveDTO invitationBaseDTO = supplierInvitationLogic.getDetail(id);
        model.addAttribute("supplierInvitation", invitationBaseDTO);
        return MODULE_ROOT + "/invitation/detail";
    }

    @GetMapping("updateReviewMethod")
    public String updateReviewMethod(Model model, @RequestParam(required = false, defaultValue = "0") Long id)
    {
        model.addAttribute("Id", id);
        return MODULE_ROOT + "/invitation/update_review_method";
    }
}
