// ============================================================
// Register UseCases
// ============================================================

import '../entities/auth_session.dart';
import '../repositories/auth_repository.dart';

class RegisterParams {
  final String phone;
  final String smsCode;
  final String password;
  final String? nickname;
  final String? referralCode;
  const RegisterParams({
    required this.phone,
    required this.smsCode,
    required this.password,
    this.nickname,
    this.referralCode,
  });
}

class RegisterUseCase {
  final IAuthRepository _repository;
  const RegisterUseCase(this._repository);

  Future<AuthSession> call(RegisterParams params) {
    return _repository.register(
      phone: params.phone,
      smsCode: params.smsCode,
      password: params.password,
      nickname: params.nickname,
      referralCode: params.referralCode,
    );
  }
}

class RegisterByEmailParams {
  final String email;
  final String emailCode;
  final String password;
  final String? nickname;
  final String? referralCode;
  const RegisterByEmailParams({
    required this.email,
    required this.emailCode,
    required this.password,
    this.nickname,
    this.referralCode,
  });
}

class RegisterByEmailUseCase {
  final IAuthRepository _repository;
  const RegisterByEmailUseCase(this._repository);

  Future<AuthSession> call(RegisterByEmailParams params) {
    return _repository.registerByEmail(
      email: params.email,
      emailCode: params.emailCode,
      password: params.password,
      nickname: params.nickname,
      referralCode: params.referralCode,
    );
  }
}
