// 
// Decompiled by Procyon v0.6.0
// 

package com.google.crypto.tink.keyderivation;

import java.security.GeneralSecurityException;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import javax.annotation.Nullable;
import java.util.Objects;
import com.google.crypto.tink.Parameters;
import com.google.crypto.tink.prf.PrfParameters;
import com.google.errorprone.annotations.Immutable;

@Immutable
public final class PrfBasedKeyDerivationParameters extends KeyDerivationParameters
{
    private final PrfParameters prfParameters;
    private final Parameters derivedKeyParameters;
    
    private PrfBasedKeyDerivationParameters(final PrfParameters prfParameters, final Parameters derivedKeyParameters) {
        this.prfParameters = prfParameters;
        this.derivedKeyParameters = derivedKeyParameters;
    }
    
    public static Builder builder() {
        return new Builder();
    }
    
    public PrfParameters getPrfParameters() {
        return this.prfParameters;
    }
    
    @Override
    public Parameters getDerivedKeyParameters() {
        return this.derivedKeyParameters;
    }
    
    @Override
    public boolean equals(final Object o) {
        if (!(o instanceof PrfBasedKeyDerivationParameters)) {
            return false;
        }
        final PrfBasedKeyDerivationParameters that = (PrfBasedKeyDerivationParameters)o;
        return that.getPrfParameters().equals(this.getPrfParameters()) && that.getDerivedKeyParameters().equals(this.getDerivedKeyParameters());
    }
    
    @Override
    public int hashCode() {
        return Objects.hash(PrfBasedKeyDerivationParameters.class, this.prfParameters, this.derivedKeyParameters);
    }
    
    @Override
    public String toString() {
        return String.format("PrfBasedKeyDerivationParameters(%s, %s)", this.prfParameters, this.derivedKeyParameters);
    }
    
    public static class Builder
    {
        @Nullable
        private PrfParameters prfParameters;
        @Nullable
        private Parameters derivedKeyParameters;
        
        public Builder() {
            this.prfParameters = null;
            this.derivedKeyParameters = null;
        }
        
        @CanIgnoreReturnValue
        public Builder setPrfParameters(final PrfParameters prfParameters) {
            this.prfParameters = prfParameters;
            return this;
        }
        
        @CanIgnoreReturnValue
        public Builder setDerivedKeyParameters(final Parameters derivedKeyParameters) {
            this.derivedKeyParameters = derivedKeyParameters;
            return this;
        }
        
        public PrfBasedKeyDerivationParameters build() throws GeneralSecurityException {
            if (this.prfParameters == null) {
                throw new GeneralSecurityException("PrfParameters must be set.");
            }
            if (this.derivedKeyParameters == null) {
                throw new GeneralSecurityException("DerivedKeyParameters must be set.");
            }
            return new PrfBasedKeyDerivationParameters(this.prfParameters, this.derivedKeyParameters, null);
        }
    }
}
