package com.uas.platform.b2b.erp.service;

import com.uas.platform.b2b.model.*;
import com.uas.platform.b2b.temporary.model.DecideTender;
import com.uas.platform.b2b.temporary.model.TenderContactInfo;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.ui.ModelMap;

import java.util.List;

/**
 * Created by dongbw on 17/03/07 14:15.
 */
public interface TenderService {

//    /**
//     * 保存招标单
//     *
//     * @param tender
//     * @return
//     */
//    ModelMap save(PurchaseTender tender, List<Long> vendUUs);
//
//    /**
//     * 发布招标单
//     *
//     * @param tender
//     * @return
//     */
//    ModelMap publish(PurchaseTender tender, List<Long> vendUUs);

    /**
     * 投标
     *
     *
     * @param saleTender
     * @param attaches
     * @return
     */
    ModelMap reply(SaleTender saleTender ,List<Attach> attaches);

    ModelMap reply(SaleTender saleTender);

    /**
     * 采购方定标操作
     *
     * @param saleTenderItems
     * @return
     */
    ModelMap decide(List<SaleTenderItem> saleTenderItems);

    /**
     * 根据id获取招标单
     *
     * @param bidId
     * @return
     */
    PurchaseTender findById(Long bidId);


//    ModelMap publishOpen(PurchaseTender purchaseTender);
//    /**
//     *  保存公开招标单
//     * @param purchaseTender
//     */
//    ModelMap saveOpen(PurchaseTender purchaseTender);

    Attach addTenderAttaches(FileUpload uploadItem) throws Exception;

    Attach addTenderItemAttaches(FileUpload uploadItem) throws Exception;

    /**
     *  获取最近指定招标
     *
     * @return
     */
    List<PurchaseTender> findAll();

    List<PurchaseTender> findOpen();

    /**
     *  删除指定id招标单
     * @param id
     */
    ModelMap delete(Long id);

    /**
     * 根据id删除单个附件
     *
     * @param attachId
     */
    ModelMap deleteAttach(Long attachId);

    ModelMap releaseByWorkbook(Workbook workbook);

    /**
     * 公开招标单转投标单操作
     *
     * @param id
     * @return
     */
    ModelMap addTenderItemById(Long id);

    /**
     *  删除产品明细
     * @param tenderProdId
     */
    ModelMap deleteProd(Long tenderProdId);

    /**
     * 删除对应供应商的
     * @param id
     * @param vendUU
     */
    ModelMap removeSaleTender(Long id, Long vendUU);

    /**
     *  审批招标单状态修改
     * @param id
     * @return
     */
    ModelMap auditPurchaseTender(Long id, Short auditStatus);

    /**
     * 审批投标单状态修改
     * @param id
     * @return
     */
    ModelMap auditSaleTender(Long id, Short auditStatus);

    /**
     * 获取投标单详情
     * @param id
     * @return
     */
    ModelMap getSaleTenderDetail(Long id);

    ModelMap publishOrSave(PurchaseTender purchaseTender, List<TenderContactInfo> contactInfos, List<Attach> tenderAttaches);


    /**
     *  发布已保存单据
     * @param purchaseTender
     * @param enInfos
     */
    ModelMap publishSaved(PurchaseTender purchaseTender, List<TenderContactInfo> enInfos);

    ModelMap publishSaved(PurchaseTender purchaseTender, List<TenderContactInfo> enInfos, List<Attach> attachList);

    /**
     *  发布已保存单据为公开招标
     * @param purchaseTender
     */
    ModelMap publishSavedOpen(PurchaseTender purchaseTender);

    ModelMap publishSavedOpen(PurchaseTender purchaseTender,  List<Attach> attachList);

    /**
     *  更新已保存单据
     * @param purchaseTender
     * @param enInfos
     */
    ModelMap updateSaved(PurchaseTender purchaseTender, List<TenderContactInfo> enInfos);

    ModelMap updateSaved(PurchaseTender purchaseTender, List<TenderContactInfo> enInfos, List<Attach> attachList);

    /**
     *  更新已保存单据为公开
     * @param purchaseTender
     */
    ModelMap updateSavedOpen(PurchaseTender purchaseTender);

    ModelMap updateSavedOpen(PurchaseTender purchaseTender, List<Attach> attachList);

    List<VendorContact> getVendContacts(Long enuu, Long venduu);

    /**
     * UAS发布招标单审核通过
     * @param id
     * @return
     */
    ModelMap publishTender(Long id);

    ModelMap decideInAdvance(Long id, Long date);

    ModelMap getSaleTenderVendors(Long id);

    ModelMap sendMobileMessage(Long id);

    ModelMap decideTenderAll(List<DecideTender> decideTenders);

    List<PurchaseTenderQuestion> getQuestionList(Long uu);

    SaleTenderQuestion getQuestionDetail(Long id);

    PurchaseTenderAnswer getThisQuestionAll(Long tenderId);

    ModelMap saveQuestionAnswer(PurchaseTenderAnswer answer);
}
