from .return_class import AbstractApiClass


class ConstantsAutocompleteResponse(AbstractApiClass):
    """
        A dictionary of constants to be used in the autocomplete.

        Args:
            client (ApiClient): An authenticated API Client instance
            maxPendingRequests (int): The maximum number of pending requests.
            acceptanceDelay (int): The acceptance delay.
            debounceDelay (int): The debounce delay.
            recordUserAction (bool): Whether to record user action.
            validateSuggestion (bool): Whether to validate the suggestion.
            validationLinesThreshold (int): The number of lines to validate the suggestion.
            maxTrackedRecentChanges (int): The maximum number of recent file changes to track.
            diffThreshold (int): The diff operations threshold.
            derivativeThreshold (int): The derivative threshold for deletions
            defaultSurroundingLines (int): The default number of surrounding lines to include in the recently visited context.
            maxTrackedVisitChanges (int): The maximum number of recently visited ranges to track.
            selectionCooldownMs (int): The cooldown time in milliseconds for selection changes.
            viewingCooldownMs (int): The cooldown time in milliseconds for viewing changes.
            maxLines (int): The maximum number of lines to include in recently visited context.
            editCooldownMs (int): The cooldown time in milliseconds after last edit.
            scrollDebounceMs (int): The debounce time in milliseconds for scroll events.
    """

    def __init__(self, client, maxPendingRequests=None, acceptanceDelay=None, debounceDelay=None, recordUserAction=None, validateSuggestion=None, validationLinesThreshold=None, maxTrackedRecentChanges=None, diffThreshold=None, derivativeThreshold=None, defaultSurroundingLines=None, maxTrackedVisitChanges=None, selectionCooldownMs=None, viewingCooldownMs=None, maxLines=None, editCooldownMs=None, scrollDebounceMs=None):
        super().__init__(client, None)
        self.max_pending_requests = maxPendingRequests
        self.acceptance_delay = acceptanceDelay
        self.debounce_delay = debounceDelay
        self.record_user_action = recordUserAction
        self.validate_suggestion = validateSuggestion
        self.validation_lines_threshold = validationLinesThreshold
        self.max_tracked_recent_changes = maxTrackedRecentChanges
        self.diff_threshold = diffThreshold
        self.derivative_threshold = derivativeThreshold
        self.default_surrounding_lines = defaultSurroundingLines
        self.max_tracked_visit_changes = maxTrackedVisitChanges
        self.selection_cooldown_ms = selectionCooldownMs
        self.viewing_cooldown_ms = viewingCooldownMs
        self.max_lines = maxLines
        self.edit_cooldown_ms = editCooldownMs
        self.scroll_debounce_ms = scrollDebounceMs
        self.deprecated_keys = {}

    def __repr__(self):
        repr_dict = {f'max_pending_requests': repr(self.max_pending_requests), f'acceptance_delay': repr(self.acceptance_delay), f'debounce_delay': repr(self.debounce_delay), f'record_user_action': repr(self.record_user_action), f'validate_suggestion': repr(self.validate_suggestion), f'validation_lines_threshold': repr(self.validation_lines_threshold), f'max_tracked_recent_changes': repr(self.max_tracked_recent_changes), f'diff_threshold': repr(
            self.diff_threshold), f'derivative_threshold': repr(self.derivative_threshold), f'default_surrounding_lines': repr(self.default_surrounding_lines), f'max_tracked_visit_changes': repr(self.max_tracked_visit_changes), f'selection_cooldown_ms': repr(self.selection_cooldown_ms), f'viewing_cooldown_ms': repr(self.viewing_cooldown_ms), f'max_lines': repr(self.max_lines), f'edit_cooldown_ms': repr(self.edit_cooldown_ms), f'scroll_debounce_ms': repr(self.scroll_debounce_ms)}
        class_name = "ConstantsAutocompleteResponse"
        repr_str = ',\n  '.join([f'{key}={value}' for key, value in repr_dict.items(
        ) if getattr(self, key, None) is not None and key not in self.deprecated_keys])
        return f"{class_name}({repr_str})"

    def to_dict(self):
        """
        Get a dict representation of the parameters in this class

        Returns:
            dict: The dict value representation of the class parameters
        """
        resp = {'max_pending_requests': self.max_pending_requests, 'acceptance_delay': self.acceptance_delay, 'debounce_delay': self.debounce_delay, 'record_user_action': self.record_user_action, 'validate_suggestion': self.validate_suggestion, 'validation_lines_threshold': self.validation_lines_threshold, 'max_tracked_recent_changes': self.max_tracked_recent_changes, 'diff_threshold': self.diff_threshold,
                'derivative_threshold': self.derivative_threshold, 'default_surrounding_lines': self.default_surrounding_lines, 'max_tracked_visit_changes': self.max_tracked_visit_changes, 'selection_cooldown_ms': self.selection_cooldown_ms, 'viewing_cooldown_ms': self.viewing_cooldown_ms, 'max_lines': self.max_lines, 'edit_cooldown_ms': self.edit_cooldown_ms, 'scroll_debounce_ms': self.scroll_debounce_ms}
        return {key: value for key, value in resp.items() if value is not None and key not in self.deprecated_keys}
