package roomescape.theme.web import roomescape.common.dto.OperatorInfo import roomescape.theme.infrastructure.persistence.Difficulty import roomescape.theme.infrastructure.persistence.ThemeEntity import java.time.LocalDateTime data class ThemeCreateRequest( val name: String, val description: String, val thumbnailUrl: String, val difficulty: Difficulty, val price: Int, val minParticipants: Short, val maxParticipants: Short, val availableMinutes: Short, val expectedMinutesFrom: Short, val expectedMinutesTo: Short, val isOpen: Boolean ) data class ThemeCreateResponseV2( val id: Long ) fun ThemeCreateRequest.toEntity(id: Long) = ThemeEntity( id = id, name = this.name, description = this.description, thumbnailUrl = this.thumbnailUrl, difficulty = this.difficulty, price = this.price, minParticipants = this.minParticipants, maxParticipants = this.maxParticipants, availableMinutes = this.availableMinutes, expectedMinutesFrom = this.expectedMinutesFrom, expectedMinutesTo = this.expectedMinutesTo, isOpen = this.isOpen ) data class ThemeUpdateRequest( val name: String? = null, val description: String? = null, val thumbnailUrl: String? = null, val difficulty: Difficulty? = null, val price: Int? = null, val minParticipants: Short? = null, val maxParticipants: Short? = null, val availableMinutes: Short? = null, val expectedMinutesFrom: Short? = null, val expectedMinutesTo: Short? = null, val isOpen: Boolean? = null, ) { fun isAllParamsNull(): Boolean { return name == null && description == null && thumbnailUrl == null && difficulty == null && price == null && minParticipants == null && maxParticipants == null && availableMinutes == null && expectedMinutesFrom == null && expectedMinutesTo == null && isOpen == null } } data class AdminThemeSummaryRetrieveResponse( val id: Long, val name: String, val difficulty: Difficulty, val price: Int, val isOpen: Boolean ) fun ThemeEntity.toAdminThemeSummaryResponse() = AdminThemeSummaryRetrieveResponse( id = this.id, name = this.name, difficulty = this.difficulty, price = this.price, isOpen = this.isOpen ) data class AdminThemeSummaryListRetrieveResponse( val themes: List ) fun List.toAdminThemeSummaryListResponse() = AdminThemeSummaryListRetrieveResponse( themes = this.map { it.toAdminThemeSummaryResponse() } ) data class AdminThemeDetailRetrieveResponse( val id: Long, val name: String, val description: String, val thumbnailUrl: String, val difficulty: Difficulty, val price: Int, val minParticipants: Short, val maxParticipants: Short, val availableMinutes: Short, val expectedMinutesFrom: Short, val expectedMinutesTo: Short, val isOpen: Boolean, val createdAt: LocalDateTime, val createdBy: OperatorInfo, val updatedAt: LocalDateTime, val updatedBy: OperatorInfo, ) fun ThemeEntity.toAdminThemeDetailResponse(createdBy: OperatorInfo, updatedBy: OperatorInfo) = AdminThemeDetailRetrieveResponse( id = this.id, name = this.name, description = this.description, thumbnailUrl = this.thumbnailUrl, difficulty = this.difficulty, price = this.price, minParticipants = this.minParticipants, maxParticipants = this.maxParticipants, availableMinutes = this.availableMinutes, expectedMinutesFrom = this.expectedMinutesFrom, expectedMinutesTo = this.expectedMinutesTo, isOpen = this.isOpen, createdAt = this.createdAt, createdBy = createdBy, updatedAt = this.updatedAt, updatedBy = updatedBy ) data class ThemeIdListRetrieveResponse( val themeIds: List ) data class ThemeInfoRetrieveResponse( val id: Long, val name: String, val thumbnailUrl: String, val description: String, val difficulty: Difficulty, val price: Int, val minParticipants: Short, val maxParticipants: Short, val availableMinutes: Short, val expectedMinutesFrom: Short, val expectedMinutesTo: Short ) fun ThemeEntity.toSummaryResponse() = ThemeInfoRetrieveResponse( id = this.id, name = this.name, thumbnailUrl = this.thumbnailUrl, description = this.description, difficulty = this.difficulty, price = this.price, minParticipants = this.minParticipants, maxParticipants = this.maxParticipants, availableMinutes = this.availableMinutes, expectedMinutesFrom = this.expectedMinutesFrom, expectedMinutesTo = this.expectedMinutesTo ) data class ThemeInfoListRetrieveResponse( val themes: List ) fun List.toRetrieveListResponse() = ThemeInfoListRetrieveResponse( themes = this.map { it.toSummaryResponse() } )