class Employee {
  String? id;
  String? name;

  Employee({
    this.id,
    this.name,
  });

  factory Employee.fromJson(Map<String, dynamic>? parsedJson) {
    if (parsedJson == null) return Employee();
    return Employee(
      id: parsedJson["userId"] ?? parsedJson["id"],
      name: parsedJson["userName"] ?? parsedJson["name"],
    );
  }

  factory Employee.fromEngineer(Employee? department) {
    return Employee(
      id: department?.id,
      name: department?.name,
    );
  }

  @override
  bool operator ==(Object other) => identical(this, other) || other is Employee && id == other.id;

  @override
  int get hashCode => id.hashCode;

  Map<String, dynamic> toJson({bool userPrefix = false}) {
    return {
      userPrefix ? "userId" : "id": id,
      userPrefix ? "userName" : "name": name,
    };
  }
}
