from dataclasses import dataclass
from models.base import BaseModel


@dataclass
class RoutineExtension(BaseModel):
    child_id: str
    routine_id: str
    date: str

    @classmethod
    def from_dict(cls, d: dict) -> 'RoutineExtension':
        return cls(
            child_id=d.get('child_id'),
            routine_id=d.get('routine_id'),
            date=d.get('date'),
            id=d.get('id'),
            created_at=d.get('created_at'),
            updated_at=d.get('updated_at'),
        )

    def to_dict(self) -> dict:
        base = super().to_dict()
        base.update({
            'child_id': self.child_id,
            'routine_id': self.routine_id,
            'date': self.date,
        })
        return base
