import 'dart:convert';

class CreateTransactionPinRequest {
  String newTransPincode;
  String channelCode;
  String pctCstycode;
  String porOrgacode;
  String cmpCustcode;
  bool isOtpRequired;
  String pinType;
  CreateTransactionPinRequest({
    required this.newTransPincode,
    required this.channelCode,
    required this.pctCstycode,
    required this.porOrgacode,
    required this.cmpCustcode,
    required this.isOtpRequired,
    required this.pinType,
  });

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

    result.addAll({'newTransPincode': newTransPincode});
    result.addAll({'channelCode': channelCode});
    result.addAll({'pctCstycode': pctCstycode});
    result.addAll({'porOrgacode': porOrgacode});
    result.addAll({'cmpCustcode': cmpCustcode});
    result.addAll({'isOtpRequired': isOtpRequired});
    result.addAll({'pinType': pinType});

    return result;
  }

  factory CreateTransactionPinRequest.fromMap(Map<String, dynamic> map) {
    return CreateTransactionPinRequest(
      newTransPincode: map['newTransPincode'] ?? '',
      channelCode: map['channelCode'] ?? '',
      pctCstycode: map['pctCstycode'] ?? '',
      porOrgacode: map['porOrgacode'] ?? '',
      cmpCustcode: map['cmpCustcode'] ?? '',
      isOtpRequired: map['isOtpRequired'] ?? false,
      pinType: map['pinType'] ?? '',
    );
  }

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

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