Implementation
ElectricalNodeDto toDto() {
return map(
source: (e) => ElectricalNodeDto.source(
id: e.id,
name: e.name,
state: e.state,
nominalVoltage: e.nominalVoltage,
shortCircuitCapacity: e.shortCircuitCapacity,
mainFeedCable: e.mainFeedCable,
lastMeasurement: e.lastMeasurement,
assetMetadata: e.assetMetadata,
children: e.children.map((c) => c.toDto()).toList(),
),
panel: (e) => ElectricalNodeDto.panel(
id: e.id,
name: e.name,
state: e.state,
nominalVoltage: e.nominalVoltage,
inputCable: e.inputCable,
lastMeasurement: e.lastMeasurement,
assetMetadata: e.assetMetadata,
children: e.children.map((c) => c.toDto()).toList(),
),
protection: (e) => ElectricalNodeDto.protection(
id: e.id,
name: e.name,
state: e.state,
lastMeasurement: e.lastMeasurement,
assetMetadata: e.assetMetadata,
protectionType: e.protectionType,
ratingAmps: e.ratingAmps,
pdc: e.pdc,
curve: e.curve,
sensitivity: e.sensitivity,
poles: e.poles,
children: e.children.map((c) => c.toDto()).toList(),
catalogData: e.catalogData,
cableCatalogData: e.cableCatalogData,
),
load: (e) => ElectricalNodeDto.load(
id: e.id,
name: e.name,
state: e.state,
inputCable: e.inputCable,
powerWatts: e.powerWatts,
cosPhi: e.cosPhi,
type: e.type,
lastMeasurement: e.lastMeasurement,
assetMetadata: e.assetMetadata,
isThreePhase: e.isThreePhase,
cableCatalogData: e.cableCatalogData,
),
);
}