Implementation
ComponentTemplate toDomain() {
switch (type) {
case ComponentType.protection:
return ComponentTemplate.protection(
id: componentId,
name: name,
manufacturer: manufacturer,
series: series,
isFavorite: isFavorite,
ratedCurrent: ratedCurrent!,
curveType: curveType!,
breakingCapacity: breakingCapacity!,
poles: poles!,
deviceType:
protectionDeviceType ?? ProtectionDeviceType.circuitBreaker,
sensitivity: sensitivity,
price: price,
);
case ComponentType.cable:
return ComponentTemplate.cable(
id: componentId,
name: name,
manufacturer: manufacturer,
series: series,
isFavorite: isFavorite,
section: section!,
material: cableMaterial!,
insulationType: insulationType!,
maxOperatingTemp: maxOperatingTemp!,
installationMethod: installationMethod,
price: price,
);
case ComponentType.source:
return ComponentTemplate.source(
id: componentId,
name: name,
manufacturer: manufacturer,
series: series,
isFavorite: isFavorite,
voltage: voltage!,
maxShortCircuitCurrent: maxShortCircuitCurrent!,
ratedPower: ratedPower,
sourceType: sourceType ?? SourceType.grid,
price: price,
);
}
}