package com.caliverse.admin.dynamodb.entity;


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

public enum EntityStateType implements ValueEnum {
    None(0),
    Created(1),
    Initializing(2),
    Loading(3),
    Login(11),
    Logout(111),
    GameZoneEnter(15),
    PlayReady(16),
    Spawning(17),
    SpawnedCutScene(18),
    Alive(51),
    Idle(511),
    Think(512),
    Move(513),
    Roam(5131),
    Walk(5132),
    Run(5133),
    Patrol(5134),
    Chase(5135),
    Dash(5136),
    GoHome(5137),
    Dancing(5138),
    Battle(514),
    SkillFire(5141),
    Uncontrol(515),
    Hide(516),
    Pause(519),
    Dead(61),
    Revive(611),
    GameZoneExit(99),
    Activate(101),
    Deactivate(102),
    Drop(201),
    UsingByCrafting(301),
    UsingByFarming(302),
    UsingByMyHome(303)
    ;

    private final int value;

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

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

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

}
