From 04c0bb9cd3eb308f4a7f8caca7f28f7fbb26730c Mon Sep 17 00:00:00 2001 From: Jessica McInchak Date: Tue, 2 Jul 2024 22:22:11 +0200 Subject: [PATCH] full res unit types, refactor enum definitions --- types/enums/ApplicationTypes.ts | 17 +++++ types/enums/BuildingRegulations.ts | 26 +++++++ types/enums/DevelopmentTypes.ts | 17 +++++ types/enums/FileTypes.ts | 17 +++++ types/enums/Flags.ts | 17 +++++ types/enums/HousingProviders.ts | 17 +++++ types/enums/OpenSpaces.ts | 36 ++++++++++ types/enums/PlanningConstraints.ts | 39 +++++++++++ types/enums/ProjectTypes.ts | 17 +++++ types/enums/PropertyTypes.ts | 17 +++++ types/enums/ProtectedSpaces.ts | 20 ++++++ types/enums/ResidentialUnitTypes.ts | 38 +++++++++- types/enums/TenureTypes.ts | 38 +++++++++- types/enums/UseClasses.ts | 17 +++++ types/schema/File.ts | 19 +---- types/schema/Metadata.ts | 6 +- types/schema/PreAssessment.ts | 19 +---- types/schema/data/Application.ts | 19 +---- types/schema/data/Property.ts | 83 +++------------------- types/schema/data/Proposal.ts | 104 +++++----------------------- types/schema/data/shared.ts | 15 ++++ 21 files changed, 376 insertions(+), 222 deletions(-) create mode 100644 types/enums/BuildingRegulations.ts diff --git a/types/enums/ApplicationTypes.ts b/types/enums/ApplicationTypes.ts index 7e65c4f8..ed61080d 100644 --- a/types/enums/ApplicationTypes.ts +++ b/types/enums/ApplicationTypes.ts @@ -135,3 +135,20 @@ export const ApplicationTypes = { 'wtt.notice': 'Works to trees - Notification of proposed works to a tree in a Conservation Area', }; + +type ApplicationTypeKeys = keyof typeof ApplicationTypes; + +type GenericApplicationType = { + value: TKey; + description: (typeof ApplicationTypes)[TKey]; +}; + +type ApplicationTypeMap = { + [K in ApplicationTypeKeys]: GenericApplicationType; +}; + +/** + * @id #ApplicationType + * @description Planning application types + */ +export type ApplicationType = ApplicationTypeMap[keyof ApplicationTypeMap]; diff --git a/types/enums/BuildingRegulations.ts b/types/enums/BuildingRegulations.ts new file mode 100644 index 00000000..ea849ee1 --- /dev/null +++ b/types/enums/BuildingRegulations.ts @@ -0,0 +1,26 @@ +/** + * Values of `data.proposal.units.residential` + */ +export const BuildingRegulations = { + m42: "Part M4(2) of the Building Regulations 2010", + m432a: "Part M4(3)(2a) of the Building Regulations 2010", + m432b: "Part M4(3)(2b) of the Building Regulations 2010", + none: "None of these", +}; + +type BuildingRegulationKeys = keyof typeof BuildingRegulations; + +type GenericBuildingRegulation = { + value: TKey; + description: (typeof BuildingRegulations)[TKey]; +}; + +type BuildingRegulationMap = { + [K in BuildingRegulationKeys]: GenericBuildingRegulation; +}; + +/** + * @id #BuildingRegulation + * @description Building regulations + */ +export type BuildingRegulation = BuildingRegulationMap[keyof BuildingRegulationMap]; diff --git a/types/enums/DevelopmentTypes.ts b/types/enums/DevelopmentTypes.ts index ea8d5c70..671e82f5 100644 --- a/types/enums/DevelopmentTypes.ts +++ b/types/enums/DevelopmentTypes.ts @@ -7,3 +7,20 @@ export const DevelopmentTypes = { newBuild: 'New build', notKnown: 'Not known', }; + +type DevelopmentTypeKeys = keyof typeof DevelopmentTypes; + +type GenericDevelopmentType = { + value: TKey; + description: (typeof DevelopmentTypes)[TKey]; +}; + +type DevelopmentTypeMap = { + [K in DevelopmentTypeKeys]: GenericDevelopmentType; +}; + +/** + * @id #DevelopmentType + * @description Development types + */ +export type DevelopmentType = DevelopmentTypeMap[keyof DevelopmentTypeMap]; diff --git a/types/enums/FileTypes.ts b/types/enums/FileTypes.ts index 45d1191d..fc35956b 100644 --- a/types/enums/FileTypes.ts +++ b/types/enums/FileTypes.ts @@ -105,3 +105,20 @@ export const FileTypes = { wasteAndRecyclingStrategy: 'Waste and recycling strategy', waterEnvironmentAssessment: 'Water environment assessment', }; + +type FileTypeKeys = keyof typeof FileTypes; + +type GenericFileType = { + value: TKey; + description: (typeof FileTypes)[TKey]; +}; + +type FileTypeMap = { + [K in FileTypeKeys]: GenericFileType; +}; + +/** + * @id #FileType + * @description Types of planning documents and drawings + */ +export type FileType = FileTypeMap[keyof FileTypeMap]; diff --git a/types/enums/Flags.ts b/types/enums/Flags.ts index 3b1c6aa5..a98d3581 100644 --- a/types/enums/Flags.ts +++ b/types/enums/Flags.ts @@ -40,3 +40,20 @@ export const Flags = { 'Community infrastructure levy / Liable': '', 'Community infrastructure levy / Not liable': '', }; + +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/enums/HousingProviders.ts b/types/enums/HousingProviders.ts index 508f7ef5..0fa74ff4 100644 --- a/types/enums/HousingProviders.ts +++ b/types/enums/HousingProviders.ts @@ -9,3 +9,20 @@ export const GLAHousingProviders = { publicAuthority: 'Other public authority', selfBuild: 'Self-build', }; + +type GLAHousingProviderKeys = keyof typeof GLAHousingProviders; + +type GenericGLAHousingProvider = { + value: TKey; + description: (typeof GLAHousingProviders)[TKey]; +}; + +type GLAHousingProviderMap = { + [K in GLAHousingProviderKeys]: GenericGLAHousingProvider; +}; + +/** + * @id #GLAHousingProvider + * @description Housing provider categories tracked by the Greater London Authority (GLA) + */ +export type GLAHousingProvider = GLAHousingProviderMap[keyof GLAHousingProviderMap]; diff --git a/types/enums/OpenSpaces.ts b/types/enums/OpenSpaces.ts index 598b3ec8..4a17d541 100644 --- a/types/enums/OpenSpaces.ts +++ b/types/enums/OpenSpaces.ts @@ -21,3 +21,39 @@ export const GLAOpenSpaceDesignations = { none: 'Not designated', other: 'Other designation', }; + +type OpenSpaceTypeKeys = keyof typeof GLAOpenSpaceTypes; + +type GenericOpenSpaceType = { + value: TKey; + description: (typeof GLAOpenSpaceTypes)[TKey]; +}; + +type OpenSpaceTypeMap = { + [K in OpenSpaceTypeKeys]: GenericOpenSpaceType; +}; + +/** + * @id #OpenSpaceType + * @description Types of natural open spaces + */ +export type OpenSpaceType = OpenSpaceTypeMap[keyof OpenSpaceTypeMap]; + +type OpenSpaceDesignationKeys = keyof typeof GLAOpenSpaceDesignations; + +type GenericOpenSpaceDesignation = { + value: TKey; + description: (typeof GLAOpenSpaceDesignations)[TKey]; +}; + +type OpenSpaceDesignationMap = { + [K in OpenSpaceDesignationKeys]: GenericOpenSpaceDesignation; +}; + +/** + * @id #OpenSpaceDesignation + * @description Designations of natural open spaces + */ +export type OpenSpaceDesignation = + OpenSpaceDesignationMap[keyof OpenSpaceDesignationMap]; + \ No newline at end of file diff --git a/types/enums/PlanningConstraints.ts b/types/enums/PlanningConstraints.ts index 10ac5fe4..8a71b6d4 100644 --- a/types/enums/PlanningConstraints.ts +++ b/types/enums/PlanningConstraints.ts @@ -1,3 +1,5 @@ +import { Entity } from "../schema/data/shared"; + /** * Values for `data.property.planning.designations` */ @@ -31,3 +33,40 @@ export const PlanningDesignations = { 'road.classified': 'Classified Road', tpo: 'Tree Preservation Order (TPO) or zone', }; + +type PlanningDesigationKeys = keyof typeof PlanningDesignations; + +type GenericPlanningDesignation = { + value: TKey; + description: (typeof PlanningDesignations)[TKey]; +}; + +type PlanningDesignationMap = { + [K in PlanningDesigationKeys]: GenericPlanningDesignation; +}; + +type BasePlanningDesignation = + PlanningDesignationMap[keyof PlanningDesignationMap]; + +/** + * @description A planning designation that does not intersect with the proposed site, per the DE-9IM spatial relationship definition of intersects + */ +type NonIntersectingPlanningDesignation = { + intersects: false; +} & BasePlanningDesignation; + +/** + * @description A planning designation that does intersect with the proposed site, per the DE-9IM spatial relationship definition of intersects + */ +type IntersectingPlanningDesignation = { + intersects: true; + entities: Entity[] | []; +} & BasePlanningDesignation; + +/** + * @id #PlanningDesignation + * @description Planning designations that may intersect with the proposed site determined by spatial queries against Planning Data (planning.data.gov.uk) and Ordnance Survey + */ +export type PlanningDesignation = + | NonIntersectingPlanningDesignation + | IntersectingPlanningDesignation; diff --git a/types/enums/ProjectTypes.ts b/types/enums/ProjectTypes.ts index 6427c2a2..22d2b41d 100644 --- a/types/enums/ProjectTypes.ts +++ b/types/enums/ProjectTypes.ts @@ -344,3 +344,20 @@ export const ProjectTypes = { 'unit.merge': 'Convert two or more properties into one', 'unit.subdivide': 'Convert a home or part of a home into flats', }; + +type ProjectTypeKeys = keyof typeof ProjectTypes; + +type GenericProjectType = { + value: TKey; + description: (typeof ProjectTypes)[TKey]; +}; + +type ProjectTypeMap = { + [K in ProjectTypeKeys]: GenericProjectType; +}; + +/** + * @id #ProjectType + * @description Planning project types + */ +export type ProjectType = ProjectTypeMap[keyof ProjectTypeMap]; diff --git a/types/enums/PropertyTypes.ts b/types/enums/PropertyTypes.ts index 037757d4..6221ff58 100644 --- a/types/enums/PropertyTypes.ts +++ b/types/enums/PropertyTypes.ts @@ -503,3 +503,20 @@ export const PropertyTypes = { 'object.religious.building.synagogue': 'Synagogue', 'object.religious.building.temple': 'Temple', }; + +type PropertyTypeKeys = keyof typeof PropertyTypes; + +type GenericPropertyType = { + value: TKey; + description: (typeof PropertyTypes)[TKey]; +}; + +type PropertyTypeMap = { + [K in PropertyTypeKeys]: GenericPropertyType; +}; + +/** + * @id #PropertyType + * @description Property types derived from Basic Land and Property Unit (BLPU) classification codes + */ +export type PropertyType = PropertyTypeMap[keyof PropertyTypeMap]; diff --git a/types/enums/ProtectedSpaces.ts b/types/enums/ProtectedSpaces.ts index 3d0969be..3dd78038 100644 --- a/types/enums/ProtectedSpaces.ts +++ b/types/enums/ProtectedSpaces.ts @@ -7,3 +7,23 @@ export const GLAProtectedSpaceDesignations = { none: 'Not designated', SSSI: 'Sites of Special Scientific Interest', }; + +type ProtectedSpaceDesignationKeys = keyof typeof GLAProtectedSpaceDesignations; + +type GenericProtectedSpaceDesignation< + TKey extends ProtectedSpaceDesignationKeys, +> = { + value: TKey; + description: (typeof GLAProtectedSpaceDesignations)[TKey]; +}; + +type ProtectedSpaceDesignationMap = { + [K in ProtectedSpaceDesignationKeys]: GenericProtectedSpaceDesignation; +}; + +/** + * @id #ProtectedSpaceDesignation + * @description Designations of natural protected spaces + */ +export type ProtectedSpaceDesignation = + ProtectedSpaceDesignationMap[keyof ProtectedSpaceDesignationMap]; diff --git a/types/enums/ResidentialUnitTypes.ts b/types/enums/ResidentialUnitTypes.ts index 5519ba94..c98026e8 100644 --- a/types/enums/ResidentialUnitTypes.ts +++ b/types/enums/ResidentialUnitTypes.ts @@ -1,4 +1,4 @@ -export const NationalResidentialUnitTypes = { +export const UKResidentialUnitTypes = { cluster: 'Cluster flat', flat: 'Flat', house: 'House', @@ -23,6 +23,40 @@ export const GLAResidentialUnitTypes = { }; export const ResidentialUnitTypes = { - ...NationalResidentialUnitTypes, + ...UKResidentialUnitTypes, ...GLAResidentialUnitTypes, }; + +type UKResidentialUnitTypeKeys = keyof typeof UKResidentialUnitTypes; + +type GenericUKResidentialUnitType = { + value: TKey; + description: (typeof UKResidentialUnitTypes)[TKey]; +}; + +type UKResidentialUnitTypeMap = { + [K in UKResidentialUnitTypeKeys]: GenericUKResidentialUnitType; +}; + +/** + * @id #UKResidentialUnitType + * @description Residential unit types tracked throughout the UK + */ +export type UKResidentialUnitType = UKResidentialUnitTypeMap[keyof UKResidentialUnitTypeMap]; + +type GLAResidentialUnitTypeKeys = keyof typeof GLAResidentialUnitTypes; + +type GenericGLAResidentialUnitType = { + value: TKey; + description: (typeof GLAResidentialUnitTypes)[TKey]; +}; + +type GLAResidentialUnitTypeMap = { + [K in GLAResidentialUnitTypeKeys]: GenericGLAResidentialUnitType; +}; + +/** + * @id #GLAResidentialUnitType + * @description Residential unit types tracked by the Greater London Authority (GLA) + */ +export type GLAResidentialUnitType = GLAResidentialUnitTypeMap[keyof GLAResidentialUnitTypeMap]; \ No newline at end of file diff --git a/types/enums/TenureTypes.ts b/types/enums/TenureTypes.ts index 75f07dcc..fea207b6 100644 --- a/types/enums/TenureTypes.ts +++ b/types/enums/TenureTypes.ts @@ -1,4 +1,4 @@ -export const NationalTenureTypes = { +export const UKTenureTypes = { AHO: 'Affordable home ownership', MH: 'Market housing', other: 'Other', @@ -25,6 +25,40 @@ export const GLATenureTypes = { }; export const TenureTypes = { - ...NationalTenureTypes, + ...UKTenureTypes, ...GLATenureTypes, }; + +type UKTenureTypeKeys = keyof typeof UKTenureTypes; + +type GenericUKTenureType = { + value: TKey; + description: (typeof UKTenureTypes)[TKey]; +}; + +type UKTenureTypeMap = { + [K in UKTenureTypeKeys]: GenericUKTenureType; +}; + +/** + * @id #UKTenureType + * @description Tenure types tracked throughout the UK + */ +export type UKTenureType = UKTenureTypeMap[keyof UKTenureTypeMap]; + +type GLATenureTypeKeys = keyof typeof GLATenureTypes; + +type GenericGLATenureType = { + value: TKey; + description: (typeof GLATenureTypes)[TKey]; +}; + +type GLATenureTypeMap = { + [K in GLATenureTypeKeys]: GenericGLATenureType; +}; + +/** + * @id #GLATenureType + * @description Tenure types tracked by the Greater London Authority (GLA) + */ +export type GLATenureType = GLATenureTypeMap[keyof GLATenureTypeMap]; diff --git a/types/enums/UseClasses.ts b/types/enums/UseClasses.ts index 0a158bf6..8c016946 100644 --- a/types/enums/UseClasses.ts +++ b/types/enums/UseClasses.ts @@ -12,3 +12,20 @@ export const GLAUseClasses = { SG: 'Sui generis', unknown: 'Not known', }; + +type GLAUseClassKeys = keyof typeof GLAUseClasses; + +type GenericGLAUseClass = { + value: TKey; + description: (typeof GLAUseClasses)[TKey]; +}; + +type GLAUseClassMap = { + [K in GLAUseClassKeys]: GenericGLAUseClass; +}; + +/** + * @id #GLAUseClass + * @description Use classes tracked by the Greater London Authority (GLA) + */ +export type GLAUseClass = GLAUseClassMap[keyof GLAUseClassMap]; \ No newline at end of file diff --git a/types/schema/File.ts b/types/schema/File.ts index 0b744e42..55c55cec 100644 --- a/types/schema/File.ts +++ b/types/schema/File.ts @@ -1,4 +1,4 @@ -import {FileTypes} from '../enums/FileTypes'; +import {FileType} from '../enums/FileTypes'; /** * @id #File @@ -9,20 +9,3 @@ export interface File { type: FileType[]; description?: string; } - -type FileTypeKeys = keyof typeof FileTypes; - -type GenericFileType = { - value: TKey; - description: (typeof FileTypes)[TKey]; -}; - -type FileTypeMap = { - [K in FileTypeKeys]: GenericFileType; -}; - -/** - * @id #FileType - * @description Types of planning documents and drawings - */ -export type FileType = FileTypeMap[keyof FileTypeMap]; diff --git a/types/schema/Metadata.ts b/types/schema/Metadata.ts index a7a434b0..83307e49 100644 --- a/types/schema/Metadata.ts +++ b/types/schema/Metadata.ts @@ -1,6 +1,6 @@ -import {DateTime, URL, UUID} from './../utils'; -import {FileType} from './File'; -import {QuestionMetaData} from './Responses'; +import { FileType } from '../enums/FileTypes'; +import { DateTime, URL, UUID } from './../utils'; +import { QuestionMetaData } from './Responses'; /** * @id #DigitalPlanningMetadata diff --git a/types/schema/PreAssessment.ts b/types/schema/PreAssessment.ts index e11099b9..c7b1ea46 100644 --- a/types/schema/PreAssessment.ts +++ b/types/schema/PreAssessment.ts @@ -1,24 +1,7 @@ -import {Flags} from '../enums/Flags'; +import {ResultFlag} 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/data/Application.ts b/types/schema/data/Application.ts index 0373465a..063fd533 100644 --- a/types/schema/data/Application.ts +++ b/types/schema/data/Application.ts @@ -1,4 +1,4 @@ -import {ApplicationTypes} from '../../enums/ApplicationTypes'; +import { ApplicationType } from '../../enums/ApplicationTypes'; import {Date} from '../../utils'; /** @@ -180,20 +180,3 @@ export interface LeadDeveloper { registrationNumber: string; }; } - -type ApplicationTypeKeys = keyof typeof ApplicationTypes; - -type GenericApplicationType = { - value: TKey; - description: (typeof ApplicationTypes)[TKey]; -}; - -type ApplicationTypeMap = { - [K in ApplicationTypeKeys]: GenericApplicationType; -}; - -/** - * @id #ApplicationType - * @description Planning application types - */ -export type ApplicationType = ApplicationTypeMap[keyof ApplicationTypeMap]; diff --git a/types/schema/data/Property.ts b/types/schema/data/Property.ts index 99cf025b..19ff3f0d 100644 --- a/types/schema/data/Property.ts +++ b/types/schema/data/Property.ts @@ -1,7 +1,9 @@ -import {PlanningDesignations} from '../../enums/PlanningConstraints'; -import {PropertyTypes} from '../../enums/PropertyTypes'; -import {Date, URL} from '../../utils'; -import {GeoBoundary, Materials} from './shared'; +import { PlanningDesignation } from '../../enums/PlanningConstraints'; +import { PropertyType } from '../../enums/PropertyTypes'; +import { UKResidentialUnitType } from "../../enums/ResidentialUnitTypes"; +import { UKTenureType } from "../../enums/TenureTypes"; +import { Date, URL } from '../../utils'; +import { Entity, GeoBoundary, Materials } from './shared'; /** * @id #Property @@ -71,8 +73,8 @@ export interface UKProperty { }; units?: { residential: { - tenure: string; // enum - type: string; // enum + tenure: UKTenureType; + type: UKResidentialUnitType; bedrooms: number; identicalUnits: number; }[]; @@ -187,60 +189,6 @@ export interface OSAddress extends SiteAddress { source: 'Ordnance Survey'; } -type PropertyTypeKeys = keyof typeof PropertyTypes; - -type GenericPropertyType = { - value: TKey; - description: (typeof PropertyTypes)[TKey]; -}; - -type PropertyTypeMap = { - [K in PropertyTypeKeys]: GenericPropertyType; -}; - -/** - * @id #PropertyType - * @description Property types derived from Basic Land and Property Unit (BLPU) classification codes - */ -export type PropertyType = PropertyTypeMap[keyof PropertyTypeMap]; - -type PlanningDesigationKeys = keyof typeof PlanningDesignations; - -type GenericPlanningDesignation = { - value: TKey; - description: (typeof PlanningDesignations)[TKey]; -}; - -type PlanningDesignationMap = { - [K in PlanningDesigationKeys]: GenericPlanningDesignation; -}; - -type BasePlanningDesignation = - PlanningDesignationMap[keyof PlanningDesignationMap]; - -/** - * @description A planning designation that does not intersect with the proposed site, per the DE-9IM spatial relationship definition of intersects - */ -type NonIntersectingPlanningDesignation = { - intersects: false; -} & BasePlanningDesignation; - -/** - * @description A planning designation that does intersect with the proposed site, per the DE-9IM spatial relationship definition of intersects - */ -type IntersectingPlanningDesignation = { - intersects: true; - entities: Entity[] | []; -} & BasePlanningDesignation; - -/** - * @id #PlanningDesignation - * @description Planning designations that may intersect with the proposed site determined by spatial queries against Planning Data (planning.data.gov.uk) and Ordnance Survey - */ -export type PlanningDesignation = - | NonIntersectingPlanningDesignation - | IntersectingPlanningDesignation; - type BasePlanningConstraint = { value: string; description: string; @@ -268,18 +216,3 @@ type IntersectingPlanningConstraint = { export type PlanningConstraint = | NonIntersectingPlanningConstraint | IntersectingPlanningConstraint; - -type Entity = { - name: string; - description?: string; - source: PlanningDataSource | OSRoadsSource; -}; - -type PlanningDataSource = { - text: 'Planning Data'; - url: URL; -}; - -type OSRoadsSource = { - text: 'Ordnance Survey MasterMap Highways'; -}; diff --git a/types/schema/data/Proposal.ts b/types/schema/data/Proposal.ts index 3b7d6b07..186786f5 100644 --- a/types/schema/data/Proposal.ts +++ b/types/schema/data/Proposal.ts @@ -1,11 +1,16 @@ +import { BuildingRegulation } from '../../enums/BuildingRegulations'; +import { DevelopmentType } from '../../enums/DevelopmentTypes'; +import { GLAHousingProvider } from "../../enums/HousingProviders"; import { - GLAOpenSpaceTypes, - GLAOpenSpaceDesignations, + OpenSpaceDesignation, + OpenSpaceType } from '../../enums/OpenSpaces'; -import {GLAProtectedSpaceDesignations} from '../../enums/ProtectedSpaces'; -import {ProjectTypes} from '../../enums/ProjectTypes'; -import {Area, Date} from '../../utils'; -import {GeoBoundary, Materials} from './shared'; +import { ProjectType } from '../../enums/ProjectTypes'; +import { ProtectedSpaceDesignation } from '../../enums/ProtectedSpaces'; +import { GLAResidentialUnitType, UKResidentialUnitType } from '../../enums/ResidentialUnitTypes'; +import { GLATenureType } from '../../enums/TenureTypes'; +import { Area, Date } from '../../utils'; +import { GeoBoundary, Materials } from './shared'; /** * @id #Proposal @@ -106,8 +111,8 @@ export interface BaseProposal { }; units?: { residential: { - development: string; // enum - type: string; // enum + development: DevelopmentType; + type: UKResidentialUnitType; bedrooms: number; identicalUnits: number; }[]; @@ -268,96 +273,23 @@ export interface ProposalDates { completion?: Date; } -type ProjectTypeKeys = keyof typeof ProjectTypes; - -type GenericProjectType = { - value: TKey; - description: (typeof ProjectTypes)[TKey]; -}; - -type ProjectTypeMap = { - [K in ProjectTypeKeys]: GenericProjectType; -}; - -/** - * @id #ProjectType - * @description Planning project types - */ -export type ProjectType = ProjectTypeMap[keyof ProjectTypeMap]; - -type OpenSpaceTypeKeys = keyof typeof GLAOpenSpaceTypes; - -type GenericOpenSpaceType = { - value: TKey; - description: (typeof GLAOpenSpaceTypes)[TKey]; -}; - -type OpenSpaceTypeMap = { - [K in OpenSpaceTypeKeys]: GenericOpenSpaceType; -}; - -/** - * @id #OpenSpaceType - * @description Types of natural open spaces - */ -export type OpenSpaceType = OpenSpaceTypeMap[keyof OpenSpaceTypeMap]; - -type OpenSpaceDesignationKeys = keyof typeof GLAOpenSpaceDesignations; - -type GenericOpenSpaceDesignation = { - value: TKey; - description: (typeof GLAOpenSpaceDesignations)[TKey]; -}; - -type OpenSpaceDesignationMap = { - [K in OpenSpaceDesignationKeys]: GenericOpenSpaceDesignation; -}; - -/** - * @id #OpenSpaceDesignation - * @description Designations of natural open spaces - */ -export type OpenSpaceDesignation = - OpenSpaceDesignationMap[keyof OpenSpaceDesignationMap]; - -type ProtectedSpaceDesignationKeys = keyof typeof GLAProtectedSpaceDesignations; - -type GenericProtectedSpaceDesignation< - TKey extends ProtectedSpaceDesignationKeys, -> = { - value: TKey; - description: (typeof GLAProtectedSpaceDesignations)[TKey]; -}; - -type ProtectedSpaceDesignationMap = { - [K in ProtectedSpaceDesignationKeys]: GenericProtectedSpaceDesignation; -}; - -/** - * @id #ProtectedSpaceDesignation - * @description Designations of natural protected spaces - */ -export type ProtectedSpaceDesignation = - ProtectedSpaceDesignationMap[keyof ProtectedSpaceDesignationMap]; - interface GLARetainedUnit { bedrooms: number; - tenure: string; // enum - type: string; // enum + tenure: GLATenureType; + type: GLAResidentialUnitType; identicalUnits: number; } interface GLALostUnit extends GLARetainedUnit { habitableRooms: number; - compliance: string; // enum - provider: string; // enum + compliance: BuildingRegulation[]; + provider: GLAHousingProvider; area: Area; sheltered: boolean; olderPersons: boolean; } interface GLAGainedUnit extends GLALostUnit { - development: string; // enum + development: DevelopmentType; garden: boolean; - sheltered: boolean; } diff --git a/types/schema/data/shared.ts b/types/schema/data/shared.ts index d2a2c603..58706ffc 100644 --- a/types/schema/data/shared.ts +++ b/types/schema/data/shared.ts @@ -16,3 +16,18 @@ export type GeoBoundary = { site: GeoJSON; area: Area; }; + +export type Entity = { + name: string; + description?: string; + source: PlanningDataSource | OSRoadsSource; +}; + +type PlanningDataSource = { + text: 'Planning Data'; + url: URL; +}; + +type OSRoadsSource = { + text: 'Ordnance Survey MasterMap Highways'; +}; \ No newline at end of file