export class CreateUserCommandHandler {
  constructor(userRepository) {
    this.userRepository = userRepository;
  }

  async handle(command) {
    if (!command.name || !command.email) {
      throw new Error('Name and email are required');
    }
    
    const userData = {
      name: command.name,
      email: command.email,
      age: command.age
    };
    
    return await this.userRepository.create(userData);
  }
}
