package cz.jzitnik.game.sprites;

import cz.jzitnik.tui.Sprite;

public class Air extends Sprite {
    public String getSprite() {
        return "";
    }

    public String getSprite(int daytime) {
        StringBuilder sprite = new StringBuilder();

        // Normalize daytime to a range of 0 to 1, where 300 is the darkest
        double normalized = Math.abs((daytime - 300) / 300.0);

        // Interpolate blue color intensity (darker at midday, brighter at
        // sunrise/sunset)
        int blue = (int) (255 * normalized);
        int red = (int) (121 * normalized);
        int green = (int) (166 * normalized);

        String colorCode = String.format("\033[48;2;%d;%d;%dm ", red, green, blue);

        for (int i = 0; i < 25; i++) {
            sprite.append(colorCode.repeat(50)).append("\n");
        }

        return sprite.toString();
    }

    public String getSprite(Enum e) {
        throw new RuntimeException("Imposible state");
    }
}
