package com.iqser.red.service.persistence.service.v1.api.shared.model.redactionlog.section;

import com.iqser.red.service.persistence.service.v1.api.shared.model.redactionlog.Point;
import com.iqser.red.service.persistence.service.v1.api.shared.model.redactionlog.Rectangle;

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

@Data
@NoArgsConstructor
@Deprecated(forRemoval = true)
@AllArgsConstructor
public class SectionArea {

    private Point topLeft;
    private float width;
    private float height;
    private int page;
    private String header;


    public boolean contains(Rectangle other) {

        return page == other.getPage() && this.topLeft.getX() <= other.getTopLeft().getX() && this.topLeft.getX() + this.getWidth() >= other.getTopLeft()
                .getX() + other.getWidth() && this.getTopLeft().getY() <= other.getTopLeft().getY() && this.getTopLeft().getY() + this.getHeight() >= other.getTopLeft()
                .getY() + other.getHeight();
    }


    // TODO we should only use one rectangle class.
    public boolean contains(com.iqser.red.service.persistence.service.v1.api.shared.model.annotations.Rectangle other) {

        return page == other.getPage() && this.topLeft.getX() <= other.getTopLeftX() && this.topLeft.getX() + this.getWidth() >= other.getTopLeftX() + other.getWidth() && this.getTopLeft()
                .getY() <= other.getTopLeftY() && this.getTopLeft().getY() + this.getHeight() >= other.getTopLeftY() + other.getHeight();
    }

}
