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

"""This module defines the Two-source Match stage."""

from ibm_watsonx_data_integration.services.datastage.models.flow.dag import StageNode
from ibm_watsonx_data_integration.services.datastage.models.stage_models.two_source_match import two_source_match
from typing import TYPE_CHECKING

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

# from ibm.datastage._framework.components.match_specification import MatchSpecification


class TwoSourceMatchStage(StageNode):
    """This class defines the Two-source Match stage."""

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

    # def set_match_specification(self, match_specification: MatchSpecification):
    # """Make sure to set with_pgmtype as well."""
    # self.configuration.match_specification = match_specification
    # self.configuration.specfile = f"{match_specification.name}.MAT"
    # self.configuration.workdir = (
    #     f"quality_stage/match_specification/{match_specification.name}"
    # )
    # self.configuration.match_asset_id = match_specification.asset_id
    # self.configuration.match_type = match_specification.MATCHTYPE
    # if not self.configuration.enable_override:
    #     cutoffs = []
    #     for i, match_pass in enumerate(match_specification.passes, start=1):
    #         if match_pass.DUPLICATECUTOFF:
    #             cutoffs.append(
    #                 f"CUTOFF{i} {match_pass.MATCHCUTOFF} {match_pass.CLERICALCUTOFF} {match_pass.DUPLICATECUTOFF}"
    #             )
    #         else:
    #             cutoffs.append(
    #                 f"CUTOFF{i} {match_pass.MATCHCUTOFF} {match_pass.CLERICALCUTOFF}"
    #             )
    #     self.configuration.spec_cutoff = "\r\n".join(cutoffs)
