Skip to content

Commit

Permalink
share CIL types, union NotLiable type
Browse files Browse the repository at this point in the history
  • Loading branch information
jessicamcinchak committed Dec 9, 2024
1 parent 60d27bc commit 95bd92a
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 59 deletions.
54 changes: 38 additions & 16 deletions schemas/application.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
55 changes: 39 additions & 16 deletions schemas/prototypeApplication.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
15 changes: 1 addition & 14 deletions types/schemas/application/data/ApplicationData.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {CommunityInfrastructureLevy} from '../../../shared/CommunityInfrastructureLevy';
import {Declaration} from '../../../shared/Declarations';
import {Date} from '../../../shared/utils';
import {ApplicationType} from '../enums/ApplicationTypes';
Expand Down Expand Up @@ -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?: {
Expand Down
14 changes: 1 addition & 13 deletions types/schemas/prototypeApplication/data/ApplicationData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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?: {
Expand Down
21 changes: 21 additions & 0 deletions types/shared/CommunityInfrastructureLevy.ts
Original file line number Diff line number Diff line change
@@ -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;
};

0 comments on commit 95bd92a

Please sign in to comment.