from bson import ObjectId
from typing import TypedDict, Optional, List, Dict, Any


Query = Dict[str, Any]
Populate = List[Dict[str, Any]]
Projection = Dict[str, Any] | str


class QueryID(TypedDict):
  id: str
  ref: Optional[str]
  _id: Optional[ObjectId]


class Pagination(TypedDict):
  limit: Optional[int]
  skip: Optional[int]
  sort: Optional[Dict[str, Any]]


class QueryFilter(TypedDict):
  query: Query


class Filter(TypedDict):
  query: Query
  populate: Populate
  projection: Projection
  pagination: Pagination


class FilterID(TypedDict):
  query: QueryID
  populate: Populate
  projection: Projection


class FilterOne(TypedDict):
  query: Query
  populate: Populate
  projection: Projection
