import 'package:taafee_mobile/features/auth/data_layer/model/user.dart';

class LoginResponseModel {
  User user;
  String token;
  String chatToken;
  int chatUserId;

  LoginResponseModel(
      {required this.user,
      required this.chatUserId,
      required this.token,
      required this.chatToken});
  factory LoginResponseModel.fromJson(Map<String, dynamic> json) =>
      LoginResponseModel(
        user: User.fromJson(json["user"]),
        token: json["token"],
        chatToken: json["chat_token"] ?? '',
        chatUserId: json["user"]["chat_user_id"] ?? 0,
      );
  factory LoginResponseModel.zero() => LoginResponseModel(
      user: User.zero(), token: "", chatToken: "", chatUserId: 0);

  Map<String, dynamic> toJson() => {
        "user": user.toJson(),
        "token": token,
        "chat_token": chatToken,
        "chat_user_id": chatUserId,
      };
}
