/*
 *  Copyright 2025-2026 R3944Realms
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */

package top.r3944realms.eroticdungeongame.content.block.type;

import net.minecraft.core.Direction;
import net.minecraft.world.level.block.state.properties.WoodType;
import net.minecraft.world.phys.shapes.VoxelShape;
import top.r3944realms.eroticdungeongame.content.block.IWoodTypeBlock;
import top.r3944realms.eroticdungeongame.content.block.multiply.horizontal.HorizontalTriplePlankSeatBlock;
import top.r3944realms.eroticdungeongame.content.block.part.AdvanceSeatPart;
import top.r3944realms.lib39.util.shape.ShapeUtil;

import java.util.EnumMap;
import java.util.Map;

public class WallRackBlock extends HorizontalTriplePlankSeatBlock implements IWoodTypeBlock {
    private final WoodType woodType;

    public WallRackBlock(WoodType woodType) {
        super(PROPERTIES);
        this.woodType = woodType;
    }

    @Override
    public void setupShape() {
        VoxelShape right = ShapeUtil.builder()
                .addPixelBox(12, 3, 14.650000000000004, 16, 10, 15.650000000000004)
                .addPixelBox(11, 2, 15, 16, 11, 16)
                .build();
        VoxelShape middle = ShapeUtil.builder()
                .addShape(
                      ShapeUtil.builder()
                              .addPixelBox(0, 3, 14.650000000000004, 3, 10, 15.650000000000004)
                              .addPixelBox(4, 4, 15, 12, 10, 16)
                              .addPixelBox(13, 3, 14.650000000000004, 16, 10, 15.650000000000004)
                              .build()
                )
                .addShape(
                        ShapeUtil.builder()
                                .addPixelBox(12, 2, 15, 16, 11, 16)
                                .addPixelBox(0, 2, 15, 4, 11, 16)
                                .build()
                )
                .addShape(
                        ShapeUtil.builder()
                                .addPixelBox(5, 8.475, 14.75, 6, 9.475, 15)
                                .addPixelBox(5, 4.475, 14.75, 6, 5.475, 15)
                                .addPixelBox(10, 8.475, 14.75, 11, 9.475, 15)
                                .addPixelBox(10, 4.475, 14.75, 11, 5.475, 15)
                                .build()
                )
                .build();
        VoxelShape left = ShapeUtil.builder()
                .addPixelBox(0, 3, 14.650000000000004, 4, 10, 15.650000000000004)
                .addPixelBox(0, 2, 15, 5, 11, 16)
                .addPixelBox(0, 4, 15, 4, 9, 16)
                .build();
        EnumMap<AdvanceSeatPart, Map<Direction, VoxelShape>> shapes = new EnumMap<>(AdvanceSeatPart.class);
        shapes.put(AdvanceSeatPart.HEAD, ShapeUtil.createUniformDirectionMap(left));
        shapes.put(AdvanceSeatPart.MIDDLE, ShapeUtil.createUniformDirectionMap(middle));
        shapes.put(AdvanceSeatPart.FOOT, ShapeUtil.createUniformDirectionMap(right));
        setPartMap(shapes);
    }

    @Override
    public WoodType getWoodType() {
        return woodType;
    }

}
