package org.cmh.backend.UserManagement.service;

import org.cmh.backend.UserManagement.repository.UserManagementRepository;
import org.cmh.backend.UserManagement.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class UserManagementService {

    @Autowired
    private UserManagementRepository userManagementRepository;


    public User registerUser(User user) {
        User savedUser = userManagementRepository.save(user);
        return savedUser;
    }

    public List<User> findAll(){
        return userManagementRepository.findAll();
    }

    public User findUserById(Long id){return userManagementRepository.findUserById(id);}

    public User update(User user){return userManagementRepository.save(user);}

    public void delete(Long id){userManagementRepository.deleteById(id);}

}
