/*
 *   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.schematicsystem.autocheck;

import com.sk89q.worldedit.extent.clipboard.Clipboard;
import de.steamwar.core.VersionDependent;
import de.steamwar.schematicsystem.CheckSchemType;
import de.steamwar.schematicsystem.SchematicSystem;
import lombok.Getter;
import lombok.ToString;
import org.bukkit.Material;

import java.util.*;

public class AutoChecker {

    public static AutoCheckerResult check(Clipboard clipboard, CheckSchemType type) {
        return impl.check(clipboard, type);
    }

    public static AutoCheckerResult sizeCheck(Clipboard clipboard, CheckSchemType type) {
        return impl.sizeCheck(clipboard, type);
    }

    private static final IAutoChecker impl = VersionDependent.getVersionImpl(SchematicSystem.getInstance());

    public interface IAutoChecker {
        AutoCheckerResult check(Clipboard clipboard, CheckSchemType type);
        AutoCheckerResult sizeCheck(Clipboard clipboard, CheckSchemType type);
    }

    @Getter
    @ToString
    public static class BlockScanResult {
        private final Map<Material, Integer> blockCounts = new EnumMap<>(Material.class);
        private final List<BlockPos> defunctNbt = new ArrayList<>();
        private final List<BlockPos> records = new ArrayList<>();
        private final Map<Material, List<BlockPos>> designBlocks = new EnumMap<>(Material.class);
        private final Map<BlockPos, Integer> dispenserItems = new HashMap<>();
        private final Map<BlockPos, Set<Material>> forbiddenItems = new HashMap<>();
        private final Map<BlockPos, Set<Material>> forbiddenNbt = new HashMap<>();
    }
}
