package com.example.internal

import com.example.ExampleSourceDirectorySet
import com.example.ExampleSourceSets
import groovy.transform.CompileStatic
import org.gradle.api.*

@CompileStatic
class DefaultExampleSourceSets implements ExampleSourceSets {
    @Delegate(interfaces = true)
    private final NamedDomainObjectContainer<ExampleSourceDirectorySet> sourceDirectorySets

    DefaultExampleSourceSets(Project project) {
        sourceDirectorySets = project.objects.domainObjectContainer(
            ExampleSourceDirectorySet,
            { String name ->
                project.objects.newInstance(ExampleSourceDirectorySet)
            }
        )
    }

    // I don't know why all below methods must be defined...
    // Uncomment them all and the tests will start to pass.

//    def <S> NamedDomainObjectSet<S> withType(Class<S> type) {}
//    def <S> NamedDomainObjectProvider<S> named(String name, Class<S> type) throws UnknownDomainObjectException {}
//    def <S> NamedDomainObjectProvider<S> named(String name, Class<S> type, Action<? super S> configurationAction) throws UnknownDomainObjectException {}
//    def <S> DomainObjectCollection<S> withType(Class<S> type, Action<? super S> configureAction) {}
//    def <S> DomainObjectCollection<S> withType(@DelegatesTo.Target Class<S> type, @DelegatesTo(genericTypeIndex = 0) Closure configureClosure) {}
}
