import 'package:krow_core/core.dart';
import 'package:krow_domain/krow_domain.dart';
import '../arguments/create_hub_arguments.dart';
import '../repositories/hub_repository_interface.dart';

/// Use case for creating a new hub.
///
/// This use case orchestrates the creation of a hub by interacting with the
/// [HubRepositoryInterface]. It requires [CreateHubArguments] which includes
/// the name and address of the hub.
class CreateHubUseCase implements UseCase<CreateHubArguments, Hub> {

  /// Creates a [CreateHubUseCase].
  ///
  /// Requires a [HubRepositoryInterface] to perform the actual creation.
  CreateHubUseCase(this._repository);
  final HubRepositoryInterface _repository;

  @override
  Future<Hub> call(CreateHubArguments arguments) {
    return _repository.createHub(
      name: arguments.name,
      address: arguments.address,
      placeId: arguments.placeId,
      latitude: arguments.latitude,
      longitude: arguments.longitude,
      city: arguments.city,
      state: arguments.state,
      street: arguments.street,
      country: arguments.country,
      zipCode: arguments.zipCode,
    );
  }
}
