package com.tiedup.remake.cells;

/**
 * State of a Cell System V2 cell.
 *
 * INTACT     — all walls present, fully operational.
 * BREACHED   — some walls broken, prisoners may escape.
 * COMPROMISED — Core destroyed or too many walls broken; cell is non-functional.
 */
public enum CellState {
    INTACT("intact"),
    BREACHED("breached"),
    COMPROMISED("compromised");

    private final String serializedName;

    CellState(String serializedName) {
        this.serializedName = serializedName;
    }

    public String getSerializedName() {
        return serializedName;
    }

    public static CellState fromString(String name) {
        for (CellState state : values()) {
            if (state.serializedName.equalsIgnoreCase(name)) {
                return state;
            }
        }
        return INTACT;
    }
}
