@Value
public class PostponableUndoneTask implements UndoneTask {
    Long id;
    String name;
    LocalDate dueDate;
    int postponeCount;

    public static final int POSTPONE_MAX_COUNT = 3;

    public UndoneTask postpone() {
        if (postponeCount < POSTPONE_MAX_COUNT) {
            return new PostponableUndoneTask(id, name, dueDate.plusDays(1L),postponeCount + 1);
        } else {
            return new UndoneTaskWithDeadline(id, name, dueDate.plusDays(1L));
        }
    }

    @Override
    public DoneTask done() {
        return new DoneTask(id, name, LocalDate.now());
    }
}