Skip to content

Commit 8709d9e

Browse files
committed
Issues #291 refactor: History 를 sealed class → sealed interface 로 변경
1 parent 973d848 commit 8709d9e

File tree

1 file changed

+9
-6
lines changed
  • domain/src/main/java/com/lighthouse/domain/model

1 file changed

+9
-6
lines changed

domain/src/main/java/com/lighthouse/domain/model/History.kt

+9-6
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,40 @@ package com.lighthouse.domain.model
33
import com.lighthouse.domain.VertexLocation
44
import java.util.Date
55

6-
sealed class History(open val date: Date, open val gifticonId: String) {
6+
sealed interface History {
7+
val date: Date
8+
val gifticonId: String
9+
710
data class Init(
811
override val date: Date,
912
override val gifticonId: String,
1013
val amount: Int? = null,
11-
) : History(date, gifticonId)
14+
) : History
1215

1316
data class Use(
1417
override val date: Date,
1518
override val gifticonId: String,
1619
val location: VertexLocation? = null,
17-
) : History(date, gifticonId)
20+
) : History
1821

1922
data class UseCashCard(
2023
override val date: Date,
2124
override val gifticonId: String,
2225
val amount: Int,
2326
val balance: Int? = null,
2427
val location: VertexLocation? = null,
25-
) : History(date, gifticonId)
28+
) : History
2629

2730
data class CancelUsage(
2831
override val date: Date,
2932
override val gifticonId: String,
30-
) : History(date, gifticonId)
33+
) : History
3134

3235
data class ModifyAmount(
3336
override val date: Date,
3437
override val gifticonId: String,
3538
val balance: Int? = null,
36-
) : History(date, gifticonId)
39+
) : History
3740

3841
companion object {
3942
fun getType(history: History): Int = when (history) {

0 commit comments

Comments
 (0)