diff --git a/examples/data/ldcE.ts b/examples/data/ldcE.ts index 4e59f2d4..34b4a34a 100644 --- a/examples/data/ldcE.ts +++ b/examples/data/ldcE.ts @@ -322,7 +322,7 @@ export const validLDCE: Schema = { date: {}, }, }, - result: [ + preAssessment: [ { value: 'Planning permission / Immune', description: diff --git a/examples/data/ldcP.ts b/examples/data/ldcP.ts index 3134e7af..8b401c82 100644 --- a/examples/data/ldcP.ts +++ b/examples/data/ldcP.ts @@ -242,7 +242,7 @@ export const validLDCP: Schema = { }, }, }, - result: [ + preAssessment: [ { value: 'Planning permission / Permitted development', description: diff --git a/examples/data/planningPermission.ts b/examples/data/planningPermission.ts index 56f06773..92e7b286 100644 --- a/examples/data/planningPermission.ts +++ b/examples/data/planningPermission.ts @@ -405,7 +405,7 @@ export const validPlanningPermission: Schema = { }, }, }, - result: [], + preAssessment: [], responses: [ { question: 'Is the property in Lambeth?', diff --git a/examples/data/priorApproval.ts b/examples/data/priorApproval.ts index 6855cd21..36494082 100644 --- a/examples/data/priorApproval.ts +++ b/examples/data/priorApproval.ts @@ -263,7 +263,7 @@ export const validPriorApproval: Schema = { }, }, }, - result: [ + preAssessment: [ { value: 'Planning permission / Prior approval', description: diff --git a/schema/schema.json b/schema/schema.json index 9bfb8dc6..4006cbe1 100644 --- a/schema/schema.json +++ b/schema/schema.json @@ -5362,6 +5362,14 @@ ], "type": "object" }, + "PreAssessment": { + "$id": "#PreAssessment", + "description": "The result of the application based on information provided by the applicant, prior to assessment by a planning officer. Results are determined by flags corresponding to responses; each application can have up to one result per flagset", + "items": { + "$ref": "#/definitions/ResultFlag" + }, + "type": "array" + }, "ProjectType": { "$id": "#ProjectType", "anyOf": [ @@ -17571,14 +17579,6 @@ }, "type": "array" }, - "Result": { - "$id": "#Result", - "description": "The result of the application. Results are determined by flags corresponding to responses; each application can have up to one result per flagset", - "items": { - "$ref": "#/definitions/ResultFlag" - }, - "type": "array" - }, "ResultFlag": { "$id": "#ResultFlag", "anyOf": [ @@ -18827,19 +18827,18 @@ "metadata": { "$ref": "#/definitions/Metadata" }, + "preAssessment": { + "$ref": "#/definitions/PreAssessment" + }, "responses": { "$ref": "#/definitions/Responses" - }, - "result": { - "$ref": "#/definitions/Result" } }, "required": [ "data", - "result", - "metadata", "responses", - "files" + "files", + "metadata" ], "title": "Digital Planning Application", "type": "object" diff --git a/types/Schema.ts b/types/Schema.ts index 5f9e9589..6f087637 100644 --- a/types/Schema.ts +++ b/types/Schema.ts @@ -1,12 +1,12 @@ -import {Result} from './schema/Result'; +import {File} from './schema/File'; import {Metadata} from './schema/Metadata'; +import {PreAssessment} from './schema/PreAssessment'; import {Responses} from './schema/Responses'; import {Applicant} from './schema/data/Applicant'; import {Application} from './schema/data/Application'; import {Property} from './schema/data/Property'; import {Proposal} from './schema/data/Proposal'; import {User} from './schema/data/User'; -import {File} from './schema/File'; /** * @title Digital Planning Application @@ -20,8 +20,8 @@ export interface Schema { property: Property; proposal: Proposal; }; - result: Result; - metadata: Metadata; + preAssessment?: PreAssessment; responses: Responses; files: File[]; + metadata: Metadata; } diff --git a/types/schema/PreAssessment.ts b/types/schema/PreAssessment.ts new file mode 100644 index 00000000..e11099b9 --- /dev/null +++ b/types/schema/PreAssessment.ts @@ -0,0 +1,24 @@ +import {Flags} from '../enums/Flags'; + +/** + * @id #PreAssessment + * @description The result of the application based on information provided by the applicant, prior to assessment by a planning officer. Results are determined by flags corresponding to responses; each application can have up to one result per flagset + */ +export type PreAssessment = ResultFlag[]; // @todo validate/restrict array to one result per flagset + +type FlagKeys = keyof typeof Flags; + +type GenericFlag = { + value: TKey; + description: (typeof Flags)[TKey]; +}; + +type FlagMap = { + [K in FlagKeys]: GenericFlag; +}; + +/** + * @id #ResultFlag + * @description The result of a single flagset + */ +export type ResultFlag = FlagMap[keyof FlagMap]; diff --git a/types/schema/Result.ts b/types/schema/Result.ts deleted file mode 100644 index 05ad18de..00000000 --- a/types/schema/Result.ts +++ /dev/null @@ -1,24 +0,0 @@ -import {Flags} from '../enums/Flags'; - -/** - * @id #Result - * @description The result of the application. Results are determined by flags corresponding to responses; each application can have up to one result per flagset - */ -export type Result = ResultFlag[]; // @todo validate/restrict array to one result per flagset - -type FlagKeys = keyof typeof Flags; - -type GenericFlag = { - value: TKey; - description: (typeof Flags)[TKey]; -}; - -type FlagMap = { - [K in FlagKeys]: GenericFlag; -}; - -/** - * @id #ResultFlag - * @description The result of a single flagset - */ -export type ResultFlag = FlagMap[keyof FlagMap];