@planning-inspectorate/data-model 2.51.1 → 2.53.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/enums.cjs CHANGED
@@ -19,11 +19,13 @@ const APPEAL_HAS_CASE_STATUS = Object.freeze({
19
19
  AWAITING_EVENT: 'awaiting_event',
20
20
  AWAITING_TRANSFER: 'awaiting_transfer',
21
21
  CLOSED: 'closed',
22
+ CLOSED_OPENED_IN_ERROR: 'closed_opened_in_error',
22
23
  COMPLETE: 'complete',
23
24
  EVENT: 'event',
24
25
  INVALID: 'invalid',
25
26
  ISSUE_DETERMINATION: 'issue_determination',
26
27
  LPA_QUESTIONNAIRE: 'lpa_questionnaire',
28
+ NOTICE_WITHDRAWN: 'notice_withdrawn',
27
29
  READY_TO_START: 'ready_to_start',
28
30
  TRANSFERRED: 'transferred',
29
31
  VALIDATION: 'validation',
@@ -122,6 +124,7 @@ const APPEAL_CASE_STATUS = Object.freeze({
122
124
  AWAITING_EVENT: 'awaiting_event',
123
125
  AWAITING_TRANSFER: 'awaiting_transfer',
124
126
  CLOSED: 'closed',
127
+ CLOSED_OPENED_IN_ERROR: 'closed_opened_in_error',
125
128
  COMPLETE: 'complete',
126
129
  EVENT: 'event',
127
130
  EVIDENCE: 'evidence',
@@ -129,6 +132,7 @@ const APPEAL_CASE_STATUS = Object.freeze({
129
132
  INVALID: 'invalid',
130
133
  ISSUE_DETERMINATION: 'issue_determination',
131
134
  LPA_QUESTIONNAIRE: 'lpa_questionnaire',
135
+ NOTICE_WITHDRAWN: 'notice_withdrawn',
132
136
  READY_TO_START: 'ready_to_start',
133
137
  STATEMENTS: 'statements',
134
138
  TRANSFERRED: 'transferred',
@@ -258,6 +262,7 @@ const APPEAL_DOCUMENT_TYPE = Object.freeze({
258
262
  LPA_WITNESSES_EVIDENCE: 'lpaWitnessesEvidence',
259
263
  MAIN_PARTY_CORRESPONDENCE: 'mainPartyCorrespondence',
260
264
  NEW_PLANS_DRAWINGS: 'newPlansDrawings',
265
+ NOTICE_WITHDRAWAL: 'noticeWithdrawal',
261
266
  ORIGINAL_APPLICATION_FORM: 'originalApplicationForm',
262
267
  OTHER_NEW_DOCUMENTS: 'otherNewDocuments',
263
268
  OTHER_PARTY_REPRESENTATIONS: 'otherPartyRepresentations',
package/src/enums.d.ts CHANGED
@@ -17,11 +17,13 @@ export const APPEAL_HAS_CASE_STATUS = {
17
17
  AWAITING_EVENT: 'awaiting_event',
18
18
  AWAITING_TRANSFER: 'awaiting_transfer',
19
19
  CLOSED: 'closed',
20
+ CLOSED_OPENED_IN_ERROR: 'closed_opened_in_error',
20
21
  COMPLETE: 'complete',
21
22
  EVENT: 'event',
22
23
  INVALID: 'invalid',
23
24
  ISSUE_DETERMINATION: 'issue_determination',
24
25
  LPA_QUESTIONNAIRE: 'lpa_questionnaire',
26
+ NOTICE_WITHDRAWN: 'notice_withdrawn',
25
27
  READY_TO_START: 'ready_to_start',
26
28
  TRANSFERRED: 'transferred',
27
29
  VALIDATION: 'validation',
@@ -120,6 +122,7 @@ export const APPEAL_CASE_STATUS = {
120
122
  AWAITING_EVENT: 'awaiting_event',
121
123
  AWAITING_TRANSFER: 'awaiting_transfer',
122
124
  CLOSED: 'closed',
125
+ CLOSED_OPENED_IN_ERROR: 'closed_opened_in_error',
123
126
  COMPLETE: 'complete',
124
127
  EVENT: 'event',
125
128
  EVIDENCE: 'evidence',
@@ -127,6 +130,7 @@ export const APPEAL_CASE_STATUS = {
127
130
  INVALID: 'invalid',
128
131
  ISSUE_DETERMINATION: 'issue_determination',
129
132
  LPA_QUESTIONNAIRE: 'lpa_questionnaire',
133
+ NOTICE_WITHDRAWN: 'notice_withdrawn',
130
134
  READY_TO_START: 'ready_to_start',
131
135
  STATEMENTS: 'statements',
132
136
  TRANSFERRED: 'transferred',
@@ -256,6 +260,7 @@ export const APPEAL_DOCUMENT_TYPE = {
256
260
  LPA_WITNESSES_EVIDENCE: 'lpaWitnessesEvidence',
257
261
  MAIN_PARTY_CORRESPONDENCE: 'mainPartyCorrespondence',
258
262
  NEW_PLANS_DRAWINGS: 'newPlansDrawings',
263
+ NOTICE_WITHDRAWAL: 'noticeWithdrawal',
259
264
  ORIGINAL_APPLICATION_FORM: 'originalApplicationForm',
260
265
  OTHER_NEW_DOCUMENTS: 'otherNewDocuments',
261
266
  OTHER_PARTY_REPRESENTATIONS: 'otherPartyRepresentations',
package/src/enums.js CHANGED
@@ -17,11 +17,13 @@ export const APPEAL_HAS_CASE_STATUS = Object.freeze({
17
17
  AWAITING_EVENT: 'awaiting_event',
18
18
  AWAITING_TRANSFER: 'awaiting_transfer',
19
19
  CLOSED: 'closed',
20
+ CLOSED_OPENED_IN_ERROR: 'closed_opened_in_error',
20
21
  COMPLETE: 'complete',
21
22
  EVENT: 'event',
22
23
  INVALID: 'invalid',
23
24
  ISSUE_DETERMINATION: 'issue_determination',
24
25
  LPA_QUESTIONNAIRE: 'lpa_questionnaire',
26
+ NOTICE_WITHDRAWN: 'notice_withdrawn',
25
27
  READY_TO_START: 'ready_to_start',
26
28
  TRANSFERRED: 'transferred',
27
29
  VALIDATION: 'validation',
@@ -120,6 +122,7 @@ export const APPEAL_CASE_STATUS = Object.freeze({
120
122
  AWAITING_EVENT: 'awaiting_event',
121
123
  AWAITING_TRANSFER: 'awaiting_transfer',
122
124
  CLOSED: 'closed',
125
+ CLOSED_OPENED_IN_ERROR: 'closed_opened_in_error',
123
126
  COMPLETE: 'complete',
124
127
  EVENT: 'event',
125
128
  EVIDENCE: 'evidence',
@@ -127,6 +130,7 @@ export const APPEAL_CASE_STATUS = Object.freeze({
127
130
  INVALID: 'invalid',
128
131
  ISSUE_DETERMINATION: 'issue_determination',
129
132
  LPA_QUESTIONNAIRE: 'lpa_questionnaire',
133
+ NOTICE_WITHDRAWN: 'notice_withdrawn',
130
134
  READY_TO_START: 'ready_to_start',
131
135
  STATEMENTS: 'statements',
132
136
  TRANSFERRED: 'transferred',
@@ -256,6 +260,7 @@ export const APPEAL_DOCUMENT_TYPE = Object.freeze({
256
260
  LPA_WITNESSES_EVIDENCE: 'lpaWitnessesEvidence',
257
261
  MAIN_PARTY_CORRESPONDENCE: 'mainPartyCorrespondence',
258
262
  NEW_PLANS_DRAWINGS: 'newPlansDrawings',
263
+ NOTICE_WITHDRAWAL: 'noticeWithdrawal',
259
264
  ORIGINAL_APPLICATION_FORM: 'originalApplicationForm',
260
265
  OTHER_NEW_DOCUMENTS: 'otherNewDocuments',
261
266
  OTHER_PARTY_REPRESENTATIONS: 'otherPartyRepresentations',
package/src/index.cjs CHANGED
@@ -100,11 +100,13 @@ const APPEAL_HAS_CASE_STATUS = Object.freeze({
100
100
  AWAITING_EVENT: 'awaiting_event',
101
101
  AWAITING_TRANSFER: 'awaiting_transfer',
102
102
  CLOSED: 'closed',
103
+ CLOSED_OPENED_IN_ERROR: 'closed_opened_in_error',
103
104
  COMPLETE: 'complete',
104
105
  EVENT: 'event',
105
106
  INVALID: 'invalid',
106
107
  ISSUE_DETERMINATION: 'issue_determination',
107
108
  LPA_QUESTIONNAIRE: 'lpa_questionnaire',
109
+ NOTICE_WITHDRAWN: 'notice_withdrawn',
108
110
  READY_TO_START: 'ready_to_start',
109
111
  TRANSFERRED: 'transferred',
110
112
  VALIDATION: 'validation',
@@ -203,6 +205,7 @@ const APPEAL_CASE_STATUS = Object.freeze({
203
205
  AWAITING_EVENT: 'awaiting_event',
204
206
  AWAITING_TRANSFER: 'awaiting_transfer',
205
207
  CLOSED: 'closed',
208
+ CLOSED_OPENED_IN_ERROR: 'closed_opened_in_error',
206
209
  COMPLETE: 'complete',
207
210
  EVENT: 'event',
208
211
  EVIDENCE: 'evidence',
@@ -210,6 +213,7 @@ const APPEAL_CASE_STATUS = Object.freeze({
210
213
  INVALID: 'invalid',
211
214
  ISSUE_DETERMINATION: 'issue_determination',
212
215
  LPA_QUESTIONNAIRE: 'lpa_questionnaire',
216
+ NOTICE_WITHDRAWN: 'notice_withdrawn',
213
217
  READY_TO_START: 'ready_to_start',
214
218
  STATEMENTS: 'statements',
215
219
  TRANSFERRED: 'transferred',
@@ -339,6 +343,7 @@ const APPEAL_DOCUMENT_TYPE = Object.freeze({
339
343
  LPA_WITNESSES_EVIDENCE: 'lpaWitnessesEvidence',
340
344
  MAIN_PARTY_CORRESPONDENCE: 'mainPartyCorrespondence',
341
345
  NEW_PLANS_DRAWINGS: 'newPlansDrawings',
346
+ NOTICE_WITHDRAWAL: 'noticeWithdrawal',
342
347
  ORIGINAL_APPLICATION_FORM: 'originalApplicationForm',
343
348
  OTHER_NEW_DOCUMENTS: 'otherNewDocuments',
344
349
  OTHER_PARTY_REPRESENTATIONS: 'otherPartyRepresentations',
package/src/schemas.d.ts CHANGED
@@ -232,6 +232,7 @@ export interface AppealDocument {
232
232
  | 'hearingProcess'
233
233
  | 'inquiryCore'
234
234
  | 'inquiryPostEvent'
235
+ | 'noticeWithdrawal'
235
236
  | null;
236
237
  /**
237
238
  * The system mastering the metadata for the current document
@@ -421,7 +422,9 @@ export type AppealHASCase = (GridReference | SiteAddress) & {
421
422
  | 'awaiting_transfer'
422
423
  | 'transferred'
423
424
  | 'event'
424
- | 'awaiting_event';
425
+ | 'awaiting_event'
426
+ | 'notice_withdrawn'
427
+ | 'closed_opened_in_error';
425
428
  /**
426
429
  * The internal code for an appeal type, e.g. D (Householder)
427
430
  */
@@ -1049,7 +1052,9 @@ export type AppealS78Case = (GridReference | SiteAddress) & {
1049
1052
  | 'awaiting_transfer'
1050
1053
  | 'transferred'
1051
1054
  | 'event'
1052
- | 'awaiting_event';
1055
+ | 'awaiting_event'
1056
+ | 'notice_withdrawn'
1057
+ | 'closed_opened_in_error';
1053
1058
  /**
1054
1059
  * The internal code for an appeal type, e.g. D (Householder)
1055
1060
  */
@@ -1701,6 +1706,26 @@ export type AppealS78Case = (GridReference | SiteAddress) & {
1701
1706
  [k: string]: unknown;
1702
1707
  }[]
1703
1708
  | null;
1709
+ /**
1710
+ * Case Officer list of grounds for the appeal & start dates. Enforcement cases (C) can have grounds (a) to (g)
1711
+ */
1712
+ enforcementCaseGroundsOfAppeal?:
1713
+ | {
1714
+ appealGroundLetter?: 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | null;
1715
+ groundForAppealStartDate?: string | null;
1716
+ [k: string]: unknown;
1717
+ }[]
1718
+ | null;
1719
+ /**
1720
+ * Case Officer list of grounds for the appeal & start dates. Enforcement cases (C) can have grounds (a) to (g)
1721
+ */
1722
+ elbCaseGroundsOfAppeal?:
1723
+ | {
1724
+ appealGroundLetter?: 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | null;
1725
+ groundForAppealStartDate?: string | null;
1726
+ [k: string]: unknown;
1727
+ }[]
1728
+ | null;
1704
1729
  /**
1705
1730
  * Was an application made and paid for
1706
1731
  */
@@ -2320,7 +2345,7 @@ export interface EmailNotificationRecordSchema {
2320
2345
  /**
2321
2346
  * Outcome of the email (status)
2322
2347
  */
2323
- emailStatus?: 'Sending' | 'Delivered' | 'Permanent failure' | 'Temporary failure' | 'Technical failure';
2348
+ emailStatus: 'Sending' | 'Delivered' | 'Permanent failure' | 'Temporary failure' | 'Technical failure';
2324
2349
  /**
2325
2350
  * The id of the template sent in Notify
2326
2351
  */
@@ -2379,10 +2404,10 @@ export interface CaseworkRepresentationSchema {
2379
2404
  * The type of case this representation is for.
2380
2405
  */
2381
2406
  caseType: string;
2382
- representationStatus?: 'Awaiting review' | 'Accepted' | 'Rejected' | 'Withdrawn';
2407
+ representationStatus: 'Awaiting review' | 'Accepted' | 'Rejected' | 'Withdrawn';
2383
2408
  submittedFor: 'Myself' | 'On behalf of another person or an organisation';
2384
2409
  submittedByContact?: Contact[] | null;
2385
- submittedByAgentFlag?: boolean | null;
2410
+ submittedByAgent?: boolean | null;
2386
2411
  submittedByAgentOrgName?: string | null;
2387
2412
  submittedDate: string;
2388
2413
  /**
@@ -363,4 +363,45 @@ describe(schema, () => {
363
363
  assert.strictEqual(validationResult, false, 'Expected invalid caseProcedure value to fail validation');
364
364
  });
365
365
  });
366
+
367
+ describe('caseStatus schema validation (Group A - HAS)', () => {
368
+ it('should accept caseStatus values', () => {
369
+ for (const status of [
370
+ 'assign_case_officer',
371
+ 'validation',
372
+ 'ready_to_start',
373
+ 'lpa_questionnaire',
374
+ 'issue_determination',
375
+ 'complete',
376
+ 'invalid',
377
+ 'closed',
378
+ 'withdrawn',
379
+ 'awaiting_transfer',
380
+ 'transferred',
381
+ 'event',
382
+ 'awaiting_event',
383
+ 'notice_withdrawn',
384
+ 'closed_opened_in_error'
385
+ ]) {
386
+ const test = structuredClone(appealHas);
387
+ test.caseStatus = status;
388
+ const validationResult = ajv.validate(schema, test);
389
+ assert.strictEqual(validationResult, true, `Expected caseStatus "${status}" to be valid`);
390
+ }
391
+ });
392
+
393
+ it('should not accept null value for caseStatus', () => {
394
+ const test = structuredClone(appealHas);
395
+ test.caseStatus = null;
396
+ const validationResult = ajv.validate(schema, test);
397
+ assert.strictEqual(validationResult, false, 'Expected caseStatus null not to be valid');
398
+ });
399
+
400
+ it('should reject invalid caseStatus values', () => {
401
+ const test = structuredClone(appealHas);
402
+ test.caseStatus = 'invalid_status';
403
+ const validationResult = ajv.validate(schema, test);
404
+ assert.strictEqual(validationResult, false, 'Expected invalid caseStatus value to fail validation');
405
+ });
406
+ });
366
407
  });
@@ -283,4 +283,45 @@ describe(schema, () => {
283
283
  const validationResult = ajv.validate(schema, test);
284
284
  assert.strictEqual(validationResult, true);
285
285
  });
286
+
287
+ describe('caseStatus schema validation (Group B)', () => {
288
+ it('should accept caseStatus values', () => {
289
+ for (const status of [
290
+ 'assign_case_officer',
291
+ 'validation',
292
+ 'ready_to_start',
293
+ 'lpa_questionnaire',
294
+ 'issue_determination',
295
+ 'complete',
296
+ 'invalid',
297
+ 'closed',
298
+ 'withdrawn',
299
+ 'awaiting_transfer',
300
+ 'transferred',
301
+ 'event',
302
+ 'awaiting_event',
303
+ 'notice_withdrawn',
304
+ 'closed_opened_in_error'
305
+ ]) {
306
+ const test = structuredClone(appealS78);
307
+ test.caseStatus = status;
308
+ const validationResult = ajv.validate(schema, test);
309
+ assert.strictEqual(validationResult, true, `Expected caseStatus "${status}" to be valid`);
310
+ }
311
+ });
312
+
313
+ it('should not accept null value for caseStatus', () => {
314
+ const test = structuredClone(appealS78);
315
+ test.caseStatus = null;
316
+ const validationResult = ajv.validate(schema, test);
317
+ assert.strictEqual(validationResult, false, 'Expected caseStatus null not to be valid');
318
+ });
319
+
320
+ it('should reject invalid caseStatus values', () => {
321
+ const test = structuredClone(appealS78);
322
+ test.caseStatus = 'invalid_status';
323
+ const validationResult = ajv.validate(schema, test);
324
+ assert.strictEqual(validationResult, false, 'Expected invalid caseStatus value to fail validation');
325
+ });
326
+ });
286
327
  });