package it.enea.cruise.service.idp;

import java.util.List;

import org.springframework.cache.annotation.Cacheable;

import it.enea.scp.idp.sdk.model.UserDto;
import it.enea.cruise.model.user.User;
import lombok.extern.log4j.Log4j2;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Service;


@Service
@Log4j2
@Profile("test")
public class IdpCachedProvider extends EneaProvider implements IdpProvider {

	
	/*@Autowired*/
	EneaProvider idpClientManager;
	
	@Override
	public String getTokenFromUsernameAndPassword(String username, String password) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	//@Cacheable(value="users", key="#username")
	public User login(String username, String password) {
		log.info("logging");
		return super.login(username, password);
		// TODO Auto-generated method stub
			}

	@Override
	public boolean logout(String token) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean isValid(String token) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public List<UserDto> userList() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Boolean deleteUser(String email) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Boolean createUser(UserDto newUser) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public UserDto getUserByEmail(String email) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	@Cacheable(value="users",key="#token")
	public User getUserByToken(String token) {
		log.info("getting user with token: " + token);
		return super.getUserByToken(token);
		
	}

	@Override
	public Boolean updateUser(UserDto user) {
		// TODO Auto-generated method stub
		return null;
	}

}
