package com.ruoyi.project.business.enums;

import java.util.Arrays;
import java.util.Optional;
import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum QuotationStatusEnum {
    DRAFT("草稿", "0"),
    REVIEWING("技术评审中", "1"),
    REVIEW_REJECT("技术评审不通过", "2"),
//    BUYER("采购报价中", "3"),  此阶段已放到技术评审
    TREASURE("财务报价中", "4"),
    SALES("销售确认中", "5"),
    ALREADY_BID("已出价", "6"),
    BARGAIN_APPROVAL("议价审批中", "7"),
    BARGAIN_CONFIRM("议价确认中", "8"),
    ACCEPT_PRICE("已接受价格", "9"),
    BARGAIN_REJECT("议价驳回", "10"),
    SIGNED_CONTRACT("已签订合同", "11"),
    UNKNOWN("未知", "99"),
    ;

    private String name;

    private String code;

    public static QuotationStatusEnum getByCode(String code) {
        Optional<QuotationStatusEnum> any = Arrays.stream(QuotationStatusEnum.values())
            .filter(a -> a.getCode().equals(code)).findAny();
        return any.orElse(UNKNOWN);
    }


}
