from abc import ABC, abstractmethod
from typing import List
from klovis.models import Chunk


class BaseMerger(ABC):
    """
    Abstract base class for merging smaller chunks into larger ones.
    Different strategies can be implemented (semantic, rule-based, structural...).
    """

    @abstractmethod
    def merge(self, chunks: List[Chunk], target_size: int) -> List[Chunk]:
        """
        Merge a list of smaller chunks into larger chunks.

        Parameters
        ----------
        chunks : List[Chunk]
            The input chunks generated by a chunker.
        target_size : int
            Maximum allowed size for merged chunks.

        Returns
        -------
        List[Chunk]
            Merged chunks respecting the target size.
        """
        pass
