// login_model.dart

class LoginModel {
  String? email;
  String? pin;
  String? mobile;
  String? otp;

  LoginModel({this.email, this.pin, this.mobile, this.otp});

  // For sending mobile number to request OTP (Legacy)
  Map<String, dynamic> toJsonMobile() {
    return {'mobile': mobile};
  }

  // For sending mobile + OTP for verification (Legacy)
  Map<String, dynamic> toJsonOtp() {
    return {'mobile': mobile, 'otp': otp};
  }

  // For Email + PIN Login
  Map<String, dynamic> toJsonEmailPin() {
    return {
      'email': email,
      'pin': pin,
    };
  }

  // Response from API
  factory LoginModel.fromJson(Map<String, dynamic> json) {
    return LoginModel(
      email: json['email'],
      pin: json['pin'],
      mobile: json['mobile'],
      otp: json['otp'],
    );
  }
}
