class BranchUser {
  int id;
  String? userId;
  int? serviceProviderId;
  int? dealershipUserID;
  String? firstName;
  String? lastName;
  String? mobileNo;
  String? email;
  bool? isBranchUser;
  int? serviceProviderBranchID;

  BranchUser({
    required this.id,
    required this.userId,
    required this.serviceProviderId,
    required this.dealershipUserID,
    required this.firstName,
    required this.lastName,
    required this.mobileNo,
    required this.email,
    required this.isBranchUser,
    this.serviceProviderBranchID,
  });

  factory BranchUser.fromJson(Map<String, dynamic> json) => BranchUser(
        id: json["id"],
        userId: json.containsKey("userID") ? json["userID"] : null,
        serviceProviderId: json.containsKey("serviceProviderID")
            ? json["serviceProviderID"]
            : null,
        dealershipUserID: json.containsKey("dealershipUserID")
            ? json["dealershipUserID"]
            : null,
        firstName: json.containsKey("firstName") ? json["firstName"] : null,
        lastName: json.containsKey("lastName") ? json["lastName"] : null,
        mobileNo: json.containsKey("mobileNo") ? json["mobileNo"] : null,
        email: json.containsKey("email") ? json["email"] : null,
        isBranchUser:
            json.containsKey("isBranchUser") ? json["isBranchUser"] : false,
        serviceProviderBranchID: json.containsKey("serviceProviderBranchID")
            ? json["serviceProviderBranchID"]
            : null,
      );

  Map<String, dynamic> toJson() =>
      {
        "id": id,
        "userID": userId,
        "serviceProviderID": serviceProviderId,
        "firstName": firstName,
        "lastName": lastName,
        "mobileNo": mobileNo,
        "email": email,
        "isBranchUser": isBranchUser,
      };
}
