import asyncio
from pathlib import Path
from typing import List, Optional

from quber.core.extractors.base import ExtractedTable


class MockTableExtractor:
    def __init__(self, tables: Optional[List[ExtractedTable]] = None) -> None:
        self._tables = tables or []

    async def extract_tables(self, source: Path) -> List[ExtractedTable]:
        _ = source
        return list(self._tables)

    def extract_tables_sync(self, source: Path) -> List[ExtractedTable]:
        return asyncio.run(self.extract_tables(source))
