class User {
  final int id;
  final String phoneNumber;
  final String fullName;
  final String? username;
  final String? photo;
  final String? email;

  const User({
    required this.id,
    required this.username,
    required this.phoneNumber,
    required this.photo,
    required this.fullName,
    required this.email,
  });

  factory User.fromJson(Map<String, dynamic> json) => User(
        id: json['id'],
        username: json['username'],
        phoneNumber: json['phoneNumber'],
        photo: json['photo'],
        fullName: json['fullName'],
        email: json['email'],
      );

  Map<String, dynamic> toJson() => {
        'id': id,
        'username': username,
        'phoneNumber': phoneNumber,
        'photo': photo,
        'fullName': fullName,
        'email': email,
      };

  User copyWith({
    int? id,
    String? username,
    String? phoneNumber,
    String? photo,
    String? fullName,
    String? email,
  }) {
    return User(
      id: id ?? this.id,
      username: username ?? this.username,
      phoneNumber: phoneNumber ?? this.phoneNumber,
      photo: photo,
      fullName: fullName ?? this.fullName,
      email: email ?? this.email,
    );
  }
}
