

import 'package:flutter/material.dart';

class VerifyOtpModel {
  final String ?userId;
  final String ?userName;
  final String ?email;
  final String ?token;
  final DateTime? validTo;

  VerifyOtpModel({
     this.userId,
    this.userName,
    this.email,
    this.token,
     this.validTo,
  });

  // Factory constructor to create an instance from a JSON map
  factory VerifyOtpModel.fromJson(Map<String, dynamic> json) {
    return VerifyOtpModel(
      userId: json['userId'],
      userName: json['userName'],
      email: json['email'],
      token: json['token'],
      validTo: DateTime.parse(json['validTo']),
    );
  }

  // Convert the instance to a JSON map
  Map<String, dynamic> toJson() {
    return {
      'userId': userId,
      'userName': userName,
      'email': email,
      'token': token,
      'validTo': validTo?.toIso8601String(),
    };
  }
}
