import '../api/types.dart';

class UserInfo implements Serializable {
  final int id;
  final String firstName;
  final String? lastName;
  final String fullName;

  const UserInfo({
    required this.id,
    required this.firstName,
    this.lastName,
    required this.fullName,
  });

  factory UserInfo.fromJson(Map<String, dynamic> json) {
    return UserInfo(
      id: json['id'] as int,
      firstName: json['firstName'] as String,
      lastName: json['lastName'] as String?,
      fullName: json['fullName'] as String,
    );
  }

  @override
  Map<String, Object?> toJson() => {
    'id': id,
    'firstName': firstName,
    'lastName': lastName,
    'fullName': fullName,
  };
}
