package com.airlock.iam.oauth2.domain.model.consent;

import com.airlock.iam.base.api.domain.model.user.UserId;
import com.airlock.iam.oauth2.api.domain.model.AuthorizationServerId;
import com.airlock.iam.oauth2.api.domain.model.OAuth2ClientId;
import com.airlock.iam.oauth2.api.domain.model.OAuth2Scope;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.Collection;
import java.util.List;
import java.util.Optional;

public interface OAuth2ConsentRepository {
   Optional<OAuth2Consent> get(OAuth2ConsentId var1);

   Collection<OAuth2Consent> findByUser(UserId var1);

   Collection<OAuth2Consent> findByUserAndAuthorizationServer(UserId var1, AuthorizationServerId var2);

   Collection<OAuth2Consent> findByUserAndAuthorizationServerAndClient(UserId var1, AuthorizationServerId var2, OAuth2ClientId var3);

   void insert(OAuth2Consent var1);

   int updateUserId(UserId var1, UserId var2);

   void delete(OAuth2ConsentId var1);

   void insertOrUpdateConsents(List<OAuth2Consent> var1);

   int deleteByUser(UserId var1);

   int deleteByUserAndAuthorizationServer(UserId var1, AuthorizationServerId var2);

   int deleteByUserAndAuthorizationServerAndClient(UserId var1, AuthorizationServerId var2, OAuth2ClientId var3);

   int deleteByUserAndAuthorizationServerAndClientAndScope(UserId var1, AuthorizationServerId var2, OAuth2ClientId var3, OAuth2Scope var4);

   List<OAuth2ConsentRepository.AuthorizationServerAndClient> findAuthorizationServersAndClientsForUser(UserId var1);

   void updateStatus(OAuth2ConsentId var1, UserId var2, OAuth2ConsentStatus var3);

   final class AuthorizationServerAndClient {
      private AuthorizationServerId authorizationServerId;
      private OAuth2ClientId clientId;

      @SuppressFBWarnings(justification = "generated code")
      public AuthorizationServerId getAuthorizationServerId() {
         return this.authorizationServerId;
      }

      @SuppressFBWarnings(justification = "generated code")
      public OAuth2ClientId getClientId() {
         return this.clientId;
      }

      @SuppressFBWarnings(justification = "generated code")
      public void setAuthorizationServerId(AuthorizationServerId authorizationServerId) {
         this.authorizationServerId = authorizationServerId;
      }

      @SuppressFBWarnings(justification = "generated code")
      public void setClientId(OAuth2ClientId clientId) {
         this.clientId = clientId;
      }

      @SuppressFBWarnings(justification = "generated code")
      @Override
      public boolean equals(Object o) {
         if (o == this) {
            return true;
         } else if (!(o instanceof OAuth2ConsentRepository.AuthorizationServerAndClient other)) {
            return false;
         } else {
            Object this$authorizationServerId = this.authorizationServerId;
            Object other$authorizationServerId = other.authorizationServerId;
            if (this$authorizationServerId == null ? other$authorizationServerId == null : this$authorizationServerId.equals(other$authorizationServerId)) {
               Object this$clientId = this.clientId;
               Object other$clientId = other.clientId;
               return this$clientId == null ? other$clientId == null : this$clientId.equals(other$clientId);
            } else {
               return false;
            }
         }
      }

      @SuppressFBWarnings(justification = "generated code")
      @Override
      public int hashCode() {
         int PRIME = 59;
         int result = 1;
         Object $authorizationServerId = this.authorizationServerId;
         result = result * 59 + ($authorizationServerId == null ? 43 : $authorizationServerId.hashCode());
         Object $clientId = this.clientId;
         return result * 59 + ($clientId == null ? 43 : $clientId.hashCode());
      }

      @SuppressFBWarnings(justification = "generated code")
      @Override
      public String toString() {
         return "OAuth2ConsentRepository.AuthorizationServerAndClient(authorizationServerId="
            + this.getAuthorizationServerId()
            + ", clientId="
            + this.getClientId()
            + ")";
      }

      @SuppressFBWarnings(justification = "generated code")
      public AuthorizationServerAndClient(AuthorizationServerId authorizationServerId, OAuth2ClientId clientId) {
         this.authorizationServerId = authorizationServerId;
         this.clientId = clientId;
      }
   }
}
