package xyz.stream.api;

import com.google.gson.Gson;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import xyz.stream.api.entity.BaseEntity;
import xyz.stream.utils.entity.AppInfoEntity;
import xyz.stream.utils.f0;

/* JADX INFO: loaded from: classes3.dex */
public final class n implements xyz.stream.utils.y {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final /* synthetic */ int f35909a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final /* synthetic */ String f35910b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final /* synthetic */ Map f35911c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final /* synthetic */ o f35912d;

    public /* synthetic */ n(o oVar, String str, HashMap map, int i10) {
        this.f35909a = i10;
        this.f35912d = oVar;
        this.f35910b = str;
        this.f35911c = map;
    }

    @Override // xyz.stream.utils.y
    public final void n(String str) {
        int i10 = this.f35909a;
        o oVar = this.f35912d;
        String str2 = this.f35910b;
        Map map = this.f35911c;
        switch (i10) {
            case 0:
                try {
                    Gson gson = xyz.stream.utils.m.f36162a;
                    BaseEntity baseEntity = (BaseEntity) gson.fromJson(str, BaseEntity.class);
                    if (baseEntity.getCode() == 200 && baseEntity.getData() != null) {
                        List<Map> list = (List) gson.fromJson(baseEntity.getData(), new RemoteApiHelper$60$1().getType());
                        ArrayList arrayList = new ArrayList();
                        if (list != null) {
                            for (Map map2 : list) {
                                if (map2.containsKey("video_id") && (map2.get("video_id") instanceof Number)) {
                                    Object obj = map2.get("video_id");
                                    Objects.requireNonNull(obj);
                                    arrayList.add(Integer.valueOf(((Number) obj).intValue()));
                                }
                            }
                        }
                        f0.o().C("sp_dislike_list", arrayList);
                    }
                } catch (Exception e10) {
                    o.a(oVar, str2, null, e10, xyz.stream.utils.m.a(map));
                    return;
                }
                break;
            case 1:
                try {
                    BaseEntity baseEntity2 = (BaseEntity) xyz.stream.utils.m.f36162a.fromJson(str, BaseEntity.class);
                    if (baseEntity2.getCode() != 200 || baseEntity2.getData() == null) {
                        f.b().e(null);
                        o.b(oVar, str2, baseEntity2.getCode(), baseEntity2.getMsg(), xyz.stream.utils.m.a(map));
                    } else {
                        f.b().e(xyz.stream.utils.m.a(baseEntity2.getData()));
                    }
                } catch (Exception e11) {
                    f.b().e(null);
                    o.a(oVar, str2, null, e11, xyz.stream.utils.m.a(map));
                    return;
                }
                break;
            case 2:
                try {
                    Gson gson2 = xyz.stream.utils.m.f36162a;
                    BaseEntity baseEntity3 = (BaseEntity) gson2.fromJson(str, BaseEntity.class);
                    if (baseEntity3.getCode() != 200 || baseEntity3.getData() == null) {
                        o.b(oVar, str2, baseEntity3.getCode(), baseEntity3.getMsg(), xyz.stream.utils.m.a(map));
                    } else {
                        AppInfoEntity appInfoEntity = (AppInfoEntity) gson2.fromJson(baseEntity3.getData(), AppInfoEntity.class);
                        if (appInfoEntity != null) {
                            xyz.stream.utils.e.d().f36115d = appInfoEntity;
                        }
                    }
                } catch (Exception e12) {
                    o.a(oVar, str2, null, e12, xyz.stream.utils.m.a(map));
                    return;
                }
                break;
        }
    }

    @Override // xyz.stream.utils.y
    public final void r(Exception exc) {
        int i10 = this.f35909a;
        String str = this.f35910b;
        o oVar = this.f35912d;
        Map map = this.f35911c;
        switch (i10) {
            case 0:
                o.a(oVar, str, null, exc, xyz.stream.utils.m.a(map));
                break;
            case 1:
                f.b().e(null);
                o.a(oVar, str, null, exc, xyz.stream.utils.m.a(map));
                break;
            case 2:
                o.a(oVar, str, null, exc, xyz.stream.utils.m.a(map));
                break;
            case 3:
                o.a(oVar, str, null, exc, xyz.stream.utils.m.a(map));
                break;
            case 4:
                o.a(oVar, str, null, exc, xyz.stream.utils.m.a(map));
                break;
            case 5:
                o.a(oVar, str, null, exc, xyz.stream.utils.m.a(map));
                break;
            case 6:
                o.a(oVar, str, null, exc, xyz.stream.utils.m.a(map));
                break;
            case 7:
                o.a(oVar, str, null, exc, xyz.stream.utils.m.a(map));
                break;
            default:
                o.a(oVar, str, null, exc, xyz.stream.utils.m.a(map));
                break;
        }
    }
}
