"""Type stubs for async repository methods."""

from collections.abc import Sequence
from typing import Protocol

from pydantic import BaseModel
from sqlalchemy.ext.asyncio import AsyncSession
from sqlmodel import SQLModel

from auen.types import PKValue, SelectQuery

class AsyncCrudRepository(Protocol):
    async def get(self, session: AsyncSession, pk: PKValue) -> SQLModel | None: ...
    async def list(
        self,
        session: AsyncSession,
        *,
        query: SelectQuery[SQLModel] | None = None,
        offset: int = 0,
        limit: int = 50,
    ) -> Sequence[SQLModel]: ...
    async def count(
        self, session: AsyncSession, *, query: SelectQuery[SQLModel] | None = None
    ) -> int: ...
    async def create(self, session: AsyncSession, *, obj_in: BaseModel) -> SQLModel: ...
    async def update(
        self,
        session: AsyncSession,
        *,
        db_obj: SQLModel,
        obj_in: BaseModel,
        partial: bool = True,
    ) -> SQLModel: ...
    async def delete(self, session: AsyncSession, *, db_obj: SQLModel) -> None: ...
