import 'dart:convert';

LoginResponseModel loginResponseModelFromJson(String str) => LoginResponseModel.fromJson(json.decode(str));

String loginResponseModelToJson(LoginResponseModel data) => json.encode(data.toJson());

class LoginResponseModel {
  final String name;
  final String cmpCuststatus;
  final dynamic cmpCustlastlogin;
  final String cmpCustcode;
  final String userRole;
  final String jwtToken;
  final String refreshToken;
  final String? cmpCustImage;
  final bool isKycVerified;
  final bool isTranPinSet;

  LoginResponseModel({
    required this.name,
    required this.cmpCuststatus,
    required this.cmpCustlastlogin,
    required this.cmpCustcode,
    required this.userRole,
    required this.jwtToken,
    required this.refreshToken,
    this.cmpCustImage,
    required this.isKycVerified,
    required this.isTranPinSet,
  });

  LoginResponseModel copyWith({
    String? name,
    String? cmpCuststatus,
    dynamic cmpCustlastlogin,
    String? cmpCustcode,
    String? userRole,
    String? jwtToken,
    String? refreshToken,
    String? cmpCustImage,
    bool? isKycVerified,
    bool? isTranPinSet,
  }) =>
      LoginResponseModel(
        name: name ?? this.name,
        cmpCuststatus: cmpCuststatus ?? this.cmpCuststatus,
        cmpCustlastlogin: cmpCustlastlogin ?? this.cmpCustlastlogin,
        cmpCustcode: cmpCustcode ?? this.cmpCustcode,
        userRole: userRole ?? this.userRole,
        jwtToken: jwtToken ?? this.jwtToken,
        refreshToken: refreshToken ?? this.refreshToken,
        cmpCustImage: cmpCustImage ?? this.cmpCustImage,
        isKycVerified: isKycVerified ?? this.isKycVerified,
        isTranPinSet: isTranPinSet ?? this.isTranPinSet,
      );

  factory LoginResponseModel.fromJson(Map<String, dynamic> json) => LoginResponseModel(
    name: json["name"],
    cmpCuststatus: json["cmpCuststatus"],
    cmpCustlastlogin: json["cmpCustlastlogin"],
    cmpCustcode: json["cmpCustcode"],
    userRole: json["userRole"],
    jwtToken: json["jwtToken"],
    refreshToken: json["refreshToken"],
    cmpCustImage: json["cmpCustImage"],
    isKycVerified: json["isKycVerified"],
    isTranPinSet: json["isTranPinSet"],
  );

  Map<String, dynamic> toJson() => {
    "name": name,
    "cmpCuststatus": cmpCuststatus,
    "cmpCustlastlogin": cmpCustlastlogin,
    "cmpCustcode": cmpCustcode,
    "userRole": userRole,
    "jwtToken": jwtToken,
    "refreshToken": refreshToken,
    "cmpCustImage": cmpCustImage,
    "isKycVerified": isKycVerified,
    "isTranPinSet": isTranPinSet,
  };

  @override
  String toString() {
    return 'LoginResponseModel{name: $name, cmpCuststatus: $cmpCuststatus, cmpCustlastlogin: $cmpCustlastlogin, cmpCustcode: $cmpCustcode, userRole: $userRole, jwtToken: $jwtToken, refreshToken: $refreshToken, cmpCustImage: $cmpCustImage, isKycVerified: $isKycVerified, isTranPinSet: $isTranPinSet}';
  }
}
