package com.caliverse.admin.dynamodb.entity;

import java.util.Arrays;

public enum ELandAuctionResult {

    NONE(0, "None"),
    SUCCESSED(1, "Successed"), // 낙찰
    FAILED(2, "Failed"),  // 유찰
    CANCELED(3, "Canceled"); // 취소(비정상종료)

    private final int value;
    private final String name;

    ELandAuctionResult(int value, String name) {
        this.value = value;
        this.name = name;
    }

    public int getValue() {
        return value;
    }

    public String getName() {
        return name;
    }

    public static int getValueByName(String name) {
        return Arrays.stream(values())
                .filter(type -> type.name.equalsIgnoreCase(name))
                .findFirst()
                .map(ELandAuctionResult::getValue)
                .orElse(NONE.value);
    }
}
