package com.pusong.business.enums;

import com.pusong.common.core.utils.StringUtils;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

@Getter
@AllArgsConstructor
public enum ContractStatusEnum {
    INIT("10","暂存"),
    CREATE("20","生成成功（待回款）"),
    RETURN("30","已回款(待派单处理)"),
    UPDATEAPPROVER("33","修改审批中"),
    EXECUTION("40","已派单（处理中）"),
    SUCCESS("50","已完成（任务已全部完成+回款全部完成+合同已回传）");
    private String code;
    private String text;

    /**
     * 返回已回款之后的状态
     * @return
     */
    public static List<String> getReturn(){
        return List.of(RETURN.code, UPDATEAPPROVER.code,EXECUTION.code,SUCCESS.code);
    }

    /**
     * 判断是否为已回款之后的合同
     * @param code
     * @return
     */
    public static boolean isReturn(String code){
        List<String> list = getReturn();
        if(StringUtils.isNotBlank(code) && list.contains(code)){
            return true;
        }
        return false;
    }

    /**
     * 返回无效合同集合
     * @return
     */
    public static  List<String> isValid(){
        return List.of(INIT.code);
    }
}
