package ervu_business_metrics.service;

import ervu_business_metrics.config.KafkaEnabledCondition;
import ervu_business_metrics.dao.FailedAuthDao;
import ervu_business_metrics.model.sso.AuthEventResponse;
import org.springframework.context.annotation.Conditional;
import org.springframework.stereotype.Service;

/**
 * @author gulnaz
 */
@Service
@Conditional(KafkaEnabledCondition.class)
public class FailedAuthService {

  private final FailedAuthDao failedAuthDao;

  public FailedAuthService(FailedAuthDao failedAuthDao) {
    this.failedAuthDao = failedAuthDao;
  }

  public void save(AuthEventResponse authEventResponse) {
    failedAuthDao.save(authEventResponse);
  }

  public void clear() {
    failedAuthDao.clear();
  }
}
