@planning-inspectorate/data-model 1.18.1 → 1.20.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.
Files changed (40) hide show
  1. package/.github/dependabot.yml +5 -0
  2. package/docs/README.md +20 -0
  3. package/docs/nsip-project-defs-invoice.md +267 -0
  4. package/docs/nsip-project-defs-meeting.md +122 -0
  5. package/docs/nsip-project-defs.md +3 -0
  6. package/docs/nsip-project.md +1889 -7
  7. package/package.json +4 -4
  8. package/pins_data_model/models/model_appeal_document.py +1 -1
  9. package/pins_data_model/models/model_appeal_event.py +1 -1
  10. package/pins_data_model/models/model_appeal_event_estimate.py +1 -1
  11. package/pins_data_model/models/model_appeal_has.py +1 -1
  12. package/pins_data_model/models/model_appeal_representation.py +1 -1
  13. package/pins_data_model/models/model_appeal_s78.py +1 -1
  14. package/pins_data_model/models/model_dart_response.py +1 -1
  15. package/pins_data_model/models/model_entraid.py +1 -1
  16. package/pins_data_model/models/model_folder.py +1 -1
  17. package/pins_data_model/models/model_gettimesheets_response.py +1 -1
  18. package/pins_data_model/models/model_listed_building.py +1 -1
  19. package/pins_data_model/models/model_listed_buildings.py +1 -1
  20. package/pins_data_model/models/model_nsip_document.py +1 -1
  21. package/pins_data_model/models/model_nsip_exam_timetable.py +1 -1
  22. package/pins_data_model/models/model_nsip_project.py +535 -3
  23. package/pins_data_model/models/model_nsip_project_update.py +1 -1
  24. package/pins_data_model/models/model_nsip_representation.py +1 -1
  25. package/pins_data_model/models/model_nsip_subscription.py +1 -1
  26. package/pins_data_model/models/model_pins_inspector.py +1 -1
  27. package/pins_data_model/models/model_pins_lpa.py +1 -1
  28. package/pins_data_model/models/model_s51_advice.py +1 -1
  29. package/pins_data_model/models/model_service_user.py +1 -1
  30. package/schemas/commands/lpa-questionnaire-cas-advert.schema.json +95 -0
  31. package/schemas/commands/lpa-questionnaire.schema.json +3 -1
  32. package/schemas/nsip-project.schema.json +420 -2
  33. package/src/enums.cjs +678 -581
  34. package/src/enums.d.ts +668 -583
  35. package/src/enums.js +668 -583
  36. package/src/index.cjs +678 -581
  37. package/src/lib/gen-enums.js +1 -1
  38. package/src/schemas.d.ts +408 -4
  39. package/tests/appeals/commands/adverts-questionnaire.test.js +15 -9
  40. package/tests/appeals/commands/cas-adverts-questionnaire.test.js +98 -0
@@ -11,7 +11,7 @@ export const constPath = path.join(__dirname, '..', 'enums.js');
11
11
  export const constTsPath = path.join(__dirname, '..', 'enums.d.ts');
12
12
 
13
13
  const SPACING = ' ';
14
- const NEW_LINE = '\r\n';
14
+ const NEW_LINE = '\n';
15
15
 
16
16
  /**
17
17
  * Load all schemas and generate JS constant definitions
package/src/schemas.d.ts CHANGED
@@ -2090,9 +2090,18 @@ export interface NSIPProject {
2090
2090
  projectDescription: string | null;
2091
2091
  projectDescriptionWelsh?: string | null;
2092
2092
  /**
2093
- * Decision: approved/refused/split-decision
2094
- */
2095
- decision: 'approved' | 'refused' | 'split-decision' | null;
2093
+ * Decision outcome: approved/refused/split-decision/granted/partially_consented/quashed/redetermination/withdrawn
2094
+ */
2095
+ decision:
2096
+ | 'approved'
2097
+ | 'refused'
2098
+ | 'split-decision'
2099
+ | 'granted'
2100
+ | 'partially_consented'
2101
+ | 'quashed'
2102
+ | 'redetermination'
2103
+ | 'withdrawn'
2104
+ | null;
2096
2105
  publishStatus: 'published' | 'unpublished' | null;
2097
2106
  /**
2098
2107
  * {Sector Abbreviation} - {Sector Display Name}
@@ -2382,6 +2391,284 @@ export interface NSIPProject {
2382
2391
  * Is this an application for a material change?
2383
2392
  */
2384
2393
  isMaterialChange?: boolean | null;
2394
+ /**
2395
+ * Date of court decision
2396
+ */
2397
+ courtDecisionDate?: string | null;
2398
+ /**
2399
+ * Court decision outcome text; values include 'upheld','partially_upheld','quashed','other:<Text>'
2400
+ */
2401
+ courtDecisionOutcomeText?: string | null;
2402
+ /**
2403
+ * Date of decision challenge submission
2404
+ */
2405
+ decisionChallengeSubmissionDate?: string | null;
2406
+ /**
2407
+ * Recommendation
2408
+ */
2409
+ recommendation?: 'recommend_consent' | 'recommend_partial_consent' | 'recommend_refusal' | null;
2410
+ /**
2411
+ * Date of inception meeting
2412
+ */
2413
+ inceptionMeetingDate?: string | null;
2414
+ /**
2415
+ * Date for submission of draft documents
2416
+ */
2417
+ draftDocumentSubmissionDate?: string | null;
2418
+ /**
2419
+ * Programme document submission date
2420
+ */
2421
+ programmeDocumentSubmissionDate?: string | null;
2422
+ /**
2423
+ * Tier
2424
+ */
2425
+ tier?: 'basic' | 'standard' | 'enhanced' | null;
2426
+ /**
2427
+ * Link to s61 summary
2428
+ */
2429
+ s61SummaryURI?: string | null;
2430
+ /**
2431
+ * Estimated scoping submission date
2432
+ */
2433
+ estimatedScopingSubmissionDate?: string | null;
2434
+ /**
2435
+ * Adequacy of Consultation Milestone
2436
+ */
2437
+ consultationMilestoneAdequacyDate?: string | null;
2438
+ /**
2439
+ * Evidence plan process
2440
+ */
2441
+ planProcessEvidence?: boolean | null;
2442
+ /**
2443
+ * Issues tracker
2444
+ */
2445
+ issuesTracker?: string | null;
2446
+ /**
2447
+ * Essential fast track components
2448
+ */
2449
+ essentialFastTrackComponents?: boolean | null;
2450
+ /**
2451
+ * Principal area disagreement summary statement (PADSS)
2452
+ */
2453
+ principalAreaDisagreementSummaryStmt?: 'submitted_by_applicant' | 'awaiting_submission' | 'not_applicable' | null;
2454
+ /**
2455
+ * Principal area disagreement summary statement (PADSS) Submitted date
2456
+ */
2457
+ principalAreaDisagreementSummaryStmtSubmittedDate?: string | null;
2458
+ /**
2459
+ * Policy compliance document (PCD)
2460
+ */
2461
+ policyComplianceDocument?: 'submitted_by_applicant' | 'awaiting_submission' | 'not_applicable' | null;
2462
+ /**
2463
+ * Policy compliance document (PCD) Submitted Date
2464
+ */
2465
+ policyComplianceDocumentSubmittedDate?: string | null;
2466
+ /**
2467
+ * Design approach document (DAD)
2468
+ */
2469
+ designApproachDocument?: 'submitted_by_applicant' | 'awaiting_submission' | 'not_applicable' | null;
2470
+ /**
2471
+ * Design approach document (DAD) Submitted Date
2472
+ */
2473
+ designApproachDocumentSubmittedDate?: string | null;
2474
+ /**
2475
+ * Mature outline control documents
2476
+ */
2477
+ matureOutlineControlDocument?: 'submitted_by_applicant' | 'awaiting_submission' | 'not_applicable' | null;
2478
+ /**
2479
+ * Mature outline control documents Submitted Date
2480
+ */
2481
+ matureOutlineControlDocumentSubmittedDate?: string | null;
2482
+ /**
2483
+ * CA and TP evidence
2484
+ */
2485
+ caAndTpEvidence?: 'submitted_by_applicant' | 'awaiting_submission' | 'not_applicable' | null;
2486
+ /**
2487
+ * CA and TP evidence Submitted Date
2488
+ */
2489
+ caAndTpEvidenceSubmittedDate?: string | null;
2490
+ /**
2491
+ * Public sector equality duty (PSED)
2492
+ */
2493
+ publicSectorEqualityDuty?: 'submitted_by_applicant' | 'awaiting_submission' | 'not_applicable' | null;
2494
+ /**
2495
+ * Public sector equality duty (PSED) Submitted Date
2496
+ */
2497
+ publicSectorEqualityDutySubmittedDate?: string | null;
2498
+ /**
2499
+ * Fast track admission document
2500
+ */
2501
+ fastTrackAdmissionDocument?: 'submitted_by_applicant' | 'awaiting_submission' | 'not_applicable' | null;
2502
+ /**
2503
+ * Fast track admission document Submitted Date
2504
+ */
2505
+ fastTrackAdmissionDocumentSubmittedDate?: string | null;
2506
+ /**
2507
+ * Multiparty application readiness gate-check (trial)
2508
+ */
2509
+ multipartyApplicationCheckDocument?: 'submitted_by_applicant' | 'awaiting_submission' | 'not_applicable' | null;
2510
+ /**
2511
+ * Multiparty application readiness gate-check Submitted Date (trial)
2512
+ */
2513
+ multipartyApplicationCheckDocumentSubmittedDate?: string | null;
2514
+ /**
2515
+ * Link to programme document
2516
+ */
2517
+ programmeDocumentURI?: string | null;
2518
+ /**
2519
+ * Date updated programme document is received
2520
+ */
2521
+ updatedProgrammeDocumentReceivedDate?: string | null;
2522
+ /**
2523
+ * Date programme document reviewed by EST
2524
+ */
2525
+ programmeDocumentReviewedByEstDate?: string | null;
2526
+ /**
2527
+ * Date case team issued comments on programme document
2528
+ */
2529
+ caseTeamIssuedCommentsDate?: string | null;
2530
+ /**
2531
+ * Project type
2532
+ */
2533
+ subProjectType?:
2534
+ | 'energy_from_waste'
2535
+ | 'gas_power_station'
2536
+ | 'hydrogen_power_station'
2537
+ | 'nuclear'
2538
+ | 'offshore_wind'
2539
+ | 'onshore_wind'
2540
+ | 'solar'
2541
+ | null;
2542
+ /**
2543
+ * New maturity
2544
+ */
2545
+ newMaturity?: 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | null;
2546
+ /**
2547
+ * Statutory consultation period end date
2548
+ */
2549
+ statutoryConsultationPeriodEndDate?: string | null;
2550
+ /**
2551
+ * Date for submission of draft documents
2552
+ */
2553
+ submissionOfDraftDocumentsDate?: string | null;
2554
+ /**
2555
+ * Number of band 2 inspectors
2556
+ */
2557
+ numberBand2Inspectors?: number | null;
2558
+ /**
2559
+ * Number of band 3 inspectors
2560
+ */
2561
+ numberBand3Inspectors?: number | null;
2562
+ /**
2563
+ * MEM (last updated)
2564
+ */
2565
+ memLastUpdated?: string | null;
2566
+ /**
2567
+ * Additional comments
2568
+ */
2569
+ additionalComments?: string | null;
2570
+ /**
2571
+ * Maps to [Employee].[EmployeeID].
2572
+ */
2573
+ operationsLeadIds?: string[];
2574
+ /**
2575
+ * New NSIP role, Maps to [Employee].[EmployeeID]
2576
+ */
2577
+ operationsManagerIds?: string[];
2578
+ /**
2579
+ * Maps to [Employee].[EmployeeID].
2580
+ */
2581
+ caseManagerIds?: string[];
2582
+ /**
2583
+ * Maps to [Employee].[EmployeeID].
2584
+ */
2585
+ leadInspectorIds?: string[];
2586
+ /**
2587
+ * Maps to [Employee].[EmployeeID].
2588
+ */
2589
+ environmentalServicesOfficerIds?: string[];
2590
+ /**
2591
+ * Maps to [Employee].[EmployeeID].
2592
+ */
2593
+ legalOfficerIds?: string[];
2594
+ /**
2595
+ * Collection of meetings associated with this project
2596
+ */
2597
+ meetings?: Meeting[];
2598
+ /**
2599
+ * Collection of invoices associated with this project
2600
+ */
2601
+ invoices?: Invoice[];
2602
+ [k: string]: unknown;
2603
+ }
2604
+ /**
2605
+ * A meeting related to the project
2606
+ */
2607
+ export interface Meeting {
2608
+ /**
2609
+ * Meeting agenda
2610
+ */
2611
+ meetingAgenda?: string | null;
2612
+ /**
2613
+ * Planning Inspectorate role
2614
+ */
2615
+ planningInspectorateRole?: 'facilitator' | 'advisor' | 'observer' | null;
2616
+ /**
2617
+ * Meeting date
2618
+ */
2619
+ meetingDate?: string | null;
2620
+ /**
2621
+ * Type of Meeting
2622
+ */
2623
+ meetingType?: string | null;
2624
+ [k: string]: unknown;
2625
+ }
2626
+ /**
2627
+ * An invoice related to the project
2628
+ */
2629
+ export interface Invoice {
2630
+ /**
2631
+ * Invoice stage
2632
+ */
2633
+ invoiceStage?:
2634
+ | 'pre_acceptance'
2635
+ | 'acceptance'
2636
+ | 'pre_examination'
2637
+ | 'initial_examination'
2638
+ | 'final_examination'
2639
+ | null;
2640
+ /**
2641
+ * Invoice number
2642
+ */
2643
+ invoiceNumber: string;
2644
+ /**
2645
+ * Amount due
2646
+ */
2647
+ amountDue: number;
2648
+ /**
2649
+ * Payment due date
2650
+ */
2651
+ paymentDueDate?: string | null;
2652
+ /**
2653
+ * Invoiced date
2654
+ */
2655
+ invoicedDate?: string | null;
2656
+ /**
2657
+ * Date of payment
2658
+ */
2659
+ paymentDate?: string | null;
2660
+ /**
2661
+ * Refund credit note number
2662
+ */
2663
+ refundCreditNoteNumber?: string | null;
2664
+ /**
2665
+ * Amount refunded
2666
+ */
2667
+ refundAmount?: number | null;
2668
+ /**
2669
+ * Refund issue date
2670
+ */
2671
+ refundIssueDate?: string | null;
2385
2672
  [k: string]: unknown;
2386
2673
  }
2387
2674
 
@@ -3597,6 +3884,64 @@ export interface Address {
3597
3884
  country?: string;
3598
3885
  }
3599
3886
 
3887
+ /**
3888
+ * Schema defining any cas advert specific properties for LPAQ submissions
3889
+ */
3890
+ export type LPAQCasAdvertSubmissionProperties = {
3891
+ /**
3892
+ * Indicates that a scheduled monument is affected
3893
+ */
3894
+ affectsScheduledMonument?: boolean | null;
3895
+ /**
3896
+ * Indicates the existence of protected species
3897
+ */
3898
+ hasProtectedSpecies?: boolean | null;
3899
+ /**
3900
+ * Indicates an area of outstanding beauty (National Landscape)
3901
+ */
3902
+ isAonbNationalLandscape?: boolean | null;
3903
+ /**
3904
+ * The designated site names
3905
+ */
3906
+ designatedSitesNames?: string[] | null;
3907
+ /**
3908
+ * Indicates statutory consultees
3909
+ */
3910
+ hasStatutoryConsultees?: boolean | null;
3911
+ /**
3912
+ * The details of the bodies consulted
3913
+ */
3914
+ consultedBodiesDetails?: string | null;
3915
+ /**
3916
+ * Indicates emerging plans
3917
+ */
3918
+ hasEmergingPlan?: boolean | null;
3919
+ /**
3920
+ * The procedure preference indicated by the LPA
3921
+ */
3922
+ lpaProcedurePreference?: 'written' | 'hearing' | 'inquiry' | null;
3923
+ /**
3924
+ * The procedure details preference indicated by the LPA
3925
+ */
3926
+ lpaProcedurePreferenceDetails?: string | null;
3927
+ /**
3928
+ * The duration of enquiry indicated by the LPA
3929
+ */
3930
+ lpaProcedurePreferenceDuration?: number | null;
3931
+ /**
3932
+ * Indicates if the site is in an area of special control for adverts
3933
+ */
3934
+ isSiteInAreaOfSpecialControlAdverts?: boolean | null;
3935
+ /**
3936
+ * Indicates if the application was refused because of highway or traffic public safety?
3937
+ */
3938
+ wasApplicationRefusedDueToHighwayOrTraffic?: boolean | null;
3939
+ /**
3940
+ * Indicates if the appellant submitted complete and accurate photographs and plans
3941
+ */
3942
+ didAppellantSubmitCompletePhotosAndPlans?: boolean | null;
3943
+ };
3944
+
3600
3945
  /**
3601
3946
  * Schema defining any properties common across all appeal types for LPAQ submissions
3602
3947
  */
@@ -4010,6 +4355,63 @@ export type LPAQS78SubmissionProperties = {
4010
4355
  */
4011
4356
  lpaProcedurePreferenceDuration?: number | null;
4012
4357
  };
4358
+ /**
4359
+ * Schema defining any cas advert specific properties for LPAQ submissions
4360
+ */
4361
+ export type LPAQCasAdvertSubmissionProperties = {
4362
+ /**
4363
+ * Indicates that a scheduled monument is affected
4364
+ */
4365
+ affectsScheduledMonument?: boolean | null;
4366
+ /**
4367
+ * Indicates the existence of protected species
4368
+ */
4369
+ hasProtectedSpecies?: boolean | null;
4370
+ /**
4371
+ * Indicates an area of outstanding beauty (National Landscape)
4372
+ */
4373
+ isAonbNationalLandscape?: boolean | null;
4374
+ /**
4375
+ * The designated site names
4376
+ */
4377
+ designatedSitesNames?: string[] | null;
4378
+ /**
4379
+ * Indicates statutory consultees
4380
+ */
4381
+ hasStatutoryConsultees?: boolean | null;
4382
+ /**
4383
+ * The details of the bodies consulted
4384
+ */
4385
+ consultedBodiesDetails?: string | null;
4386
+ /**
4387
+ * Indicates emerging plans
4388
+ */
4389
+ hasEmergingPlan?: boolean | null;
4390
+ /**
4391
+ * The procedure preference indicated by the LPA
4392
+ */
4393
+ lpaProcedurePreference?: 'written' | 'hearing' | 'inquiry' | null;
4394
+ /**
4395
+ * The procedure details preference indicated by the LPA
4396
+ */
4397
+ lpaProcedurePreferenceDetails?: string | null;
4398
+ /**
4399
+ * The duration of enquiry indicated by the LPA
4400
+ */
4401
+ lpaProcedurePreferenceDuration?: number | null;
4402
+ /**
4403
+ * Indicates if the site is in an area of special control for adverts
4404
+ */
4405
+ isSiteInAreaOfSpecialControlAdverts?: boolean | null;
4406
+ /**
4407
+ * Indicates if the application was refused because of highway or traffic public safety?
4408
+ */
4409
+ wasApplicationRefusedDueToHighwayOrTraffic?: boolean | null;
4410
+ /**
4411
+ * Indicates if the appellant submitted complete and accurate photographs and plans
4412
+ */
4413
+ didAppellantSubmitCompletePhotosAndPlans?: boolean | null;
4414
+ };
4013
4415
 
4014
4416
  /**
4015
4417
  * Schema defining the data produced by the Front-Office when an LPA Questionnaire is submitted
@@ -4027,7 +4429,9 @@ export interface LPAQuestionnaireCommand {
4027
4429
  LPAQS78SubmissionProperties)
4028
4430
  | ({
4029
4431
  caseType?: 'H' | 'ZA';
4030
- } & LPAQCommonSubmissionProperties);
4432
+ } & LPAQCommonSubmissionProperties &
4433
+ LPAQHASSubmissionProperties &
4434
+ LPAQCasAdvertSubmissionProperties);
4031
4435
  documents: {
4032
4436
  /**
4033
4437
  * The unique identifier for the document
@@ -49,12 +49,25 @@ const exampleAdvertQuestionnaireSchema = {
49
49
  'ullamco quis',
50
50
  'voluptate quis'
51
51
  ],
52
- lpaCostsAppliedFor: null
52
+ lpaCostsAppliedFor: null,
53
+ affectsScheduledMonument: null,
54
+ hasProtectedSpecies: null,
55
+ isAonbNationalLandscape: null,
56
+ designatedSitesNames: null,
57
+ hasStatutoryConsultees: null,
58
+ consultedBodiesDetails: null,
59
+ hasEmergingPlan: null,
60
+ lpaProcedurePreference: null,
61
+ lpaProcedurePreferenceDetails: null,
62
+ lpaProcedurePreferenceDuration: null,
63
+ isSiteInAreaOfSpecialControlAdverts: null,
64
+ wasApplicationRefusedDueToHighwayOrTraffic: null,
65
+ didAppellantSubmitCompletePhotosAndPlans: null
53
66
  },
54
67
  documents: [document]
55
68
  };
56
69
 
57
- describe('HAS questionnaire command schema', () => {
70
+ describe('Adverts questionnaire command schema', () => {
58
71
  const schemas = loadAllSchemasSync();
59
72
  const flatSchemas = Object.values(schemas).reduce((a, c) => ({ ...a, ...c }), {});
60
73
  const ajv = new Ajv({ schemas: flatSchemas, allErrors: true });
@@ -65,13 +78,6 @@ describe('HAS questionnaire command schema', () => {
65
78
  assert.strictEqual(validationResult, true);
66
79
  });
67
80
 
68
- it('should allow valid schema for CAS Advert', () => {
69
- const test = structuredClone(exampleAdvertQuestionnaireSchema);
70
- test.casedata.caseType = 'ZA';
71
- const validationResult = ajv.validate(schema, test);
72
- assert.strictEqual(validationResult, true);
73
- });
74
-
75
81
  it('should reject missing caseReference', () => {
76
82
  const test = structuredClone(exampleAdvertQuestionnaireSchema);
77
83
  delete test.casedata.caseReference;
@@ -0,0 +1,98 @@
1
+ import { describe, it } from 'node:test';
2
+ import assert from 'node:assert';
3
+ import Ajv from 'ajv';
4
+ import addFormats from 'ajv-formats';
5
+ import { loadAllSchemasSync } from '../../../src/index.js';
6
+
7
+ const schema = 'lpa-questionnaire.schema.json';
8
+
9
+ const document = {
10
+ documentId: 'deserunt sint aliqua adipisicing dolore',
11
+ filename: 'ut dolore',
12
+ originalFilename: 'Lorem amet fugiat adipisicing Excepteur',
13
+ size: -90476934,
14
+ mime: 'magna labore exercitation ut',
15
+ documentURI: 'ut reprehenderit',
16
+ dateCreated: '1933-04-03T03:24:38.0Z',
17
+ documentType: 'plansDrawings'
18
+ };
19
+
20
+ const exampleCasAdvertQuestionnaireSchema = {
21
+ casedata: {
22
+ caseType: 'ZA',
23
+ caseReference: 'nisi incididunt cillum',
24
+ lpaQuestionnaireSubmittedDate: null,
25
+ lpaStatement: 'consequat ex',
26
+ siteAccessDetails: null,
27
+ siteSafetyDetails: null,
28
+ isCorrectAppealType: null,
29
+ isGreenBelt: null,
30
+ inConservationArea: null,
31
+ newConditionDetails: 'anim sint ut aute',
32
+ notificationMethod: null,
33
+ nearbyCaseReferences: null,
34
+ neighbouringSiteAddresses: [
35
+ {
36
+ neighbouringSiteAddressLine1: 'commodo dolore incididunt',
37
+ neighbouringSiteAddressLine2: 'est voluptate irure aliqua elit',
38
+ neighbouringSiteAddressTown: 'labore aliquip ex incididunt nulla',
39
+ neighbouringSiteAddressCounty: 'enim ut Duis ut ex',
40
+ neighbouringSiteAddressPostcode: 'pariatur',
41
+ neighbouringSiteAccessDetails: 'aliqua irure mollit consequat nisi',
42
+ neighbouringSiteSafetyDetails: null
43
+ }
44
+ ],
45
+ affectedListedBuildingNumbers: [
46
+ 'occaecat id aliquip dolore',
47
+ 'magna',
48
+ 'minim laboris fugiat id aliqua',
49
+ 'ullamco quis',
50
+ 'voluptate quis'
51
+ ],
52
+ lpaCostsAppliedFor: null,
53
+ affectsScheduledMonument: null,
54
+ hasProtectedSpecies: null,
55
+ isAonbNationalLandscape: null,
56
+ designatedSitesNames: null,
57
+ hasStatutoryConsultees: null,
58
+ consultedBodiesDetails: null,
59
+ hasEmergingPlan: null,
60
+ lpaProcedurePreference: null,
61
+ lpaProcedurePreferenceDetails: null,
62
+ lpaProcedurePreferenceDuration: null,
63
+ isSiteInAreaOfSpecialControlAdverts: null,
64
+ wasApplicationRefusedDueToHighwayOrTraffic: null,
65
+ didAppellantSubmitCompletePhotosAndPlans: null
66
+ },
67
+ documents: [document]
68
+ };
69
+
70
+ describe('CAS Advert questionnaire command schema', () => {
71
+ const schemas = loadAllSchemasSync();
72
+ const flatSchemas = Object.values(schemas).reduce((a, c) => ({ ...a, ...c }), {});
73
+ const ajv = new Ajv({ schemas: flatSchemas, allErrors: true });
74
+ addFormats(ajv);
75
+
76
+ it('should allow valid schema for CAS Advert', () => {
77
+ const validationResult = ajv.validate(schema, exampleCasAdvertQuestionnaireSchema);
78
+ assert.strictEqual(validationResult, true);
79
+ });
80
+
81
+ it('should reject missing caseReference', () => {
82
+ const test = structuredClone(exampleCasAdvertQuestionnaireSchema);
83
+ delete test.casedata.caseReference;
84
+ const validationResult = ajv.validate(schema, test);
85
+ assert.strictEqual(validationResult, false);
86
+ assert.strictEqual(
87
+ ajv.errors.some((x) => x.message === "must have required property 'caseReference'"),
88
+ true
89
+ );
90
+ });
91
+
92
+ it('should allow additional props', () => {
93
+ const test = structuredClone(exampleCasAdvertQuestionnaireSchema);
94
+ test.test = 1;
95
+ const validationResult = ajv.validate(schema, test);
96
+ assert.strictEqual(validationResult, true);
97
+ });
98
+ });