diff --git a/schemas/application.json b/schemas/application.json index d242ef0e..3ce08307 100644 --- a/schemas/application.json +++ b/schemas/application.json @@ -2766,25 +2766,47 @@ }, "CommunityInfrastructureLevy": { "$id": "#CommunityInfrastructureLevy", - "additionalProperties": false, - "description": "Details about the Community Infrastructure Levy planning charge, if applicable", - "properties": { - "result": { - "enum": [ - "exempt.annexe", - "exempt.extension", - "exempt.selfBuild", - "liable", - "relief.charity", - "relief.socialHousing" + "anyOf": [ + { + "additionalProperties": false, + "properties": { + "result": { + "enum": [ + "exempt.annexe", + "exempt.extension", + "exempt.selfBuild", + "relief.charity", + "relief.socialHousing", + "liable" + ], + "type": "string" + } + }, + "required": [ + "result" ], - "type": "string" + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "declaration": { + "const": true, + "type": "boolean" + }, + "result": { + "const": "notLiable", + "type": "string" + } + }, + "required": [ + "result", + "declaration" + ], + "type": "object" } - }, - "required": [ - "result" ], - "type": "object" + "description": "Details about the Community Infrastructure Levy planning charge, if applicable" }, "ContactDetails": { "additionalProperties": false, diff --git a/schemas/prototypeApplication.json b/schemas/prototypeApplication.json index 16a2c49d..accb68df 100644 --- a/schemas/prototypeApplication.json +++ b/schemas/prototypeApplication.json @@ -517,25 +517,48 @@ "type": "object" }, "CommunityInfrastructureLevy": { - "additionalProperties": false, - "description": "Details about the Community Infrastructure Levy planning charge, if applicable", - "properties": { - "result": { - "enum": [ - "exempt.annexe", - "exempt.extension", - "exempt.selfBuild", - "liable", - "relief.charity", - "relief.socialHousing" + "$id": "#CommunityInfrastructureLevy", + "anyOf": [ + { + "additionalProperties": false, + "properties": { + "result": { + "enum": [ + "exempt.annexe", + "exempt.extension", + "exempt.selfBuild", + "relief.charity", + "relief.socialHousing", + "liable" + ], + "type": "string" + } + }, + "required": [ + "result" ], - "type": "string" + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "declaration": { + "const": true, + "type": "boolean" + }, + "result": { + "const": "notLiable", + "type": "string" + } + }, + "required": [ + "result", + "declaration" + ], + "type": "object" } - }, - "required": [ - "result" ], - "type": "object" + "description": "Details about the Community Infrastructure Levy planning charge, if applicable" }, "ContactDetails": { "additionalProperties": false, diff --git a/types/schemas/application/data/ApplicationData.ts b/types/schemas/application/data/ApplicationData.ts index 8898daed..3117bc53 100644 --- a/types/schemas/application/data/ApplicationData.ts +++ b/types/schemas/application/data/ApplicationData.ts @@ -1,3 +1,4 @@ +import {CommunityInfrastructureLevy} from '../../../shared/CommunityInfrastructureLevy'; import {Declaration} from '../../../shared/Declarations'; import {Date} from '../../../shared/utils'; import {ApplicationType} from '../enums/ApplicationTypes'; @@ -48,20 +49,6 @@ export interface PlanningApplication { localPlanningAuthority: string; } -/** - * @id #CommunityInfrastructureLevy - * @description Details about the Community Infrastructure Levy planning charge, if applicable - */ -export interface CommunityInfrastructureLevy { - result: - | 'exempt.annexe' - | 'exempt.extension' - | 'exempt.selfBuild' - | 'liable' - | 'relief.charity' - | 'relief.socialHousing'; -} - export interface LeadDeveloper { type: 'ukCompany' | 'overseasCompany' | 'none'; company?: { diff --git a/types/schemas/prototypeApplication/data/ApplicationData.ts b/types/schemas/prototypeApplication/data/ApplicationData.ts index cf784b92..be7b8422 100644 --- a/types/schemas/prototypeApplication/data/ApplicationData.ts +++ b/types/schemas/prototypeApplication/data/ApplicationData.ts @@ -2,6 +2,7 @@ import {PrimaryApplicationType} from '../enums/ApplicationType'; import {Date} from '../../../shared/utils'; import {Declaration} from '../../../shared/Declarations'; import {Fee, FeeNotApplicable} from '../../../shared/Fees'; +import {CommunityInfrastructureLevy} from '../../../shared/CommunityInfrastructureLevy'; /** * Base type for ApplicationData. Contains all shared properties across all application types @@ -35,19 +36,6 @@ export interface PlanningApplication { localPlanningAuthority: string; } -/** - * @description Details about the Community Infrastructure Levy planning charge, if applicable - */ -export interface CommunityInfrastructureLevy { - result: - | 'exempt.annexe' - | 'exempt.extension' - | 'exempt.selfBuild' - | 'liable' - | 'relief.charity' - | 'relief.socialHousing'; -} - export interface LeadDeveloper { type: 'ukCompany' | 'overseasCompany' | 'none'; company?: { diff --git a/types/shared/CommunityInfrastructureLevy.ts b/types/shared/CommunityInfrastructureLevy.ts new file mode 100644 index 00000000..6f8c9233 --- /dev/null +++ b/types/shared/CommunityInfrastructureLevy.ts @@ -0,0 +1,21 @@ +/** + * @id #CommunityInfrastructureLevy + * @description Details about the Community Infrastructure Levy planning charge, if applicable + */ +export type CommunityInfrastructureLevy = LiableForCIL | NotLiableForCIL; + +type LiableForCIL = { + // Results are heirarchical (first check if project qualifies for full exemption from CIL, then CIL relief, else plain "liable") + result: + | 'exempt.annexe' + | 'exempt.extension' + | 'exempt.selfBuild' + | 'relief.charity' + | 'relief.socialHousing' + | 'liable'; +}; + +type NotLiableForCIL = { + result: 'notLiable'; + declaration: true; +};