from typing import Any, Generic, TypeVar, Optional, overload
from datetime import datetime
from abc import ABC, abstractmethod

T = TypeVar('T')

class Field(ABC, Generic[T]):
    optional: bool
    readonly: bool
    db_column: str | None
    name: str
    def __init__(self, optional: bool = True, readonly: bool = False, db_column: str | None = None) -> None: ...
    @overload
    def __get__(self, obj: None, objtype: Any) -> Field[T]: ...
    @overload
    def __get__(self, obj: Any, objtype: Any) -> T | None: ...
    def __get__(self, obj: Any, objtype: Any = None) -> Any: ...
    def __set__(self, obj: Any, value: T | None) -> None: ...
    def to_internal_value(self, value: Any) -> T | None: ...
    def to_representation(self, value: Any) -> Any: ...

class ForeignKey(Field[int]): ...
class IntegerField(Field[int]): ...
class IDField(IntegerField): ...
class RelatedField(Field[int]): ...
class FloatField(Field[float]): ...
class DecimalField(Field[float]): ...
class StringField(Field[str]): ...
class TimeField(Field[datetime]): ...
class DateTimeField(Field[datetime]): ...
class BoolField(Field[bool]): ...
class JSONField(Field[dict[str, Any] | list[Any]]): ...
class ArrayField(Field[list[Any]]): ...
class VectorField(Field[list[float]]):
    def to_db(self, value: list[float] | None) -> str | None: ...

class MethodField(Field[Any]):
    def to_internal_value(self, value: Any, key: str) -> Any: ...  # type: ignore[override]
    def to_representation(self, value: Any, key: str) -> Any: ...  # type: ignore[override]
