package com.livingworld.modules.worldeffects;

import com.livingworld.regions.RegionCoordinate;

/**
 * An immutable request for a visible world change in a specific region.
 *
 * <p>Generated by {@link WorldEffectsModule} and delivered to registered
 * {@link WorldEffectConsumer}s. The platform layer (NeoForge adapter) is
 * responsible for translating the request into actual block operations on
 * loaded chunks.
 *
 * @param type       the category of effect to apply
 * @param region     the region in which the effect should be applied
 * @param intensity  how strongly to apply the effect (0.0 = minimal, 1.0 = full)
 */
public record WorldEffectRequest(
        WorldEffectType type,
        RegionCoordinate region,
        double intensity) {

    public WorldEffectRequest {
        if (type == null)   throw new IllegalArgumentException("type must not be null");
        if (region == null) throw new IllegalArgumentException("region must not be null");
        if (intensity < 0.0 || intensity > 1.0) {
            throw new IllegalArgumentException(
                    "intensity must be in [0.0, 1.0], got: " + intensity);
        }
    }
}
