import 'dart:convert';

class ResendOtpLoginModel {
  String? username;
  String? channelCode;
  String? porOrgacode;
  String? email;
  bool? isOtpRequire;
  String? phone;
  String? pinType;
  String? userRole;

  ResendOtpLoginModel({
    this.username,
    this.channelCode,
    this.porOrgacode,
    this.email,
    this.isOtpRequire,
    this.phone,
    this.pinType,
    this.userRole,
  });

  Map<String, dynamic> toMap() {
    final result = <String, dynamic>{};

    if (username != null) {
      result.addAll({'username': username});
    }
    if (channelCode != null) {
      result.addAll({'channelCode': channelCode});
    }
    if (porOrgacode != null) {
      result.addAll({'porOrgacode': porOrgacode});
    }
    if (email != null) {
      result.addAll({'email': email});
    }
    if (isOtpRequire != null) {
      result.addAll({'isOtpRequire': isOtpRequire});
    }
    if (phone != null) {
      result.addAll({'phone': phone});
    }
    if (pinType != null) {
      result.addAll({'pinType': pinType});
    }
    if (userRole != null) {
      result.addAll({'userRole': userRole});
    }

    return result;
  }

  factory ResendOtpLoginModel.fromMap(Map<String, dynamic> map) {
    return ResendOtpLoginModel(
      username: map['username'],
      channelCode: map['channelCode'],
      porOrgacode: map['porOrgacode'],
      email: map['email'],
      isOtpRequire: map['isOtpRequire'],
      phone: map['phone'],
      pinType: map['pinType'],
      userRole: map['userRole'],
    );
  }

  String toJson() => json.encode(toMap());

  factory ResendOtpLoginModel.fromJson(String source) =>
      ResendOtpLoginModel.fromMap(json.decode(source));
}
