package com.tiedup.remake.v2.bondage.component;

import com.google.gson.JsonObject;
import org.jetbrains.annotations.Nullable;

/**
 * Component: blinding effect for data-driven items.
 * Replaces IHasBlindingEffect marker interface.
 *
 * JSON config:
 * {@code "blinding": {}} or {@code "blinding": {"overlay": "tiedup:textures/overlay/custom.png"}}
 */
public class BlindingComponent implements IItemComponent {

    private final String overlay; // nullable — null means default overlay

    private BlindingComponent(String overlay) {
        this.overlay = overlay;
    }

    public static IItemComponent fromJson(JsonObject config) {
        String overlay = null;
        if (config != null && config.has("overlay")) {
            overlay = config.get("overlay").getAsString();
        }
        return new BlindingComponent(overlay);
    }

    /**
     * Custom overlay texture path, or null for the mod's default blindfold overlay.
     */
    @Nullable
    public String getOverlay() {
        return overlay;
    }
}
