# -------------------------------------------------------------------
# This file was auto-generated. Do not edit directly.
# Generated by: StageGeneratorV2
# -------------------------------------------------------------------

"""This module defines the Presto stage."""

from ibm_watsonx_data_integration.cpd_models.connections_model import Connection
from ibm_watsonx_data_integration.services.datastage.models.connections.presto_connection import PrestoConn
from ibm_watsonx_data_integration.services.datastage.models.flow.dag import StageNode
from ibm_watsonx_data_integration.services.datastage.models.stage_models.presto import presto
from typing import TYPE_CHECKING

if TYPE_CHECKING:
    from ibm_watsonx_data_integration.services.datastage.models.flow.dag import DAG


class PrestoStage(StageNode):
    """This class defines the Presto stage."""

    def __init__(self, dag: "DAG", configuration: presto = None, *, label: str = None) -> None:
        """Initializes an instance of a Presto stage."""
        super().__init__(dag, configuration=configuration, label=label)
        self.configuration: presto = configuration or presto()

    def use_connection(self, connection: Connection) -> None:
        """Adds a project-level connection to this connector stage."""
        self.configuration.connection = PrestoConn().from_connection(connection)
