package com.mineplex.studio.cache;

import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;

public final class BlockBehaviourCache {
    private final boolean solidRender;
    private final boolean propagatesSkylightDown;
    private final int lightBlock;
    private final boolean largeCollisionShape;
    private final boolean[] faceSturdy;
    private final boolean isCollisionShapeFullBlock;

    public BlockBehaviourCache(
            boolean solidRender,
            boolean propagatesSkylightDown,
            int lightBlock,
            boolean largeCollisionShape,
            boolean[] faceSturdy,
            boolean isCollisionShapeFullBlock) {
        this.solidRender = solidRender;
        this.propagatesSkylightDown = propagatesSkylightDown;
        this.lightBlock = lightBlock;
        this.largeCollisionShape = largeCollisionShape;
        this.faceSturdy = faceSturdy;
        this.isCollisionShapeFullBlock = isCollisionShapeFullBlock;
    }

    public boolean isSolidRender() {
        return this.solidRender;
    }

    public boolean isPropagatesSkylightDown() {
        return this.propagatesSkylightDown;
    }

    public int getLightBlock() {
        return this.lightBlock;
    }

    public boolean isLargeCollisionShape() {
        return this.largeCollisionShape;
    }

    public boolean[] getFaceSturdy() {
        return this.faceSturdy;
    }

    public boolean isCollisionShapeFullBlock() {
        return this.isCollisionShapeFullBlock;
    }

    @Override
    public String toString() {
        return MoreObjects.toStringHelper(this)
                .add("solidRender", solidRender)
                .add("propagatesSkylightDown", propagatesSkylightDown)
                .add("lightBlock", lightBlock)
                .add("largeCollisionShape", largeCollisionShape)
                .add("faceSturdy", faceSturdy)
                .add("isCollisionShapeFullBlock", isCollisionShapeFullBlock)
                .toString();
    }

    @Override
    public boolean equals(Object o) {
        if (!(o instanceof BlockBehaviourCache that)) return false;
        return isSolidRender() == that.isSolidRender()
                && isPropagatesSkylightDown() == that.isPropagatesSkylightDown()
                && getLightBlock() == that.getLightBlock()
                && isLargeCollisionShape() == that.isLargeCollisionShape()
                && isCollisionShapeFullBlock() == that.isCollisionShapeFullBlock()
                && Objects.equal(getFaceSturdy(), that.getFaceSturdy());
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(
                isSolidRender(),
                isPropagatesSkylightDown(),
                getLightBlock(),
                isLargeCollisionShape(),
                getFaceSturdy(),
                isCollisionShapeFullBlock());
    }
}
