package it.enea.cruise.controller;

import java.util.List;

import it.enea.cruise.service.idp.IdpProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.bind.annotation.GetMapping;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import it.enea.scp.idp.sdk.model.UserDto;
import it.enea.cruise.service.idp.IEncryptionManager;

@Controller
@Api(value = "idpUserController")
@EnableTransactionManagement
public class idpController {
	
	@Autowired
	IEncryptionManager encManager;
	
	@Autowired
	IdpProvider idpClientManager;
	
	@ApiOperation(value = "Return a list of users", response = UserDto.class, tags = "")
	@GetMapping("/idp/usersFromIdp")
	public ResponseEntity<List<UserDto>> getUserFromIdp(){
		List<UserDto> userDto = idpClientManager.userList();
		
		return new ResponseEntity<List<UserDto>>(userDto,
				// headers,
				HttpStatus.FOUND);

	}


}
