import 'package:syncrow_web/pages/device_managment/all_devices/models/device_status.dart';

abstract class PowerClampModel1 {
  String get productUuid;
  String get productType;
}

class PowerClampBatchModel extends PowerClampModel1 {
  @override
  final String productUuid;
  @override
  final String productType;
  final List<Status> status;

  PowerClampBatchModel({
    required this.productUuid,
    required this.productType,
    required this.status,
  });

  factory PowerClampBatchModel.fromJson(Map<String, dynamic> json) {
    String productUuid = json['productUuid'] ?? '';
    String productType = json['productType'] ?? '';

    List<Status> statusList = [];
    if (json['status'] != null && json['status'] is List) {
      statusList =
          (json['status'] as List).map((e) => Status.fromJson(e)).toList();
    }

    return PowerClampBatchModel(
      productUuid: productUuid,
      productType: productType,
      status: statusList,
    );
  }

  PowerClampBatchModel copyWith({
    String? productUuid,
    String? productType,
    List<Status>? status,
  }) {
    return PowerClampBatchModel(
      productUuid: productUuid ?? this.productUuid,
      productType: productType ?? this.productType,
      status: status ?? this.status,
    );
  }
}
