from __future__ import annotations

from typing import TypeVar, Generic

T = TypeVar("T")


class ListResponse(Generic[T]):
    def __init__(self, *, data: list[T], meta: dict):
        self.data = data
        self.meta = meta

    def __iter__(self):
        return iter(self.data)

    def __len__(self) -> int:
        return len(self.data)

    def __getitem__(self, index):
        return self.data[index]

    def __bool__(self) -> bool:
        return len(self.data) > 0

    @property
    def empty(self) -> bool:
        return len(self.data) == 0
