/*
 *   This file is a part of the SteamWar software.
 *
 *   Copyright (C) 2025 SteamWar.de-Serverteam
 *
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU Affero General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 *   GNU Affero General Public License for more details.
 *
 *   You should have received a copy of the GNU Affero General Public License
 *   along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */

package de.steamwar.bausystem.features.slaves.laufbau.boundingboxes;

import de.steamwar.bausystem.features.slaves.laufbau.BlockBoundingBox;
import de.steamwar.bausystem.features.slaves.laufbau.BoundingBoxLoader;
import de.steamwar.bausystem.features.slaves.laufbau.Cuboid;
import de.steamwar.linkage.Linked;
import org.bukkit.Material;
import org.bukkit.block.BlockFace;
import org.bukkit.block.data.type.AmethystCluster;

import java.util.ArrayList;
import java.util.List;

import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.createItem;
import static de.steamwar.bausystem.features.slaves.laufbau.LaufbauUtils.pixelCuboid;

@Linked
public class AmethystBoundingBox implements BoundingBoxLoader {

    @Override
    public void load() {
        floorSmallAmethystBud();
        ceilingSmallAmethystBud();
        northSmallAmethystBud();
        southSmallAmethystBud();
        eastSmallAmethystBud();
        westSmallAmethystBud();

        floorMediumAmethystBud();
        ceilingMediumAmethystBud();
        northMediumAmethystBud();
        southMediumAmethystBud();
        eastMediumAmethystBud();
        westMediumAmethystBud();

        floorLargeAmethystBud();
        ceilingLargeAmethystBud();
        northLargeAmethystBud();
        southLargeAmethystBud();
        eastLargeAmethystBud();
        westLargeAmethystBud();

        floorAmethystCluster();
        ceilingAmethystCluster();
        northAmethystCluster();
        southAmethystCluster();
        eastAmethystCluster();
        westAmethystCluster();
    }

    private void floorSmallAmethystBud() {
        AmethystCluster cluster = (AmethystCluster) Material.SMALL_AMETHYST_BUD.createBlockData();
        cluster.setFacing(BlockFace.UP);
        List<Cuboid> cuboidList = new ArrayList<>();
        cuboidList.add(pixelCuboid(4, 0, 4, 8, 3, 8));
        new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_SMALL_AMETHYST_BUD", Material.SMALL_AMETHYST_BUD, "LAUFBAU_FACING_UP"));
    }

    private void ceilingSmallAmethystBud() {
        AmethystCluster cluster = (AmethystCluster) Material.SMALL_AMETHYST_BUD.createBlockData();
        cluster.setFacing(BlockFace.DOWN);
        List<Cuboid> cuboidList = new ArrayList<>();
        cuboidList.add(pixelCuboid(4, 13, 4, 8, 3, 8));
        new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_SMALL_AMETHYST_BUD", Material.SMALL_AMETHYST_BUD, "LAUFBAU_FACING_DOWN"));
    }

    private void northSmallAmethystBud() {
        AmethystCluster cluster = (AmethystCluster) Material.SMALL_AMETHYST_BUD.createBlockData();
        cluster.setFacing(BlockFace.NORTH);
        List<Cuboid> cuboidList = new ArrayList<>();
        cuboidList.add(pixelCuboid(4, 4, 13, 8, 8, 3));
        new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_SMALL_AMETHYST_BUD", Material.SMALL_AMETHYST_BUD, "LAUFBAU_FACING_NORTH"));
    }

    private void southSmallAmethystBud() {
        AmethystCluster cluster = (AmethystCluster) Material.SMALL_AMETHYST_BUD.createBlockData();
        cluster.setFacing(BlockFace.SOUTH);
        List<Cuboid> cuboidList = new ArrayList<>();
        cuboidList.add(pixelCuboid(4, 4, 0, 8, 8, 3));
        new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_SMALL_AMETHYST_BUD", Material.SMALL_AMETHYST_BUD, "LAUFBAU_FACING_SOUTH"));
    }

    private void eastSmallAmethystBud() {
        AmethystCluster cluster = (AmethystCluster) Material.SMALL_AMETHYST_BUD.createBlockData();
        cluster.setFacing(BlockFace.EAST);
        List<Cuboid> cuboidList = new ArrayList<>();
        cuboidList.add(pixelCuboid(0, 4, 4, 3, 8, 8));
        new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_SMALL_AMETHYST_BUD", Material.SMALL_AMETHYST_BUD, "LAUFBAU_FACING_EAST"));
    }

    private void westSmallAmethystBud() {
        AmethystCluster cluster = (AmethystCluster) Material.SMALL_AMETHYST_BUD.createBlockData();
        cluster.setFacing(BlockFace.WEST);
        List<Cuboid> cuboidList = new ArrayList<>();
        cuboidList.add(pixelCuboid(13, 4, 4, 3, 8, 8));
        new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_SMALL_AMETHYST_BUD", Material.SMALL_AMETHYST_BUD, "LAUFBAU_FACING_WEST"));
    }

    private void floorMediumAmethystBud() {
        AmethystCluster cluster = (AmethystCluster) Material.MEDIUM_AMETHYST_BUD.createBlockData();
        cluster.setFacing(BlockFace.UP);
        List<Cuboid> cuboidList = new ArrayList<>();
        cuboidList.add(pixelCuboid(3, 0, 3, 10, 4, 10));
        new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_MEDIUM_AMETHYST_BUD", Material.MEDIUM_AMETHYST_BUD, "LAUFBAU_FACING_UP"));
    }

    private void ceilingMediumAmethystBud() {
        AmethystCluster cluster = (AmethystCluster) Material.MEDIUM_AMETHYST_BUD.createBlockData();
        cluster.setFacing(BlockFace.DOWN);
        List<Cuboid> cuboidList = new ArrayList<>();
        cuboidList.add(pixelCuboid(3, 12, 3, 10, 4, 10));
        new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_MEDIUM_AMETHYST_BUD", Material.MEDIUM_AMETHYST_BUD, "LAUFBAU_FACING_DOWN"));
    }

    private void northMediumAmethystBud() {
        AmethystCluster cluster = (AmethystCluster) Material.MEDIUM_AMETHYST_BUD.createBlockData();
        cluster.setFacing(BlockFace.NORTH);
        List<Cuboid> cuboidList = new ArrayList<>();
        cuboidList.add(pixelCuboid(3, 3, 12, 10, 10, 4));
        new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_MEDIUM_AMETHYST_BUD", Material.MEDIUM_AMETHYST_BUD, "LAUFBAU_FACING_NORTH"));
    }

    private void southMediumAmethystBud() {
        AmethystCluster cluster = (AmethystCluster) Material.MEDIUM_AMETHYST_BUD.createBlockData();
        cluster.setFacing(BlockFace.SOUTH);
        List<Cuboid> cuboidList = new ArrayList<>();
        cuboidList.add(pixelCuboid(3, 3, 0, 10, 10, 4));
        new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_MEDIUM_AMETHYST_BUD", Material.MEDIUM_AMETHYST_BUD, "LAUFBAU_FACING_SOUTH"));
    }

    private void eastMediumAmethystBud() {
        AmethystCluster cluster = (AmethystCluster) Material.MEDIUM_AMETHYST_BUD.createBlockData();
        cluster.setFacing(BlockFace.EAST);
        List<Cuboid> cuboidList = new ArrayList<>();
        cuboidList.add(pixelCuboid(0, 3, 3, 4, 10, 10));
        new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_MEDIUM_AMETHYST_BUD", Material.MEDIUM_AMETHYST_BUD, "LAUFBAU_FACING_EAST"));
    }

    private void westMediumAmethystBud() {
        AmethystCluster cluster = (AmethystCluster) Material.MEDIUM_AMETHYST_BUD.createBlockData();
        cluster.setFacing(BlockFace.WEST);
        List<Cuboid> cuboidList = new ArrayList<>();
        cuboidList.add(pixelCuboid(12, 3, 3, 4, 10, 10));
        new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_MEDIUM_AMETHYST_BUD", Material.MEDIUM_AMETHYST_BUD, "LAUFBAU_FACING_WEST"));
    }

    private void floorLargeAmethystBud() {
        AmethystCluster cluster = (AmethystCluster) Material.LARGE_AMETHYST_BUD.createBlockData();
        cluster.setFacing(BlockFace.UP);
        List<Cuboid> cuboidList = new ArrayList<>();
        cuboidList.add(pixelCuboid(3, 0, 3, 10, 5, 10));
        new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_LARGE_AMETHYST_BUD", Material.LARGE_AMETHYST_BUD, "LAUFBAU_FACING_UP"));
    }

    private void ceilingLargeAmethystBud() {
        AmethystCluster cluster = (AmethystCluster) Material.LARGE_AMETHYST_BUD.createBlockData();
        cluster.setFacing(BlockFace.DOWN);
        List<Cuboid> cuboidList = new ArrayList<>();
        cuboidList.add(pixelCuboid(3, 11, 3, 10, 5, 10));
        new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_LARGE_AMETHYST_BUD", Material.LARGE_AMETHYST_BUD, "LAUFBAU_FACING_DOWN"));
    }

    private void northLargeAmethystBud() {
        AmethystCluster cluster = (AmethystCluster) Material.LARGE_AMETHYST_BUD.createBlockData();
        cluster.setFacing(BlockFace.NORTH);
        List<Cuboid> cuboidList = new ArrayList<>();
        cuboidList.add(pixelCuboid(3, 3, 11, 10, 10, 5));
        new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_LARGE_AMETHYST_BUD", Material.LARGE_AMETHYST_BUD, "LAUFBAU_FACING_NORTH"));
    }

    private void southLargeAmethystBud() {
        AmethystCluster cluster = (AmethystCluster) Material.LARGE_AMETHYST_BUD.createBlockData();
        cluster.setFacing(BlockFace.SOUTH);
        List<Cuboid> cuboidList = new ArrayList<>();
        cuboidList.add(pixelCuboid(3, 3, 0, 10, 10, 5));
        new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_LARGE_AMETHYST_BUD", Material.LARGE_AMETHYST_BUD, "LAUFBAU_FACING_SOUTH"));
    }

    private void eastLargeAmethystBud() {
        AmethystCluster cluster = (AmethystCluster) Material.LARGE_AMETHYST_BUD.createBlockData();
        cluster.setFacing(BlockFace.EAST);
        List<Cuboid> cuboidList = new ArrayList<>();
        cuboidList.add(pixelCuboid(0, 3, 3, 5, 10, 10));
        new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_LARGE_AMETHYST_BUD", Material.LARGE_AMETHYST_BUD, "LAUFBAU_FACING_EAST"));
    }

    private void westLargeAmethystBud() {
        AmethystCluster cluster = (AmethystCluster) Material.LARGE_AMETHYST_BUD.createBlockData();
        cluster.setFacing(BlockFace.WEST);
        List<Cuboid> cuboidList = new ArrayList<>();
        cuboidList.add(pixelCuboid(11, 3, 3, 5, 10, 10));
        new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_LARGE_AMETHYST_BUD", Material.LARGE_AMETHYST_BUD, "LAUFBAU_FACING_WEST"));
    }

    private void floorAmethystCluster() {
        AmethystCluster cluster = (AmethystCluster) Material.AMETHYST_CLUSTER.createBlockData();
        cluster.setFacing(BlockFace.UP);
        List<Cuboid> cuboidList = new ArrayList<>();
        cuboidList.add(pixelCuboid(3, 0, 3, 10, 7, 10));
        new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_AMETHYST_CLUSTER", Material.AMETHYST_CLUSTER, "LAUFBAU_FACING_UP"));
    }

    private void ceilingAmethystCluster() {
        AmethystCluster cluster = (AmethystCluster) Material.AMETHYST_CLUSTER.createBlockData();
        cluster.setFacing(BlockFace.DOWN);
        List<Cuboid> cuboidList = new ArrayList<>();
        cuboidList.add(pixelCuboid(3, 9, 3, 10, 7, 10));
        new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_AMETHYST_CLUSTER", Material.AMETHYST_CLUSTER, "LAUFBAU_FACING_DOWN"));
    }

    private void northAmethystCluster() {
        AmethystCluster cluster = (AmethystCluster) Material.AMETHYST_CLUSTER.createBlockData();
        cluster.setFacing(BlockFace.NORTH);
        List<Cuboid> cuboidList = new ArrayList<>();
        cuboidList.add(pixelCuboid(3, 3, 9, 10, 10, 7));
        new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_AMETHYST_CLUSTER", Material.AMETHYST_CLUSTER, "LAUFBAU_FACING_NORTH"));
    }

    private void southAmethystCluster() {
        AmethystCluster cluster = (AmethystCluster) Material.AMETHYST_CLUSTER.createBlockData();
        cluster.setFacing(BlockFace.SOUTH);
        List<Cuboid> cuboidList = new ArrayList<>();
        cuboidList.add(pixelCuboid(3, 3, 0, 10, 10, 7));
        new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_AMETHYST_CLUSTER", Material.AMETHYST_CLUSTER, "LAUFBAU_FACING_SOUTH"));
    }

    private void eastAmethystCluster() {
        AmethystCluster cluster = (AmethystCluster) Material.AMETHYST_CLUSTER.createBlockData();
        cluster.setFacing(BlockFace.EAST);
        List<Cuboid> cuboidList = new ArrayList<>();
        cuboidList.add(pixelCuboid(0, 3, 3, 7, 10, 10));
        new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_AMETHYST_CLUSTER", Material.AMETHYST_CLUSTER, "LAUFBAU_FACING_EAST"));
    }

    private void westAmethystCluster() {
        AmethystCluster cluster = (AmethystCluster) Material.AMETHYST_CLUSTER.createBlockData();
        cluster.setFacing(BlockFace.WEST);
        List<Cuboid> cuboidList = new ArrayList<>();
        cuboidList.add(pixelCuboid(9, 3, 3, 7, 10, 10));
        new BlockBoundingBox(cluster, cuboidList, createItem("LAUFBAU_BLOCK_AMETHYST_CLUSTER", Material.AMETHYST_CLUSTER, "LAUFBAU_FACING_WEST"));
    }
}
