package org.implab.gradle.variants.artifacts;

import org.gradle.api.Action;
import groovy.lang.Closure;
import org.implab.gradle.common.core.lang.Closures;

/**
 * DSL model for declaring slots of a single variant.
 *
 * <p>The surrounding variant defines the external outgoing contract. Slots declared here define artifact
 * sets within that contract. If a variant exposes more than one slot, one of them is expected to be the
 * primary slot.
 */
public interface VariantArtifactsSpec {
    /**
     * Declares a non-primary slot of the current variant.
     *
     * @param name slot name
     * @param action slot declaration
     * @return slot identity
     */
    void slot(String name, Action<? super ArtifactAssemblySpec> action);

    default void slot(String name, Closure<?> closure) {
        slot(name, Closures.action(closure));
    }

    /**
     * Declares the primary slot of the current variant.
     *
     * @param name slot name
     * @param action slot declaration
     * @return slot identity
     */
    void primarySlot(String name, Action<? super ArtifactAssemblySpec> action);

    default void primarySlot(String name, Closure<?> closure) {
        primarySlot(name, Closures.action(closure));
    }
}
