package com.airlock.iam.publicselfservice.api.domain.model;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.Optional;
import lombok.NonNull;

public interface PublicSelfServiceRestriction {
   Optional<PublicSelfServiceRestriction.RestrictionViolation> getViolation();

   final class RestrictionViolation {
      @NonNull
      private final PublicSelfServiceRestriction.ViolationCode code;
      private final boolean reportViolation;

      @SuppressFBWarnings(justification = "generated code")
      public RestrictionViolation(@NonNull PublicSelfServiceRestriction.ViolationCode code, boolean reportViolation) {
         if (code == null) {
            throw new NullPointerException("code is marked non-null but is null");
         }

         this.code = code;
         this.reportViolation = reportViolation;
      }

      @NonNull
      @SuppressFBWarnings(justification = "generated code")
      public PublicSelfServiceRestriction.ViolationCode getCode() {
         return this.code;
      }

      @SuppressFBWarnings(justification = "generated code")
      public boolean isReportViolation() {
         return this.reportViolation;
      }

      @SuppressFBWarnings(justification = "generated code")
      @Override
      public boolean equals(Object o) {
         if (o == this) {
            return true;
         } else if (!(o instanceof PublicSelfServiceRestriction.RestrictionViolation other)) {
            return false;
         } else {
            if (this.reportViolation != other.reportViolation) {
               return false;
            }

            Object this$code = this.code;
            Object other$code = other.code;
            return this$code == null ? other$code == null : this$code.equals(other$code);
         }
      }

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

      @SuppressFBWarnings(justification = "generated code")
      @Override
      public String toString() {
         return "PublicSelfServiceRestriction.RestrictionViolation(code=" + this.getCode() + ", reportViolation=" + this.isReportViolation() + ")";
      }
   }

   interface ViolationCode {
      String name();
   }
}
