-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(wip): Initial setup of a generic application type
- Loading branch information
1 parent
ef0937d
commit be6815f
Showing
5 changed files
with
229 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
{ | ||
"$id": "@next", | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"anyOf": [ | ||
{ | ||
"$ref": "#/definitions/PlanningPermissionApplication" | ||
}, | ||
{ | ||
"$ref": "#/definitions/PriorApprovalApplication" | ||
}, | ||
{ | ||
"$ref": "#/definitions/WorksToTreesApplication" | ||
} | ||
], | ||
"definitions": { | ||
"PPUser": { | ||
"additionalProperties": false, | ||
"properties": { | ||
"ppSpecificProperty": { | ||
"type": "boolean" | ||
}, | ||
"role": { | ||
"enum": [ | ||
"applicant", | ||
"agent", | ||
"proxy" | ||
], | ||
"type": "string" | ||
} | ||
}, | ||
"required": [ | ||
"ppSpecificProperty", | ||
"role" | ||
], | ||
"type": "object" | ||
}, | ||
"PlanningPermissionApplication": { | ||
"additionalProperties": false, | ||
"description": "Application for a \"Planning Permission\" project", | ||
"properties": { | ||
"data": { | ||
"additionalProperties": false, | ||
"properties": { | ||
"user": { | ||
"$ref": "#/definitions/PPUser" | ||
} | ||
}, | ||
"required": [ | ||
"user" | ||
], | ||
"type": "object" | ||
}, | ||
"primaryApplicationType": { | ||
"const": "pp", | ||
"type": "string" | ||
} | ||
}, | ||
"required": [ | ||
"primaryApplicationType", | ||
"data" | ||
], | ||
"type": "object" | ||
}, | ||
"PriorApprovalApplication": { | ||
"additionalProperties": false, | ||
"description": "Application for a \"Prior Approval\" project", | ||
"properties": { | ||
"data": { | ||
"additionalProperties": false, | ||
"properties": { | ||
"user": { | ||
"$ref": "#/definitions/UserBase" | ||
} | ||
}, | ||
"required": [ | ||
"user" | ||
], | ||
"type": "object" | ||
}, | ||
"primaryApplicationType": { | ||
"const": "pa", | ||
"type": "string" | ||
} | ||
}, | ||
"required": [ | ||
"primaryApplicationType", | ||
"data" | ||
], | ||
"type": "object" | ||
}, | ||
"UserBase": { | ||
"additionalProperties": false, | ||
"properties": { | ||
"role": { | ||
"enum": [ | ||
"applicant", | ||
"agent", | ||
"proxy" | ||
], | ||
"type": "string" | ||
} | ||
}, | ||
"required": [ | ||
"role" | ||
], | ||
"type": "object" | ||
}, | ||
"WTTUser": { | ||
"additionalProperties": false, | ||
"properties": { | ||
"role": { | ||
"enum": [ | ||
"applicant", | ||
"agent", | ||
"proxy" | ||
], | ||
"type": "string" | ||
}, | ||
"wttSpecificProperty": { | ||
"type": "boolean" | ||
} | ||
}, | ||
"required": [ | ||
"role", | ||
"wttSpecificProperty" | ||
], | ||
"type": "object" | ||
}, | ||
"WorksToTreesApplication": { | ||
"additionalProperties": false, | ||
"description": "Application for a \"Works to trees\" project", | ||
"properties": { | ||
"data": { | ||
"additionalProperties": false, | ||
"properties": { | ||
"user": { | ||
"$ref": "#/definitions/WTTUser" | ||
} | ||
}, | ||
"required": [ | ||
"user" | ||
], | ||
"type": "object" | ||
}, | ||
"primaryApplicationType": { | ||
"const": "wtt", | ||
"type": "string" | ||
} | ||
}, | ||
"required": [ | ||
"primaryApplicationType", | ||
"data" | ||
], | ||
"type": "object" | ||
} | ||
}, | ||
"description": "The root specification for a planning application in England generated by a digital planning service", | ||
"title": "App" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import {PrimaryApplicationTypes} from '../digitalPlanningApplication/enums/ApplicationTypes'; | ||
|
||
export interface UserBase { | ||
role: 'applicant' | 'agent' | 'proxy'; | ||
} | ||
|
||
export interface WTTUser extends UserBase { | ||
wttSpecificProperty: boolean; | ||
} | ||
|
||
export interface PPUser extends UserBase { | ||
ppSpecificProperty: boolean; | ||
} | ||
|
||
/** | ||
* @internal | ||
*/ | ||
interface UserVariants { | ||
wtt: WTTUser; | ||
pp: PPUser; | ||
} | ||
|
||
/** | ||
* @internal | ||
*/ | ||
export type User<T extends PrimaryApplicationTypes> = | ||
T extends keyof UserVariants | ||
? UserVariants[T] | ||
: // Default value for non-specific application types | ||
UserBase; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import {PrimaryApplicationTypes} from '../digitalPlanningApplication/enums/ApplicationTypes'; | ||
import {User} from './User'; | ||
|
||
interface GenericApplication<T extends PrimaryApplicationTypes> { | ||
primaryApplicationType: T; | ||
data: { | ||
user: User<T>; | ||
}; | ||
} | ||
|
||
/** | ||
* @description Application for a "Planning Permission" project | ||
*/ | ||
export type PlanningPermissionApplication = GenericApplication<'pp'>; | ||
|
||
/** | ||
* @description Application for a "Prior Approval" project | ||
*/ | ||
export type PriorApprovalApplication = GenericApplication<'pa'>; | ||
|
||
/** | ||
* @description Application for a "Works to trees" project | ||
*/ | ||
export type WorksToTreesApplication = GenericApplication<'wtt'>; | ||
|
||
/** | ||
* @title App | ||
* @description The root specification for a planning application in England generated by a digital planning service | ||
*/ | ||
export type App = | ||
| PlanningPermissionApplication | ||
| PriorApprovalApplication | ||
| WorksToTreesApplication; |