package com.caliverse.admin.dynamodb.entity;

import java.util.Arrays;

public enum ELandAuctionState {

    NONE(0, "None"),
    WAITING(1, "Waiting"), // 대기
    SCHEDULED(2, "Scheduled"),  // 예약
    STARTED(3, "Started"),  // 시작
    ENDED(4, "Ended");  // 종료

    private final int value;
    private final String name;

    ELandAuctionState(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(ELandAuctionState::getValue)
                .orElse(NONE.value);
    }
}
