package nextflow.k8s

import groovy.util.logging.Slf4j
import nextflow.config.scopes.Config
import nextflow.config.spec.ConfigScope
import nextflow.config.spec.ScopeName
import nextflow.config.spec.ConfigOption
import groovy.transform.CompileStatic
import nextflow.script.dsl.Description

@CompileStatic
@Slf4j
@ScopeName("nodeInit")
@Description("The nodeInit scope contains options for the pre-workflow execution initialization of nodes")
class K8sNodeInitConfig implements ConfigScope {
    @ConfigOption
    @Description("enables the pre-workflow execution deployment of pods")
    final boolean enabled;

    @ConfigOption
    @Description("the used image")
    final String image;

    @ConfigOption
    @Description("the start-command")
    final List<String> command;

    @ConfigOption
    @Description("the pod state to wait on")
    final String wait;

    @ConfigOption
    @Description("enables cleanup of pre-workflow nodes.")
    final boolean cleanup;

    K8sNodeInitConfig() {
        this(Collections.emptyMap())
    }

    K8sNodeInitConfig(Map opts) {
        enabled = opts.enabled as boolean
        image = opts.image as String
        command = opts.command as List<String>
        wait = opts.wait as String
        cleanup = opts.cleanup as boolean
    }
}
