from dataclasses import dataclass
from typing import Dict

from ._BaseModel import BaseModel
from ._PathContentModel import PathContentModel
from ..utils import set_dict_path_value


@dataclass
class PathResponseModel(BaseModel):
    description: str
    content: Dict[str, PathContentModel] = None

    def add_content(self, content_type: str, content: PathContentModel) -> None:
        if self.content is None:
            self.content = {}

        set_dict_path_value(
            dict_value=self.content,
            path=[content_type],
            value=content
        )
