package eu.eudat.data.dao.entities;

import eu.eudat.data.dao.DatabaseAccess;
import eu.eudat.data.dao.criteria.LoginConfirmationEmailCriteria;
import eu.eudat.data.dao.databaselayer.service.DatabaseService;
import eu.eudat.data.entities.LoginConfirmationEmail;
import eu.eudat.queryable.QueryableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.UUID;
import java.util.concurrent.CompletableFuture;

@Service("LoginConfirmationEmailDao")
public class LoginConfirmationEmailDaoImpl extends DatabaseAccess<LoginConfirmationEmail> implements LoginConfirmationEmailDao {

	@Autowired
	public LoginConfirmationEmailDaoImpl(DatabaseService<LoginConfirmationEmail> databaseService) {
		super(databaseService);
	}

	@Override
	public QueryableList<LoginConfirmationEmail> getWithCriteria(LoginConfirmationEmailCriteria criteria) {
		return null;
	}

	@Override
	public LoginConfirmationEmail createOrUpdate(LoginConfirmationEmail item) {
		return this.getDatabaseService().createOrUpdate(item, LoginConfirmationEmail.class);
	}

	@Override
	public CompletableFuture<LoginConfirmationEmail> createOrUpdateAsync(LoginConfirmationEmail item) {
		return null;
	}

	@Override
	public LoginConfirmationEmail find(UUID id) {
		return this.getDatabaseService().getQueryable(LoginConfirmationEmail.class).where((builder, root) -> builder.equal(root.get("id"), id)).getSingle();
	}

	@Override
	public LoginConfirmationEmail find(UUID id, String hint) {
		throw new UnsupportedOperationException();
	}

	@Override
	public void delete(LoginConfirmationEmail item) {
		throw new UnsupportedOperationException();
	}

	@Override
	public QueryableList<LoginConfirmationEmail> asQueryable() {
		return this.getDatabaseService().getQueryable(LoginConfirmationEmail.class);
	}
}
