package com.ss.android.ugc.effectmanager.effect.model.template;

import X.2HN;
import X.9HM;
import X.M12;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.effectmanager.effect.model.Effect;
import com.ss.ugc.effectplatform.model.net.FetchFavoriteListResponse;
import java.util.ArrayList;
import java.util.List;

public class FetchFavoriteListResponseTemplate extends FetchFavoriteListResponse {
    public final transient FetchFavoriteListResponse kFavoriteModel;

    static {
        Covode.recordClassIndex(125435);
    }

    public FetchFavoriteListResponseTemplate() {
        this((FetchFavoriteListResponse) null, 1, (2HN) null);
    }

    public static class DataTemplate extends FetchFavoriteListResponse.Data {
        public final transient FetchFavoriteListResponse.Data kData;

        static {
            Covode.recordClassIndex(125436);
        }

        public DataTemplate() {
            this((FetchFavoriteListResponse.Data) null, 1, (2HN) null);
        }

        public FetchFavoriteListResponse.Data getKData() {
            return this.kData;
        }

        public DataTemplate(FetchFavoriteListResponse.Data data) {
            super((String) null, (List) null, (List) null, (List) null, (List) null, 31, (2HN) null);
            this.kData = data;
        }

        /* JADX INFO: this call moved to the top of the method (can break code semantics) */
        public /* synthetic */ DataTemplate(FetchFavoriteListResponse.Data data, int i, 2HN r4) {
            this((i & 1) != 0 ? null : data);
        }
    }

    public FetchFavoriteListResponse getKFavoriteModel() {
        return this.kFavoriteModel;
    }

    public String getType() {
        List<FetchFavoriteListResponse.Data> data;
        FetchFavoriteListResponse.Data data2;
        String type;
        FetchFavoriteListResponse kFavoriteModel2 = getKFavoriteModel();
        if (kFavoriteModel2 == null || (data = kFavoriteModel2.getData()) == null || (data2 = data.get(0)) == null || (type = data2.getType()) == null) {
            return super.getData().get(0).getType();
        }
        return type;
    }

    public List<String> getUrlPrefix() {
        List<FetchFavoriteListResponse.Data> data;
        FetchFavoriteListResponse.Data data2;
        List<String> url_prefix;
        FetchFavoriteListResponse kFavoriteModel2 = getKFavoriteModel();
        if (kFavoriteModel2 == null || (data = kFavoriteModel2.getData()) == null || (data2 = data.get(0)) == null || (url_prefix = data2.getUrl_prefix()) == null) {
            return super.getData().get(0).getUrl_prefix();
        }
        return url_prefix;
    }

    public List<Effect> getBindEffects() {
        List<com.ss.ugc.effectplatform.model.Effect> list;
        List<FetchFavoriteListResponse.Data> data;
        FetchFavoriteListResponse.Data data2;
        List<FetchFavoriteListResponse.Data> data3;
        FetchFavoriteListResponse.Data data4;
        FetchFavoriteListResponse kFavoriteModel2 = getKFavoriteModel();
        if (kFavoriteModel2 == null || (data3 = kFavoriteModel2.getData()) == null || (data4 = data3.get(0)) == null || (list = data4.getBind_effects()) == null) {
            list = super.getData().get(0).getBind_effects();
        }
        if (!(!list.isEmpty())) {
            return new ArrayList();
        }
        if (list.get(0) instanceof Effect) {
            return list;
        }
        ArrayList arrayList = new ArrayList(9HM.LIZ(list, 10));
        for (com.ss.ugc.effectplatform.model.Effect effect : list) {
            arrayList.add(new Effect(effect));
        }
        List<Effect> list2 = arrayList;
        if (!(kFavoriteModel2 == null || (data = kFavoriteModel2.getData()) == null || (data2 = data.get(0)) == null)) {
            data2.setBind_effects(list2);
        }
        if (!super.getData().isEmpty()) {
            super.getData().get(0).setBind_effects(list2);
        }
        return list2;
    }

    public List<Effect> getCollectEffects() {
        List<com.ss.ugc.effectplatform.model.Effect> list;
        List<FetchFavoriteListResponse.Data> data;
        FetchFavoriteListResponse.Data data2;
        List<FetchFavoriteListResponse.Data> data3;
        FetchFavoriteListResponse.Data data4;
        FetchFavoriteListResponse kFavoriteModel2 = getKFavoriteModel();
        if (kFavoriteModel2 == null || (data3 = kFavoriteModel2.getData()) == null || (data4 = data3.get(0)) == null || (list = data4.getCollection()) == null) {
            list = super.getData().get(0).getCollection();
        }
        if (!(!list.isEmpty())) {
            return new ArrayList();
        }
        if (list.get(0) instanceof Effect) {
            return list;
        }
        ArrayList arrayList = new ArrayList(9HM.LIZ(list, 10));
        for (com.ss.ugc.effectplatform.model.Effect effect : list) {
            arrayList.add(new Effect(effect));
        }
        List<Effect> list2 = arrayList;
        if (!(kFavoriteModel2 == null || (data = kFavoriteModel2.getData()) == null || (data2 = data.get(0)) == null)) {
            data2.setCollection(list2);
        }
        if (!super.getData().isEmpty()) {
            super.getData().get(0).setCollection(list2);
        }
        return list2;
    }

    public List<Effect> getEffects() {
        List<com.ss.ugc.effectplatform.model.Effect> list;
        List<FetchFavoriteListResponse.Data> data;
        FetchFavoriteListResponse.Data data2;
        List<FetchFavoriteListResponse.Data> data3;
        FetchFavoriteListResponse.Data data4;
        FetchFavoriteListResponse kFavoriteModel2 = getKFavoriteModel();
        if (kFavoriteModel2 == null || (data3 = kFavoriteModel2.getData()) == null || (data4 = data3.get(0)) == null || (list = data4.getEffects()) == null) {
            list = super.getData().get(0).getEffects();
        }
        if (!(!list.isEmpty())) {
            return new ArrayList();
        }
        if (list.get(0) instanceof Effect) {
            return list;
        }
        ArrayList arrayList = new ArrayList(9HM.LIZ(list, 10));
        for (com.ss.ugc.effectplatform.model.Effect effect : list) {
            arrayList.add(new Effect(effect));
        }
        List<Effect> list2 = arrayList;
        if (!(kFavoriteModel2 == null || (data = kFavoriteModel2.getData()) == null || (data2 = data.get(0)) == null)) {
            data2.setEffects(list2);
        }
        if (!super.getData().isEmpty()) {
            super.getData().get(0).setEffects(list2);
        }
        return list2;
    }

    public FetchFavoriteListResponseTemplate(FetchFavoriteListResponse fetchFavoriteListResponse) {
        super((List) null, (String) null, 0, 7, (2HN) null);
        this.kFavoriteModel = fetchFavoriteListResponse;
    }

    public void setEffects(List<? extends Effect> list) {
        List<FetchFavoriteListResponse.Data> data;
        FetchFavoriteListResponse.Data data2;
        M12.LIZ(list);
        FetchFavoriteListResponse kFavoriteModel2 = getKFavoriteModel();
        if (!(kFavoriteModel2 == null || (data = kFavoriteModel2.getData()) == null || (data2 = data.get(0)) == null)) {
            data2.setEffects(list);
        }
        if (!super.getData().isEmpty()) {
            super.getData().get(0).setEffects(list);
        }
    }

    /* JADX INFO: this call moved to the top of the method (can break code semantics) */
    public /* synthetic */ FetchFavoriteListResponseTemplate(FetchFavoriteListResponse fetchFavoriteListResponse, int i, 2HN r4) {
        this((i & 1) != 0 ? null : fetchFavoriteListResponse);
    }
}
