from typing import Generic, TypeVar

T = TypeVar("T")


class CatalogBundle(Generic[T]):
    def __init__(self, items: list[T]) -> None:
        self._items_by_id = {item.id: item for item in items}

    def get_item(self, item_id: str) -> T:
        return self._items_by_id[item_id]

    def select_items(self, ids: list[str]) -> list[T]:
        return [self._items_by_id[id_] for id_ in ids]
