package dev.fyloz.trial.colorrecipesexplorer.xlsx.component.cells;

import dev.fyloz.trial.colorrecipesexplorer.xlsx.component.Document;
import dev.fyloz.trial.colorrecipesexplorer.xlsx.component.cells.styles.IBiggerCell;
import dev.fyloz.trial.colorrecipesexplorer.xlsx.component.cells.styles.IFontCell;
import org.apache.poi.ss.usermodel.CellType;

public class NoteCell extends Cell implements IBiggerCell, IFontCell {

    private String value;

    public NoteCell(String value) {
        super(CellType.STRING);

        this.value = value;
    }

    @Override
    public int getWidth() {
        return Document.WIDTH;
    }

    @Override
    public int getHeight() {
        return Math.max(Math.abs(value.length() / 100), 1);
    }

    @Override
    public boolean isBold() {
        return false;
    }

    @Override
    public String getContentText() {
        return value.replaceAll("(.{100})", "$1\n");
    }
}
