package thb.jeanluc.adventure.model.item;

import lombok.Getter;
import lombok.experimental.SuperBuilder;
import thb.jeanluc.adventure.game.GameContext;

/**
 * Item that displays a piece of text when used or read. Typical examples
 * include letters, signs, and books.
 */
@Getter
@SuperBuilder
public class ReadableItem extends Item {

    /** Text written on the item; printed to the player on {@code use}/{@code read}. */
    private final String readText;

    /**
     * Writes the item's text to the player's output.
     *
     * @param ctx active game context
     */
    @Override
    public void use(GameContext ctx) {
        ctx.getIo().write(readText);
    }
}
