import 'package:hl_lieferservice/dto/component.dart'; class Component { Component({ required this.articleNumber, required this.name, required this.quantity, required this.position, this.scannedAmount = 0, }); final String articleNumber; final String name; final double quantity; final double position; int scannedAmount; /// Required scan count derived from BOM quantity (e.g. 7.0 → 7). int get requiredAmount => quantity.ceil(); bool get isFullyScanned => scannedAmount >= requiredAmount; bool get needsScanning => scannedAmount < requiredAmount; factory Component.fromDTO(ComponentDTO dto) { return Component( articleNumber: dto.articleNr, name: dto.name, quantity: double.tryParse(dto.quantity) ?? 0.0, position: double.tryParse(dto.pos) ?? 0.0, ); } }