/*
 * The Hefei Ceshi RDC(Research and Development Centre) Group.
 * __________________
 *
 *    Copyright 2015-2019
 *    All Rights Reserved.
 *
 *    NOTICE:  All information contained herein is, and remains
 *    the property of Ceshi Company and its suppliers,
 *    if any.
 */

package com.jwipc.tender.controller.pc;

import com.jwipc.security.LoginUtil;
import com.jwipc.tender.constant.ModuleConst;
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.tender.constant.ModuleConst.MODULE_ROOT;

/**
 * <p> </p>
 *
 * @author BOGON
 * @version 1.0
 * @since JDK 1.8
 */
@Controller
@RequiredArgsConstructor
@RequestMapping(ModuleConst.MODULE_ROOT + "/question/page")
public class TenderQuestionPageController {

    /**
     * 投标答疑界面
     * @param tenderId 招标单id
     * @param type 类型0:采购;1:供应上
     * @param model
     * @return
     */
    @GetMapping("/index")
    public String index(Long tenderId, Integer type, Model model) {
        model.addAttribute("tenderId", tenderId);
        model.addAttribute("type", type);
        model.addAttribute("isSupplier", LoginUtil.isSupplier()?1:0);
        return MODULE_ROOT + "/question/index";
    }

    /**
     * 投标答疑详情页面
     * @param id 答疑主键
     * @param tenderId 招标单id
     * @param type 类型0:采购;1:供应上
     * @param readonly
     * @param model
     * @return
     */
    @GetMapping("/detail")
    public String detail(Long id,
                         Long tenderId,
                         Integer type,
                         Integer readonly,
                         Model model)
    {
        model.addAttribute("tenderId", tenderId);
        model.addAttribute("id", id);
        model.addAttribute("type", type);
        model.addAttribute("readonly", readonly);
        model.addAttribute("isSupplier", LoginUtil.isSupplier()?1:0);
        return MODULE_ROOT + "/question/detail";
    }
}
