package cn.iocoder.yudao.module.asset.enums.contract;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * 合同状态枚举
 *
 * @author 芋道源码
 */
@Getter
@AllArgsConstructor
public enum ContractStatusEnum {

    DRAFT(0, "草稿"),
    PENDING(1, "待生效"),
    IN_PROGRESS(2, "进行中"),
    EXPIRED(3, "已到期"),
    TERMINATED(4, "已终止"),
    RENEWED(5, "已续签");

    /**
     * 状态
     */
    private final Integer status;
    /**
     * 名称
     */
    private final String name;

    public static ContractStatusEnum valueOf(Integer status) {
        return Arrays.stream(values())
                .filter(item -> item.getStatus().equals(status))
                .findFirst()
                .orElse(null);
    }

}
