"""The module containing the VaexFingerprinter class."""
from __future__ import annotations

import hashlib

import vaex

from .base_fingerprinter import BaseFingerprinter


class VaexFingerprinter(BaseFingerprinter):
    """A fingerprinter for Vaex DataFrames."""

    def fingerprint(self, data: vaex.DataFrame) -> str:
        """Generate a fingerprint for a Vaex DataFrame.

        Note:
            The fingerprint is generated by calling the `fingerprint()` method of the `vaex` DataFrame. This
            method will attempt to generate a unique fingerprint for the given DataFrame, it may however
            not be completely stable across different runs of the program (see the `fingerprint()` method
            of the `vaex` DataFrame for more information).

        Args:
            data: The Vaex DataFrame to be fingerprinted.

        Returns:
            The fingerprint as a hexadecimal string.

        Examples:
            >>> fingerprinter = VaexFingerprinter()
            >>> fingerprinter.fingerprint(vaex.from_arrays(x=[1, 2, 3], y=[4, 5, 6]))
            "fingerprint"
        """
        fingerprint = hashlib.md5(str(data.fingerprint()).encode()).hexdigest()
        return fingerprint
