from dataclasses import dataclass, field

from sm_blueprint_lib.bases.parts.basepart import BasePart
from sm_blueprint_lib.constants import SHAPEID


@dataclass
class Body:
    childs: list[BasePart] = field(default_factory=list)

    def __post_init__(self):
        self.childs = [SHAPEID.SHAPEID_TO_CLASS[child["shapeId"]](**child)
                       for child in self.childs]
