const UserRepository = require('../../../infrastructure/repositories/UserRepository');

class DeleteUserHandler {
  constructor() {
    this.userRepository = new UserRepository();
  }

  async handle(command) {
    const user = await this.userRepository.findById(command.id);
    if (!user) {
      throw new Error('User nem található');
    }

    await this.userRepository.delete(command.id);
    return { 
      message: 'User sikeresen törölve', 
      id: command.id 
    };
  }
}

module.exports = DeleteUserHandler;
