"""SQLite-backed VectorStore adapter.

Delegates all operations to SQLiteStore's vector CRUD methods.
"""
from __future__ import annotations

from typing import Any

from .base import VectorStore


class SQLiteVectorStore(VectorStore):
    """VectorStore backed by SQLite via SQLiteStore adapter.

    Uses brute-force cosine similarity with persistent storage in SQLite.
    """

    def __init__(self, sqlite_store: Any) -> None:
        self._store = sqlite_store

    def upsert(self, id: str, vector: list[float], payload: dict) -> None:
        self._store.upsert_vector(id, vector, payload)

    def search(
        self,
        query_vector: list[float],
        limit: int = 10,
        filters: dict[str, Any] | None = None,
    ) -> list[dict]:
        return self._store.search_vectors(query_vector, limit, filters)

    def delete(self, id: str) -> None:
        self._store.delete_vector(id)

    def update_payload(self, id: str, payload: dict) -> None:
        self._store.update_vector_payload(id, payload)

    def count(self) -> int:
        return self._store.count_vectors()
