from dataclasses import dataclass class InvalidTitleError(ValueError): pass class TaskNotFoundError(KeyError): pass @dataclass class Task: id: int title: str done: bool = False class TaskStore: def __init__(self) -> None: self._next_id = 1 self._tasks: dict[int, Task] = {} def create(self, title: str) -> Task: raise NotImplementedError("Zwaliduj tytuł, utwórz Task z auto-ID i zapisz") def get(self, task_id: int) -> Task | None: raise NotImplementedError("Zwróć Task lub None") def list_all(self) -> list[Task]: raise NotImplementedError("Zwróć wszystkie zadania posortowane po id") def update_title(self, task_id: int, title: str) -> Task: raise NotImplementedError( "Zaktualizuj tytuł lub rzuć InvalidTitleError / TaskNotFoundError" ) def mark_done(self, task_id: int) -> Task: raise NotImplementedError("Ustaw done=True lub rzuć TaskNotFoundError") def delete(self, task_id: int) -> Task: raise NotImplementedError("Usuń i zwróć zadanie lub rzuć TaskNotFoundError")