package com.ss.android.ugc.aweme.commercialize.e_commerce.pdp.log;

import X.0CB;
import X.0CH;
import X.0CN;
import X.2UX;
import X.2nK;
import X.6Is;
import X.C3034L5t;
import X.L62;
import X.Mjy;
import X.Pkb;
import android.net.Uri;
import com.bytedance.covode.number.Covode;
import kotlin.h.b.n;

public final class PdpLogHelper implements 6Is {
    public static final L62 LIZJ = new L62((byte) 0);
    public final Pkb<Integer> LIZ;
    public final Mjy LIZIZ = new Mjy();

    static {
        Covode.recordClassIndex(58424);
    }

    public final void onStateChanged(0CH r2, 0CB r3) {
        if (r3 == 0CB.ON_DESTROY) {
            dispose();
        }
    }

    @0CN(LIZ = 0CB.ON_DESTROY)
    public final void dispose() {
        this.LIZIZ.dispose();
    }

    public PdpLogHelper() {
        Pkb<Integer> pkb = new Pkb<>();
        n.LIZIZ(pkb, "");
        this.LIZ = pkb;
    }

    public final C3034L5t LIZ(int i) {
        if (i == 3) {
            return C3034L5t.EXPANDED;
        }
        if (i == 4) {
            return C3034L5t.COLLAPSED;
        }
        if (i != 5) {
            return C3034L5t.COLLAPSED;
        }
        return C3034L5t.HIDDEN;
    }

    public final void LIZ(int i, long j, String str) {
        String str2;
        String queryParameter;
        2UX r3 = new 2UX();
        r3.LIZ("success", i);
        r3.LIZ("load_time", String.valueOf(((float) (System.currentTimeMillis() - j)) / 1000.0f));
        if (str == null) {
            str2 = "";
        } else {
            str2 = str;
        }
        r3.LIZ("schema_url", str2);
        Uri parse = Uri.parse(str);
        String str3 = null;
        if (parse != null) {
            str3 = parse.getQueryParameter("channel");
        }
        if (!(str3 == null || str3.length() == 0 || str3 == null)) {
            r3.LIZ("channel", str3);
        }
        Uri parse2 = Uri.parse(str);
        if (!(parse2 == null || (queryParameter = parse2.getQueryParameter("bundle")) == null || queryParameter.length() == 0 || queryParameter == null)) {
            r3.LIZ("bundle", queryParameter);
        }
        2nK.LIZ("ttmp_oc_anchor_pdp_load", r3.LIZ);
    }
}
