import 'package:rasadyar_core/core.dart';

part 'login_request_model.freezed.dart';
part 'login_request_model.g.dart';

@freezed
abstract class LoginRequestModel with _$LoginRequestModel {
  const factory LoginRequestModel({
    String? username,
    String? password,
    String? captchaCode,
    String? captchaKey,
  }) = _LoginRequestModel;

  factory LoginRequestModel.createWithCaptcha({
    required String username,
    required String password,
    required String captchaCode,
    required String captchaKey,
  }) {
    return LoginRequestModel(
      username: username,
      password: password,
      captchaCode: captchaCode,
      captchaKey: 'rest_captcha_$captchaKey.0',
    );
  }

  factory LoginRequestModel.fromJson(Map<String, dynamic> json) =>
      _$LoginRequestModelFromJson(json);

  const LoginRequestModel._();

}
