package com.copy.trade.enums;

import lombok.Getter;

import java.util.Arrays;

@Getter
public enum PositionStatusEnum {
    STARTED(10,"STARTED","未平仓"),
    PARTLYDONE(20,"PARTLYDONE","部分平仓"),
    DONE(30,"DONE","全部平仓"),
    ;

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

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

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