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

package io.sentry;

import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.NotNull;
import io.sentry.protocol.SentryId;

public final class W3CTraceparentHeader
{
    public static final String TRACEPARENT_HEADER = "traceparent";
    @NotNull
    private final SentryId traceId;
    @NotNull
    private final SpanId spanId;
    @Nullable
    private final Boolean sampled;
    
    public W3CTraceparentHeader(@NotNull final SentryId traceId, @NotNull final SpanId spanId, @Nullable final Boolean sampled) {
        this.traceId = traceId;
        this.spanId = spanId;
        this.sampled = sampled;
    }
    
    @NotNull
    public String getName() {
        return "traceparent";
    }
    
    @NotNull
    public String getValue() {
        final String sampledFlag = (this.sampled != null && this.sampled) ? "01" : "00";
        return String.format("00-%s-%s-%s", this.traceId, this.spanId, sampledFlag);
    }
}
