package speiger.src.coreengine.platform.graphics.api.shader;

import java.util.Objects;
import java.util.Optional;

import speiger.src.coreengine.platform.graphics.api.shader.states.BlendFunction;

public record ColorTarget(Optional<BlendFunction> blend, int writeMask) {
    public static final int RED = 1;
    public static final int GREEN = 2;
    public static final int BLUE = 4;
    public static final int ALPHA = 8;
    public static final int ALL = 15;
	public static final ColorTarget DEFAULT = new ColorTarget(null);
    
	public ColorTarget {
		Objects.requireNonNull(blend);
		if(writeMask < 0 || writeMask > ALL) throw new IllegalArgumentException("WriteMask has to be within 0-15");
	}
	
	public ColorTarget(BlendFunction function) {
		this(Optional.ofNullable(function), ALL);
	}
}
