package com.knecon.fforesight.service.layoutparser.processor.model;

import java.util.HashSet;
import java.util.Set;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.knecon.fforesight.service.layoutparser.internal.api.data.redaction.LayoutEngineProto.LayoutEngine;
import com.knecon.fforesight.service.layoutparser.processor.docstrum.model.BoundingBox;
import com.knecon.fforesight.service.layoutparser.processor.model.text.TextPageBlock;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public abstract class AbstractPageBlock extends BoundingBox {

    @JsonIgnore
    protected PageBlockType classification;

    Set<LayoutEngine> engines = new HashSet<>();

    @JsonIgnore
    protected int page;

    @JsonIgnore
    private Orientation orientation = Orientation.NONE;


    public abstract String getText();


    public boolean isHeadline() {

        return this instanceof TextPageBlock && this.getClassification() != null && this.getClassification().isHeadline();
    }


    public abstract boolean isEmpty();

}
