package com.tiedup.remake.v2.bondage;

import com.tiedup.remake.items.base.PoseType;
import com.tiedup.remake.v2.bondage.datadriven.DataDrivenItemDefinition;
import com.tiedup.remake.v2.bondage.datadriven.DataDrivenItemRegistry;
import net.minecraft.world.item.ItemStack;

/**
 * Resolves the {@link PoseType} for any bondage item stack.
 *
 * <p>Reads from the data-driven definition's {@code pose_type} field,
 * falling back to {@link PoseType#STANDARD} if absent.</p>
 */
public final class PoseTypeHelper {

    private PoseTypeHelper() {}

    public static PoseType getPoseType(ItemStack stack) {
        // V2: read from data-driven definition
        DataDrivenItemDefinition def = DataDrivenItemRegistry.get(stack);
        if (def != null && def.poseType() != null) {
            try {
                return PoseType.valueOf(def.poseType().toUpperCase());
            } catch (IllegalArgumentException e) {
                return PoseType.STANDARD;
            }
        }
        return PoseType.STANDARD;
    }
}
