from abc import ABC, abstractmethod


class EncryptionInterface(ABC):
    """
    Abstract encryption interface.
    MVP: AES-256-GCM simulated wrapper.
    Production: Microsoft SEAL or OpenFHE for real homomorphic encryption.
    """

    @abstractmethod
    def encrypt(self, plaintext: str, key_ref: str) -> bytes:
        """Encrypt plaintext using the key referenced by key_ref."""
        ...

    @abstractmethod
    def decrypt(self, ciphertext: bytes, key_ref: str) -> str:
        """Decrypt ciphertext using the key referenced by key_ref."""
        ...

    @abstractmethod
    def generate_key(self, purpose: str) -> str:
        """
        Generate a new encryption key for the given purpose.
        Returns a key_ref (reference ID), NOT the key itself.
        Purpose: 'session' | 'user_mek' | 'org_master'
        """
        ...

    @abstractmethod
    def destroy_key(self, key_ref: str) -> bool:
        """
        Destroy a key (cryptographic annihilation).
        After destruction, any data encrypted with this key is irrecoverable.
        """
        ...

    @abstractmethod
    def key_exists(self, key_ref: str) -> bool:
        """Check if a key reference exists and is valid."""
        ...
