package org.implab.gradle.variants.artifacts;

import java.util.Optional;
import java.util.Set;

import org.implab.gradle.variants.core.Variant;

/**
 * Finalized view of artifact slot identities.
 *
 * <p>This view exposes only cheap slot identities. Assemblies and publication state are resolved
 * separately.
 */
public interface ArtifactSlotsView {
    /**
     * Returns all declared slot identities.
     *
     * @return all slots known to the finalized model
     */
    Set<ArtifactSlot> getSlots();

    /**
     * Returns all slots declared for the given variant.
     *
     * @param variant variant identity
     * @return slots declared for the variant
     */
    Set<ArtifactSlot> getSlotsForVariant(Variant variant);

    /**
     * Finds a slot by typed identities.
     *
     * @param variant variant identity
     * @param slot slot identity inside the variant
     * @return matching slot when present
     */
    Optional<ArtifactSlot> findSlot(Variant variant, Slot slot);

    /**
     * Requires a slot by typed identities.
     *
     * @param variant variant identity
     * @param slot slot identity inside the variant
     * @return matching slot
     */
    ArtifactSlot requireSlot(Variant variant, Slot slot);

}
