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

package io.sentry;

import org.jetbrains.annotations.ApiStatus;
import java.util.Collections;
import io.sentry.util.Objects;
import io.sentry.util.SentryRandom;
import java.util.Map;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.NotNull;

public final class SamplingContext
{
    @NotNull
    private final TransactionContext transactionContext;
    @Nullable
    private final CustomSamplingContext customSamplingContext;
    @NotNull
    private final Double sampleRand;
    @NotNull
    private final Map<String, Object> attributes;
    
    @Deprecated
    public SamplingContext(@NotNull final TransactionContext transactionContext, @Nullable final CustomSamplingContext customSamplingContext) {
        this(transactionContext, customSamplingContext, SentryRandom.current().nextDouble(), null);
    }
    
    @ApiStatus.Internal
    public SamplingContext(@NotNull final TransactionContext transactionContext, @Nullable final CustomSamplingContext customSamplingContext, @NotNull final Double sampleRand, @Nullable final Map<String, Object> attributes) {
        this.transactionContext = Objects.requireNonNull(transactionContext, "transactionContexts is required");
        this.customSamplingContext = customSamplingContext;
        this.sampleRand = sampleRand;
        this.attributes = ((attributes == null) ? Collections.emptyMap() : attributes);
    }
    
    @Nullable
    public CustomSamplingContext getCustomSamplingContext() {
        return this.customSamplingContext;
    }
    
    @NotNull
    public TransactionContext getTransactionContext() {
        return this.transactionContext;
    }
    
    @NotNull
    public Double getSampleRand() {
        return this.sampleRand;
    }
    
    @Nullable
    public Object getAttribute(@Nullable final String key) {
        if (key == null) {
            return null;
        }
        return this.attributes.get(key);
    }
}
