from prosuite.quality.delete_issues import DeleteIssuesInVerifiedModel


class VerificationParameters():
    """
    Contains all parameters that can be passed to a verification.
    """
    def __init__(self, tile_size: int = 5000, user_name: str = None, xml_options: str | None = None, report_properties: dict[str, str] | None = None, perimeter_description: str | None = None) -> None:
        #:
        self.tile_size: int = tile_size
        """
        The size (in meter) for testing quality conditions.
        """
        #:
        self.user_name: str = user_name
        """
        The executing user which will be used in issue features.
        """
        #:
        self.desired_parallel_processing: int = 0
        """
        The desired number of parallel worker processes to be used if the server allows parallel processing.
        """
        #:
        self.update_issues_in_verified_model = False
        """
        If True, the issues will be updated in the error datasets of the verified model.
        """
        #+
        self.delete_issues_in_verified_model: DeleteIssuesInVerifiedModel = DeleteIssuesInVerifiedModel.delete_issues_in_perimeter_with_condition
        """
        Defines how existing issues in the primary model's error datasets are deleted
        before writing new QA results.

        This setting corresponds to the C# enum `ErrorDeletionInPerimeter` used in
        `QualityVerificationServiceBase.DeleteErrors()`.

        Enum values:
            delete_verified_conditions_in_perimeter (0):
                Delete only issues in the verification perimeter that belong to
                verified quality conditions.

            delete_all_in_perimeter (1):
                Delete all issues in the verification perimeter, regardless of condition.

            delete_none (2):
                Do not delete any existing issues.
        """
        #:
        self.save_verification_statistics = False
        """
        If True, the verification statistics will be saved into the Data Dictionary database.
        """
        #:
        self.objects_to_verify = dict()
        """
        A dictionary containing the dataset IDs and the object IDs to be verified. The dataset ID can be looked up in the Data Dictionary Editor -> Data -> Data Models -> Dataset -> Properties.  Use the method add_objects_to_verify to add a list of IDs for a specific dataset.
        """
        #:
        self.report_culture_code = None
        """
        The culture code that determines the language of the report. If None, the culture code of the machine of the server will be used. 
        Examples: 'de-CH', 'de-DE', 'de-AT', 'en-GB'
        """

        self.xml_options: str | None = xml_options
        """
        XML options for advanced verification settings.
        """

        self.report_properties: dict[str, str] = report_properties or {}
        """
        Custom properties to be included in the verification report header as key-value pairs.
        Example: {'Bundesland': 'NRW', 'Datum': '2026-01-20', 'Bearbeiter': 'Max Mustermann'}
        """

        self.perimeter_description: str | None = perimeter_description
        """
        Description of the perimeter to be used in the verification report.
        """
    def add_objects_to_verify(self, dataset_id: int, object_ids: list):
        """
        Adds a dataset and a list of object IDs to the objects to be verified.

        :param dataset_id: The dataset ID containing the selected datasets The id can be look up in the DataDictionaryEditor -> Data -> Data Models -> Dataset -> Properties.
        :type dataset_id: int
        :param object_ids: A list of feature-object IDs from the dataset to be verified.
        :type object_ids: list
        """
        self.objects_to_verify[dataset_id] = object_ids
