@@ -10,13 +10,20 @@ pub struct UsNat {
10
10
pub core : Core ,
11
11
#[ gpp( optional_segment_type = 1 ) ]
12
12
pub gpc : Option < bool > ,
13
+ }
13
14
15
+ #[ derive( Debug , Eq , PartialEq , FromDataReader ) ]
16
+ #[ non_exhaustive]
17
+ pub enum Core {
18
+ #[ gpp( version = 1 ) ]
19
+ V1 ( CoreV1 ) ,
20
+ #[ gpp( version = 2 ) ]
21
+ V2 ( CoreV2 ) ,
14
22
}
15
23
16
24
#[ derive( Debug , Eq , PartialEq , FromDataReader ) ]
17
25
#[ non_exhaustive]
18
- #[ gpp( section_version = 1 ) ]
19
- pub struct Core {
26
+ pub struct CoreV1 {
20
27
pub sharing_notice : Notice ,
21
28
pub sale_opt_out_notice : Notice ,
22
29
pub sharing_opt_out_notice : Notice ,
@@ -26,8 +33,8 @@ pub struct Core {
26
33
pub sale_opt_out : OptOut ,
27
34
pub sharing_opt_out : OptOut ,
28
35
pub targeted_advertising_opt_out : OptOut ,
29
- pub sensitive_data_processing : SensitiveDataProcessing ,
30
- pub known_child_sensitive_data_consents : KnownChildSensitiveDataConsents ,
36
+ pub sensitive_data_processing : SensitiveDataProcessingV1 ,
37
+ pub known_child_sensitive_data_consents : KnownChildSensitiveDataConsentsV1 ,
31
38
pub personal_data_consent : Consent ,
32
39
#[ gpp( parse_with = parse_mspa_covered_transaction) ]
33
40
pub mspa_covered_transaction : bool ,
@@ -37,7 +44,7 @@ pub struct Core {
37
44
38
45
#[ derive( Debug , Eq , PartialEq , FromDataReader ) ]
39
46
#[ non_exhaustive]
40
- pub struct SensitiveDataProcessing {
47
+ pub struct SensitiveDataProcessingV1 {
41
48
pub racial_or_ethnic_origin : Consent ,
42
49
pub religious_or_philosophical_beliefs : Consent ,
43
50
pub health_data : Consent ,
@@ -54,11 +61,61 @@ pub struct SensitiveDataProcessing {
54
61
55
62
#[ derive( Debug , Eq , PartialEq , FromDataReader ) ]
56
63
#[ non_exhaustive]
57
- pub struct KnownChildSensitiveDataConsents {
64
+ pub struct KnownChildSensitiveDataConsentsV1 {
58
65
pub from_13_to_16 : Consent ,
59
66
pub under_13 : Consent ,
60
67
}
61
68
69
+ #[ derive( Debug , Eq , PartialEq , FromDataReader ) ]
70
+ #[ non_exhaustive]
71
+ pub struct CoreV2 {
72
+ pub sharing_notice : Notice ,
73
+ pub sale_opt_out_notice : Notice ,
74
+ pub sharing_opt_out_notice : Notice ,
75
+ pub targeted_advertising_opt_out_notice : Notice ,
76
+ pub sensitive_data_processing_opt_out_notice : Notice ,
77
+ pub sensitive_data_limit_use_notice : Notice ,
78
+ pub sale_opt_out : OptOut ,
79
+ pub sharing_opt_out : OptOut ,
80
+ pub targeted_advertising_opt_out : OptOut ,
81
+ pub sensitive_data_processing : SensitiveDataProcessingV2 ,
82
+ pub known_child_sensitive_data_consents : KnownChildSensitiveDataConsentsV2 ,
83
+ pub personal_data_consent : Consent ,
84
+ #[ gpp( parse_with = parse_mspa_covered_transaction) ]
85
+ pub mspa_covered_transaction : bool ,
86
+ pub mspa_opt_out_option_mode : MspaMode ,
87
+ pub mspa_service_provider_mode : MspaMode ,
88
+ }
89
+
90
+ #[ derive( Debug , Eq , PartialEq , FromDataReader ) ]
91
+ #[ non_exhaustive]
92
+ pub struct SensitiveDataProcessingV2 {
93
+ pub racial_or_ethnic_origin : Consent ,
94
+ pub religious_or_philosophical_beliefs : Consent ,
95
+ pub health_data : Consent ,
96
+ pub sex_life_or_sexual_orientation : Consent ,
97
+ pub citizenship_or_immigration_status : Consent ,
98
+ pub genetic_unique_identification : Consent ,
99
+ pub biometric_unique_identification : Consent ,
100
+ pub precise_geolocation_data : Consent ,
101
+ pub identification_documents : Consent ,
102
+ pub financial_account_data : Consent ,
103
+ pub union_membership : Consent ,
104
+ pub mail_email_or_text_messages : Consent ,
105
+ pub general_health_data : Consent ,
106
+ pub crime_victim_status : Consent ,
107
+ pub national_origin : Consent ,
108
+ pub transgender_or_nonbinary_status : Consent ,
109
+ }
110
+
111
+ #[ derive( Debug , Eq , PartialEq , FromDataReader ) ]
112
+ #[ non_exhaustive]
113
+ pub struct KnownChildSensitiveDataConsentsV2 {
114
+ pub process_sensitive_data_from_13_to_16 : Consent ,
115
+ pub process_sensitive_data_under_13 : Consent ,
116
+ pub process_personal_data_from_16_to_17 : Consent ,
117
+ }
118
+
62
119
#[ cfg( test) ]
63
120
mod tests {
64
121
use super :: * ;
@@ -72,7 +129,7 @@ mod tests {
72
129
(
73
130
"BAAAAAAAAQA" ,
74
131
UsNat {
75
- core : Core {
132
+ core : Core :: V1 ( CoreV1 {
76
133
sharing_notice : Notice :: NotApplicable ,
77
134
sale_opt_out_notice : Notice :: NotApplicable ,
78
135
sharing_opt_out_notice : Notice :: NotApplicable ,
@@ -82,7 +139,7 @@ mod tests {
82
139
sale_opt_out : OptOut :: NotApplicable ,
83
140
sharing_opt_out : OptOut :: NotApplicable ,
84
141
targeted_advertising_opt_out : OptOut :: NotApplicable ,
85
- sensitive_data_processing : SensitiveDataProcessing {
142
+ sensitive_data_processing : SensitiveDataProcessingV1 {
86
143
racial_or_ethnic_origin : Consent :: NotApplicable ,
87
144
religious_or_philosophical_beliefs : Consent :: NotApplicable ,
88
145
health_data : Consent :: NotApplicable ,
@@ -96,22 +153,22 @@ mod tests {
96
153
union_membership : Consent :: NotApplicable ,
97
154
mail_email_or_text_messages : Consent :: NotApplicable ,
98
155
} ,
99
- known_child_sensitive_data_consents : KnownChildSensitiveDataConsents {
156
+ known_child_sensitive_data_consents : KnownChildSensitiveDataConsentsV1 {
100
157
from_13_to_16 : Consent :: NotApplicable ,
101
158
under_13 : Consent :: NotApplicable ,
102
159
} ,
103
160
personal_data_consent : Consent :: NotApplicable ,
104
161
mspa_covered_transaction : true ,
105
162
mspa_opt_out_option_mode : MspaMode :: NotApplicable ,
106
163
mspa_service_provider_mode : MspaMode :: NotApplicable ,
107
- } ,
164
+ } ) ,
108
165
gpc : None ,
109
166
} ,
110
167
) ,
111
168
(
112
169
"BVVVVVVVVWA" ,
113
170
UsNat {
114
- core : Core {
171
+ core : Core :: V1 ( CoreV1 {
115
172
sharing_notice : Notice :: Provided ,
116
173
sale_opt_out_notice : Notice :: Provided ,
117
174
sharing_opt_out_notice : Notice :: Provided ,
@@ -121,7 +178,7 @@ mod tests {
121
178
sale_opt_out : OptOut :: OptedOut ,
122
179
sharing_opt_out : OptOut :: OptedOut ,
123
180
targeted_advertising_opt_out : OptOut :: OptedOut ,
124
- sensitive_data_processing : SensitiveDataProcessing {
181
+ sensitive_data_processing : SensitiveDataProcessingV1 {
125
182
racial_or_ethnic_origin : Consent :: NoConsent ,
126
183
religious_or_philosophical_beliefs : Consent :: NoConsent ,
127
184
health_data : Consent :: NoConsent ,
@@ -135,22 +192,22 @@ mod tests {
135
192
union_membership : Consent :: NoConsent ,
136
193
mail_email_or_text_messages : Consent :: NoConsent ,
137
194
} ,
138
- known_child_sensitive_data_consents : KnownChildSensitiveDataConsents {
195
+ known_child_sensitive_data_consents : KnownChildSensitiveDataConsentsV1 {
139
196
from_13_to_16 : Consent :: NoConsent ,
140
197
under_13 : Consent :: NoConsent ,
141
198
} ,
142
199
personal_data_consent : Consent :: NoConsent ,
143
200
mspa_covered_transaction : true ,
144
201
mspa_opt_out_option_mode : MspaMode :: Yes ,
145
202
mspa_service_provider_mode : MspaMode :: No ,
146
- } ,
203
+ } ) ,
147
204
gpc : None ,
148
205
} ,
149
206
) ,
150
207
(
151
208
"BVVVVVVVVWA.YA" ,
152
209
UsNat {
153
- core : Core {
210
+ core : Core :: V1 ( CoreV1 {
154
211
sharing_notice : Notice :: Provided ,
155
212
sale_opt_out_notice : Notice :: Provided ,
156
213
sharing_opt_out_notice : Notice :: Provided ,
@@ -160,7 +217,7 @@ mod tests {
160
217
sale_opt_out : OptOut :: OptedOut ,
161
218
sharing_opt_out : OptOut :: OptedOut ,
162
219
targeted_advertising_opt_out : OptOut :: OptedOut ,
163
- sensitive_data_processing : SensitiveDataProcessing {
220
+ sensitive_data_processing : SensitiveDataProcessingV1 {
164
221
racial_or_ethnic_origin : Consent :: NoConsent ,
165
222
religious_or_philosophical_beliefs : Consent :: NoConsent ,
166
223
health_data : Consent :: NoConsent ,
@@ -174,24 +231,67 @@ mod tests {
174
231
union_membership : Consent :: NoConsent ,
175
232
mail_email_or_text_messages : Consent :: NoConsent ,
176
233
} ,
177
- known_child_sensitive_data_consents : KnownChildSensitiveDataConsents {
234
+ known_child_sensitive_data_consents : KnownChildSensitiveDataConsentsV1 {
178
235
from_13_to_16 : Consent :: NoConsent ,
179
236
under_13 : Consent :: NoConsent ,
180
237
} ,
181
238
personal_data_consent : Consent :: NoConsent ,
182
239
mspa_covered_transaction : true ,
183
240
mspa_opt_out_option_mode : MspaMode :: Yes ,
184
241
mspa_service_provider_mode : MspaMode :: No ,
185
- } ,
242
+ } ) ,
186
243
gpc : Some ( true ) ,
187
244
} ,
188
245
) ,
246
+ (
247
+ "CAAAAAAAAAWA.Q" ,
248
+ UsNat {
249
+ core : Core :: V2 ( CoreV2 {
250
+ sharing_notice : Notice :: NotApplicable ,
251
+ sale_opt_out_notice : Notice :: NotApplicable ,
252
+ sharing_opt_out_notice : Notice :: NotApplicable ,
253
+ targeted_advertising_opt_out_notice : Notice :: NotApplicable ,
254
+ sensitive_data_processing_opt_out_notice : Notice :: NotApplicable ,
255
+ sensitive_data_limit_use_notice : Notice :: NotApplicable ,
256
+ sale_opt_out : OptOut :: NotApplicable ,
257
+ sharing_opt_out : OptOut :: NotApplicable ,
258
+ targeted_advertising_opt_out : OptOut :: NotApplicable ,
259
+ sensitive_data_processing : SensitiveDataProcessingV2 {
260
+ racial_or_ethnic_origin : Consent :: NotApplicable ,
261
+ religious_or_philosophical_beliefs : Consent :: NotApplicable ,
262
+ health_data : Consent :: NotApplicable ,
263
+ sex_life_or_sexual_orientation : Consent :: NotApplicable ,
264
+ citizenship_or_immigration_status : Consent :: NotApplicable ,
265
+ genetic_unique_identification : Consent :: NotApplicable ,
266
+ biometric_unique_identification : Consent :: NotApplicable ,
267
+ precise_geolocation_data : Consent :: NotApplicable ,
268
+ identification_documents : Consent :: NotApplicable ,
269
+ financial_account_data : Consent :: NotApplicable ,
270
+ union_membership : Consent :: NotApplicable ,
271
+ mail_email_or_text_messages : Consent :: NotApplicable ,
272
+ general_health_data : Consent :: NotApplicable ,
273
+ crime_victim_status : Consent :: NotApplicable ,
274
+ national_origin : Consent :: NotApplicable ,
275
+ transgender_or_nonbinary_status : Consent :: NotApplicable ,
276
+ } ,
277
+ known_child_sensitive_data_consents : KnownChildSensitiveDataConsentsV2 {
278
+ process_sensitive_data_from_13_to_16 : Consent :: NotApplicable ,
279
+ process_sensitive_data_under_13 : Consent :: NotApplicable ,
280
+ process_personal_data_from_16_to_17 : Consent :: NoConsent ,
281
+ } ,
282
+ personal_data_consent : Consent :: NoConsent ,
283
+ mspa_covered_transaction : false ,
284
+ mspa_opt_out_option_mode : MspaMode :: NotApplicable ,
285
+ mspa_service_provider_mode : MspaMode :: NotApplicable ,
286
+ } ) ,
287
+ gpc : Some ( false ) ,
288
+ } ,
289
+ ) ,
189
290
] ;
190
291
191
292
for ( s, expected) in test_cases {
192
293
let actual = UsNat :: from_str ( s) . unwrap ( ) ;
193
294
assert_eq ! ( actual, expected) ;
194
- assert ! ( actual. validate( ) . is_ok( ) ) ;
195
295
}
196
296
}
197
297
0 commit comments