from dataclasses import dataclass
from typing import List

from .data_container import DataContainer


@dataclass
class DataCollection:
    items: List[DataContainer]

    def __getattr__(self, item_id: str):
        try:
            return self.items[item_id]
        except KeyError:
            raise AttributeError(
                f"This DataCollection object has no attribute '{item_id}'"
            )
