package com.copy.trade.enums;

import java.util.Arrays;

import lombok.Getter;

@Getter
public enum MessageTypeEnum {
	OPEN_SUCCESS(1,"OPEN_SUCCESS","开仓成功"),
    OPEN_FAILURE(2,"OPEN_FAILURE","开仓失败"),
    CLOSE_SUCCESS(3,"CLOSE_SUCCESS","平仓成功"),
    FORCE_CLOSE(4,"FORCE_CLOSE","强平"),
    POSITION_PROFIT(5,"POSITION_PROFIT","仓位止盈"),
    POSITION_LOSS(6,"POSITION_LOSS","仓位止损"),
    ACCOUNT_PROFIT(7,"ACCOUNT_PROFIT","账户止盈"),
    ACCOUNT_LOSS(8,"ACCOUNT_LOSS","账户止损"),
    EMPTY_REMIND(9,"EMPTY_REMIND","空位提醒"),
    UNFOLLOW_REMIND(10,"UNFOLLOW_REMIND","停止跟随"),
    START_FOLLOW(11,"START_FOLLOW","开始跟随")
    ;

    private Integer type;
    private String typeStr;
    private String des;

    MessageTypeEnum(Integer type, String typeStr, String des) {
        this.type = type;
        this.typeStr = typeStr;
        this.des = des;
    }

    public static MessageTypeEnum getByTypeStr(String typeStr){
        return Arrays.asList(values()).stream()
                .filter(positionStatusEnum -> positionStatusEnum.getTypeStr().equals(typeStr))
                .findFirst()
                .orElse(null);
    }
}
