package org.implab.gradle.variants.artifacts;

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

/**
 * Materialized outgoing publication state of a single slot.
 *
 * <p>This type is a DSL facade to represent already created publication-facing state. Slot-specific
 * publication tweaks should be applied here rather than through {@link OutgoingConfigurationSpec}, which
 * is limited to the root outgoing configuration of the variant.
 */
public interface OutgoingConfigurationSlotSpec {
    /**
     * Returns the published slot identity.
     *
     * @return slot identity
     */
    ArtifactSlot getArtifactSlot();

    /**
     * Returns whether this slot is the primary outgoing artifact set of the variant.
     *
     * @return {@code true} for the primary slot
     */
    boolean isPrimary();

    /**
     * Configures attributes of this slot publication.
     *
     * @param action artifact attribute configuration action
     */
    void artifactAttributes(Action<? super AttributeContainer> action);

    default void artifactAttributes(Closure<?> closure) {
        artifactAttributes(Closures.action(closure));
    }
}
