diff --git a/src/main/kotlin/roomescape/schedule/business/domain/ScheduleWithThemeSummary.kt b/src/main/kotlin/roomescape/schedule/business/domain/ScheduleWithThemeSummary.kt new file mode 100644 index 00000000..5259b1e8 --- /dev/null +++ b/src/main/kotlin/roomescape/schedule/business/domain/ScheduleWithThemeSummary.kt @@ -0,0 +1,28 @@ +package roomescape.schedule.business.domain + +import roomescape.schedule.infrastructure.persistence.ScheduleStatus +import roomescape.theme.infrastructure.persistence.Difficulty +import java.time.LocalDate +import java.time.LocalTime + +class ScheduleWithThemeSummary( + val id: Long, + val date: LocalDate, + val time: LocalTime, + val themeId: Long, + val themeName: String, + val themeDifficulty: Difficulty, + val themeAvailableMinutes: Short, + val status: ScheduleStatus +) { + fun getEndAt(): LocalTime { + return time.plusMinutes(themeAvailableMinutes.toLong()) + } + + fun containsTime(targetTime: LocalTime): Boolean { + val startFrom = this.time + val endAt = getEndAt() + + return targetTime >= startFrom && targetTime < endAt + } +}