package com.copy.trade.enums;

import lombok.Getter;

import java.util.Arrays;

@Getter
public enum EntrustStatusEnum{

    ENTRUST_ING(0,"ENTRUST_ING","委托中"),
    ENTRUST_CANCEL(1,"ENTRUST_CANCEL","已撤单"),
    ENTRUST_FAILURE(2,"ENTRUST_FAILURE","委托失败"),
    ENTRUST_SUCCESS(3,"ENTRUST_SUCCESS","已成交"),
    ;

    private Integer status;
    private String statusStr;
    private String des;

    EntrustStatusEnum(Integer status, String statusStr, String des) {
        this.status = status;
        this.statusStr = statusStr;
        this.des = des;
    }

    public static EntrustStatusEnum getByStatusStr(String statusStr){
        return Arrays.asList(values())
                .stream()
                .filter(entrustStatusEnum -> entrustStatusEnum.statusStr.equals(statusStr))
                .findFirst()
                .orElse(null);
    }
}
