import 'package:test_sa/models/base.dart';

class FaultDescription extends Base {
  FaultDescription({
    this.id,
    this.defectName,
    this.workPerformed,
    this.estimatedTime,
  }) : super(name: defectName, identifier: id?.toString());

  FaultDescription.fromJson(dynamic json) {
    id = json['id'];
    identifier = id.toString();
    defectName = json['defectName'];
    name = defectName;
    workPerformed = json['workPerformed'];
    estimatedTime = json['estimatedTime'];
  }

  num? id;
  String? defectName;
  String? workPerformed;
  String? estimatedTime;

  FaultDescription copyWith({
    num? id,
    String? defectName,
    String? workPerformed,
    String? estimatedTime,
  }) =>
      FaultDescription(
        id: id ?? this.id,
        defectName: defectName ?? this.defectName,
        workPerformed: workPerformed ?? this.workPerformed,
        estimatedTime: estimatedTime ?? this.estimatedTime,
      );

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['id'] = id;
    map['defectName'] = defectName;
    map['workPerformed'] = workPerformed;
    map['estimatedTime'] = estimatedTime;
    return map;
  }
}
