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.IColoredCell;
import dev.fyloz.trial.colorrecipesexplorer.xlsx.component.cells.styles.IFontCell;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.IndexedColors;

public class TitleCell extends Cell implements IColoredCell, IBiggerCell, IFontCell {

    private static final int WIDTH = Document.WIDTH;
    private static final int HEIGHT = 3;
    private static final CellType TYPE = CellType.STRING;
    private static final IndexedColors FONT_COLOR = IndexedColors.WHITE;
    private static IndexedColors BACKGROUND_COLOR = IndexedColors.BLACK;

    private String title;

    public TitleCell(String title) {
        super(TYPE);

        this.title = title;
    }

    @Override
    public IndexedColors getBackgroundColor() {
        return BACKGROUND_COLOR;
    }

    @Override
    public IndexedColors getFontColor() {
        return FONT_COLOR;
    }

    public Cell setColor(IndexedColors color) {
        BACKGROUND_COLOR = color;
        return this;
    }

    @Override
    public short getFontHeight() {
        return 36;
    }

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

    @Override
    public int getHeight() {
        return HEIGHT;
    }

    @Override
    public String getContentText() {
        return title;
    }
}
