import datetime
from typing import Any, Optional, Type, TypeVar, Union

_ObjectId = TypeVar("_ObjectId", bound="ObjectId")

class ObjectId:
    def __init__(self, oid: Optional[Union[str, ObjectId, bytes]] = ...) -> None: ...
    @classmethod
    def from_datetime(cls: Type[_ObjectId], generation_time: datetime.datetime) -> _ObjectId: ...
    @classmethod
    def is_valid(cls, oid: Any) -> bool: ...
    @property
    def binary(self) -> bytes: ...
    @property
    def generation_time(self) -> datetime.datetime: ...
    def __eq__(self, other: Any) -> bool: ...
    def __ne__(self, other: Any) -> bool: ...
    def __lt__(self, other: Any) -> bool: ...
    def __le__(self, other: Any) -> bool: ...
    def __gt__(self, other: Any) -> bool: ...
    def __ge__(self, other: Any) -> bool: ...
    def __hash__(self) -> Any: ...
