package com.ss.android.ugc.aweme.commercialize;

import X.C3477LMu;
import X.C3478LMv;
import X.C4672Lnj;
import X.LJ0;
import X.LLU;
import X.LMQ;
import X.LNS;
import X.M12;
import android.content.Context;
import com.bytedance.covode.number.Covode;
import com.bytedance.frameworks.apm.trace.MethodCollector;
import com.ss.android.ugc.aweme.commercialize.views.cards.CouponAdCardActionV2;
import com.ss.android.ugc.aweme.commercialize.views.cards.DownloadAdCardActionV2;
import com.ss.android.ugc.aweme.commercialize.views.cards.FeedLiveAdCardActionV2;
import com.ss.android.ugc.aweme.commercialize.views.cards.FormAdCardActionV2;
import com.ss.android.ugc.aweme.commercialize.views.cards.GeneralAdCardActionV2;
import com.ss.android.ugc.aweme.commercialize.views.cards.ImageAdCardActionV2;
import com.ss.android.ugc.aweme.commercialize.views.cards.InteractAdCardActionV2;
import com.ss.android.ugc.aweme.commercialize.views.cards.LandingPageAdCardActionV2;
import com.ss.android.ugc.aweme.commercialize.views.cards.PollAdCardActionV2;
import com.ss.android.ugc.aweme.commercialize.views.cards.SelectAdCardActionV2;
import com.ss.android.ugc.aweme.commercialize.views.cards.ShopAdCardActionV2;
import com.ss.android.ugc.aweme.commercialize.views.cards.SurveyAdCardActionV2;
import com.ss.android.ugc.aweme.feed.model.Aweme;
import com.ss.android.ugc.aweme.feed.model.CardStruct;

public final class AdCardServiceImpl implements IAdCardService {
    static {
        Covode.recordClassIndex(58235);
    }

    public final LMQ LIZIZ() {
        return C3478LMv.LIZ;
    }

    public final LLU LIZ() {
        return new C3477LMu();
    }

    public static IAdCardService LIZJ() {
        MethodCollector.i(5493);
        IAdCardService iAdCardService = (IAdCardService) C4672Lnj.LIZ(IAdCardService.class, false);
        if (iAdCardService != null) {
            MethodCollector.o(5493);
            return iAdCardService;
        }
        Object LIZIZ = C4672Lnj.LIZIZ(IAdCardService.class, false);
        if (LIZIZ != null) {
            IAdCardService iAdCardService2 = (IAdCardService) LIZIZ;
            MethodCollector.o(5493);
            return iAdCardService2;
        }
        if (C4672Lnj.LJLIIL == null) {
            synchronized (IAdCardService.class) {
                try {
                    if (C4672Lnj.LJLIIL == null) {
                        C4672Lnj.LJLIIL = new AdCardServiceImpl();
                    }
                } catch (Throwable th) {
                    MethodCollector.o(5493);
                    throw th;
                }
            }
        }
        AdCardServiceImpl adCardServiceImpl = (AdCardServiceImpl) C4672Lnj.LJLIIL;
        MethodCollector.o(5493);
        return adCardServiceImpl;
    }

    public final boolean LIZIZ(CardStruct cardStruct) {
        if (cardStruct == null || 4 == cardStruct.getCardType()) {
            return false;
        }
        return true;
    }

    public final boolean LIZ(CardStruct cardStruct) {
        if (cardStruct == null || cardStruct.getCardType() != 4 || cardStruct.getCardStyle() == 2) {
            return false;
        }
        return true;
    }

    public final LNS LIZ(Integer num, Context context, Aweme aweme, LJ0 lj0) {
        M12.LIZ((Object) lj0);
        if (num != null) {
            if (num.intValue() == 2) {
                return new DownloadAdCardActionV2(context, aweme, lj0);
            }
            if (num.intValue() == 3) {
                return new ShopAdCardActionV2(context, aweme, lj0);
            }
            if (num != null) {
                if (num.intValue() == 1) {
                    return new FormAdCardActionV2(context, aweme, lj0);
                }
                if (num.intValue() == 4) {
                    return new ImageAdCardActionV2(context, aweme, lj0);
                }
                if (num.intValue() == 5) {
                    return new InteractAdCardActionV2(context, aweme, lj0);
                }
                if (num.intValue() == 6) {
                    return new PollAdCardActionV2(context, aweme, lj0);
                }
                if (num.intValue() == 7) {
                    return new SurveyAdCardActionV2(context, aweme, lj0);
                }
                if (num.intValue() == 8 || num.intValue() == 9) {
                    return new CouponAdCardActionV2(context, aweme, lj0);
                }
                if (num.intValue() == 11) {
                    return new SelectAdCardActionV2(context, aweme, lj0);
                }
                if (num.intValue() == 12) {
                    if (aweme == null || !aweme.isLive()) {
                        return new GeneralAdCardActionV2(context, aweme, lj0);
                    }
                    return new FeedLiveAdCardActionV2(context, aweme, lj0);
                }
            }
        }
        return new LandingPageAdCardActionV2(context, aweme, lj0);
    }
}
