"""Scaffolder for Spark Declarative Pipeline component."""

from dagster._annotations import preview, public
from dagster.components.component.component_scaffolder import Scaffolder
from dagster.components.component_scaffolding import scaffold_component
from dagster.components.scaffold.scaffold import ScaffoldRequest


@public
@preview
class SparkDeclarativePipelineScaffolder(Scaffolder):
    """Scaffolds a Spark Declarative Pipeline component defs.yaml and pipeline spec path."""

    def scaffold(self, request: ScaffoldRequest) -> None:
        scaffold_component(
            request,
            {
                "pipeline_spec_path": "spark-pipeline.yml",
                "discovery_mode": "dry_run_with_fallback",
            },
        )
