-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathControlGensDeMerEntity.kt
48 lines (44 loc) · 1.99 KB
/
ControlGensDeMerEntity.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package fr.gouv.dgampa.rapportnav.domain.entities.mission.nav.control
import fr.gouv.dgampa.rapportnav.domain.entities.mission.nav.infraction.InfractionEntity
import java.util.*
data class ControlGensDeMerEntity(
override var id: UUID,
val missionId: Int,
override val actionControlId: String,
val amountOfControls: Int,
override val unitShouldConfirm: Boolean? = null,
override var unitHasConfirmed: Boolean? = null,
val staffOutnumbered: ControlResult? = null,
val upToDateMedicalCheck: ControlResult? = null,
val knowledgeOfFrenchLawAndLanguage: ControlResult? = null,
override val observations: String? = null,
override val hasBeenDone: Boolean? = null,
override var infractions: List<InfractionEntity>? = null
) : BaseControlEntity() {
override fun shouldToggleOnUnitHasConfirmed(): Boolean =
unitShouldConfirm == true &&
unitHasConfirmed != true &&
(staffOutnumbered != null ||
upToDateMedicalCheck != null ||
knowledgeOfFrenchLawAndLanguage != null ||
infractions?.isNotEmpty() == true ||
observations != null
)
override fun hashCode(): Int {
var result = missionId.hashCode()
result = 31 * result + amountOfControls
result = 31 * result + (staffOutnumbered?.hashCode() ?: 0)
result = 31 * result + (upToDateMedicalCheck?.hashCode() ?: 0)
result = 31 * result + (knowledgeOfFrenchLawAndLanguage?.hashCode() ?: 0)
return super.hashCode() + result
}
override fun equals(other: Any?): Boolean {
if (!super.equals(other)) return false
other as ControlGensDeMerEntity
return (missionId == other.missionId
&& amountOfControls == other.amountOfControls
&& staffOutnumbered == other.staffOutnumbered
&& upToDateMedicalCheck == other.upToDateMedicalCheck
&& knowledgeOfFrenchLawAndLanguage == other.knowledgeOfFrenchLawAndLanguage)
}
}