package com.caliverse.admin.dynamodb.entity;


import com.caliverse.admin.domain.entity.common.ValueEnum;
import com.fasterxml.jackson.annotation.JsonCreator;

public enum EAmountDeltaType implements ValueEnum {
    None(0),
    Acquire(1),
    Consume(2),
    Merge(3)
    ;

    private final int value;

    EAmountDeltaType(int value) {
        this.value = value;
    }

    @Override
    public int getValue() {
        return value;
    }

    @JsonCreator
    public static EAmountDeltaType fromValue(Object value) {
        if (value instanceof Number) {
            int intValue = ((Number) value).intValue();
            for (EAmountDeltaType type : values()) {
                if (type.value == intValue) {
                    return type;
                }
            }
        } else if (value instanceof String) {
            String stringValue = (String) value;
            for (EAmountDeltaType type : values()) {
                if (type.name().equalsIgnoreCase(stringValue)) {
                    return type;
                }
            }
        }
        throw new IllegalArgumentException("Invalid EAmountDeltaType value: " + value);
    }
}
