package cz.jzitnik.game.sprites;

import cz.jzitnik.tui.Sprite;

import java.util.HashMap;

public class Farmable extends Sprite<Farmable.FarmableState> {
    public Farmable(String first, String second, String third) {
        loadResources(new HashMap<>() {
            {
                put(FarmableState.FIRST, first);
                put(FarmableState.SECOND, second);
                put(FarmableState.THIRD, third);
            }
        }, FarmableState.class);
    }

    public enum FarmableState {
        FIRST,
        SECOND,
        THIRD
    }

    public String getSprite() {
        return getSprite(getState(0));
    }

    public String getSprite(FarmableState e) {
        return getResource(e);
    }

    public static FarmableState getState(int num) {
        return switch (num) {
            case 0 -> FarmableState.FIRST;
            case 1 -> FarmableState.SECOND;
            case 2 -> FarmableState.THIRD;
            default -> throw new IllegalStateException("Unexpected value: " + num);
        };
    }
}
