import 'package:krow_core/core.dart';
import 'package:krow_domain/krow_domain.dart';
import '../repositories/personal_info_repository_interface.dart';

/// Arguments for updating staff profile information.
class UpdatePersonalInfoParams extends UseCaseArgument {
  /// The staff member's ID.
  final String staffId;

  /// The fields to update.
  final Map<String, dynamic> data;

  const UpdatePersonalInfoParams({
    required this.staffId,
    required this.data,
  });

  @override
  List<Object?> get props => [staffId, data];
}

/// Use case for updating staff profile information.
///
/// This use case updates the staff profile information
/// through the repository, which delegates to the data_connect layer.
class UpdatePersonalInfoUseCase
    implements UseCase<UpdatePersonalInfoParams, Staff> {
  final PersonalInfoRepositoryInterface _repository;

  /// Creates an [UpdatePersonalInfoUseCase].
  ///
  /// Requires a [PersonalInfoRepositoryInterface] to update data.
  UpdatePersonalInfoUseCase(this._repository);

  @override
  Future<Staff> call(UpdatePersonalInfoParams params) {
    return _repository.updateStaffProfile(
      staffId: params.staffId,
      data: params.data,
    );
  }
}
