Searching for an effective method to map a table of enum (or interface) data to the correct location.
https://i.sstatic.net/5hF2q.png
For instance, Smoke Sensor - Push Button can only be linked to SS - PI SYMBOL and Smoke Sensor - PushButton can only be associated with 000 - TTT PARAMETER.
I hope you understand what I mean.
How do I establish these mappings?
Updated:
I am attempting to achieve this using TypeScript:
export enum IName {
SmokeSensor = 'SmokeSensor',
GasSensor = 'GasSensor',
MotionSensor = 'MotionSensor',
WindowSensor = 'WindowSensor',
Sensor = 'Sensor',
PushButton = 'PushButton',
Switch = 'Switch',
Temperature = 'Temperature',
}
export enum ISymbol {
SS = 'SS',
SG = 'SG',
SM = 'SM',
SW = 'SW',
SE = 'SE',
PI = 'PI',
SI = 'SI',
TI = 'TI',
}
export enum IParameter {
TTT = 'TTT',
OOO = '000',
OFF = 'OFF',
OON = 'OON',
POS = '0',
NEG = '1',
}
interface IActivateSensors {
name: Omit<IName, 'Switch' & 'Temperature'>
symbol: Omit<ISymbol, 'SI' & 'TI'>
parameter: Pick<IParameter, 'TTT' & '000'>
}
interface ISwitchSensor {
name: IName.Switch
symbol: ISymbol.SI
parameter: Pick<IParameter, 'OFF' & 'OON'>
}
interface ITemperatureSensor {
name: IName.Temperature
symbol: Omit<ISymbol, 'SI' & 'TI'>
parameter: Pick<IParameter, 'TTT' & '000'>
}
export type Sensors = IActivateSensors | ITemperatureSensor | ISwitchSensor
However, there may be a more efficient way to accomplish this.