@@ -5,7 +5,6 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo
5
5
import io.swagger.v3.oas.annotations.media.Schema
6
6
import jakarta.validation.constraints.NotNull
7
7
import org.springframework.format.annotation.DateTimeFormat
8
- import uk.gov.justice.digital.hmpps.personintegrationapi.corepersonrecord.enumeration.CorePersonRecordField
9
8
import java.time.LocalDate
10
9
11
10
@JsonTypeInfo(
@@ -15,14 +14,20 @@ import java.time.LocalDate
15
14
visible = true ,
16
15
)
17
16
@JsonSubTypes(
18
- JsonSubTypes .Type (name = " BIRTHPLACE" , value = BirthplaceUpdateDto ::class ),
19
- JsonSubTypes .Type (name = " COUNTRY_OF_BIRTH" , value = CountryOfBirthUpdateDto ::class ),
20
- JsonSubTypes .Type (name = " DATE_OF_BIRTH" , value = DateOfBirthUpdateDto ::class ),
17
+ JsonSubTypes .Type (name = CorePersonRecordV1UpdateRequestDto . BIRTHPLACE , value = BirthplaceUpdateDto ::class ),
18
+ JsonSubTypes .Type (name = CorePersonRecordV1UpdateRequestDto . COUNTRY_OF_BIRTH , value = CountryOfBirthUpdateDto ::class ),
19
+ JsonSubTypes .Type (name = CorePersonRecordV1UpdateRequestDto . DATE_OF_BIRTH , value = DateOfBirthUpdateDto ::class ),
21
20
)
22
21
@Schema(description = " Core Person Record V1 update request base" )
23
22
sealed class CorePersonRecordV1UpdateRequestDto {
24
23
open val fieldName: Any? = null
25
24
abstract val value: Any?
25
+
26
+ companion object {
27
+ const val BIRTHPLACE = " BIRTHPLACE"
28
+ const val COUNTRY_OF_BIRTH = " COUNTRY_OF_BIRTH"
29
+ const val DATE_OF_BIRTH = " DATE_OF_BIRTH"
30
+ }
26
31
}
27
32
28
33
@Schema(description = " Core Person Record V1 birthplace update request" )
@@ -39,11 +44,11 @@ data class BirthplaceUpdateDto(
39
44
@Schema(
40
45
type = " String" ,
41
46
description = " The field to be updated" ,
42
- allowableValues = [" BIRTHPLACE" ],
47
+ allowableValues = [BIRTHPLACE ],
43
48
required = true ,
44
49
nullable = false ,
45
50
)
46
- override val fieldName: CorePersonRecordField = CorePersonRecordField . BIRTHPLACE
51
+ override val fieldName: String = BIRTHPLACE
47
52
}
48
53
49
54
@Schema(description = " Core Person Record V1 date of birth update request" )
@@ -61,11 +66,11 @@ data class DateOfBirthUpdateDto(
61
66
@Schema(
62
67
type = " String" ,
63
68
description = " The field to be updated" ,
64
- allowableValues = [" DATE_OF_BIRTH" ],
69
+ allowableValues = [DATE_OF_BIRTH ],
65
70
required = true ,
66
71
nullable = false ,
67
72
)
68
- override val fieldName: CorePersonRecordField = CorePersonRecordField . DATE_OF_BIRTH
73
+ override val fieldName: String = DATE_OF_BIRTH
69
74
}
70
75
71
76
@Schema(description = " Core Person Record V1 country of birth update request" )
@@ -82,9 +87,9 @@ data class CountryOfBirthUpdateDto(
82
87
@Schema(
83
88
type = " String" ,
84
89
description = " The field to be updated" ,
85
- allowableValues = [" COUNTRY_OF_BIRTH" ],
90
+ allowableValues = [COUNTRY_OF_BIRTH ],
86
91
required = true ,
87
92
nullable = false ,
88
93
)
89
- override val fieldName: CorePersonRecordField = CorePersonRecordField . COUNTRY_OF_BIRTH
94
+ override val fieldName: String = COUNTRY_OF_BIRTH
90
95
}
0 commit comments