package com.ss.android.ugc.aweme.question.api;

import X.0Gp;
import X.0HH;
import X.BMQ;
import X.C2853Az3;
import X.IUt;
import X.PUt;
import com.bytedance.covode.number.Covode;
import com.bytedance.ies.ugc.aweme.network.RetrofitFactory;
import com.ss.android.ugc.aweme.app.api.Api;

public final class QuestionApi {
    public static final RealApi LIZ = ((RealApi) RetrofitFactory.LIZ().LIZ(Api.LIZLLL).LIZ(RealApi.class));

    public interface RealApi {
        static {
            Covode.recordClassIndex(102165);
        }

        @IUt(LIZ = "/tiktok/v1/forum/question/detail/")
        0Gp<C2853Az3> queryQuestionDetail(@PUt(LIZ = "question_id") long j);

        @IUt(LIZ = "/tiktok/v1/forum/question/status/")
        0Gp<C2853Az3> queryQuestionValidation(@PUt(LIZ = "question_id") long j);

        @IUt(LIZ = "/tiktok/v1/forum/question/videos/")
        0Gp<BMQ> queryQuestionVideos(@PUt(LIZ = "question_id") long j, @PUt(LIZ = "cursor") int i, @PUt(LIZ = "count") int i2);

        @IUt(LIZ = "/tiktok/v1/forum/question/videos/")
        0Gp<BMQ> queryQuestionVideos(@PUt(LIZ = "question_id") long j, @PUt(LIZ = "cursor") int i, @PUt(LIZ = "count") int i2, @PUt(LIZ = "aweme_ids_str") String str);
    }

    static {
        Covode.recordClassIndex(102164);
    }

    public static C2853Az3 LIZ(long j) {
        0Gp<C2853Az3> queryQuestionDetail = LIZ.queryQuestionDetail(j);
        try {
            queryQuestionDetail.LJFF();
        } catch (InterruptedException e) {
            0HH.LIZ(e);
        }
        if (queryQuestionDetail.LIZJ()) {
            try {
                throw queryQuestionDetail.LJ();
            } catch (Exception e2) {
                0HH.LIZ(e2);
            }
        }
        return (C2853Az3) queryQuestionDetail.LIZLLL();
    }

    public static C2853Az3 LIZIZ(long j) {
        0Gp<C2853Az3> queryQuestionValidation = LIZ.queryQuestionValidation(j);
        try {
            queryQuestionValidation.LJFF();
        } catch (InterruptedException e) {
            0HH.LIZ(e);
        }
        if (queryQuestionValidation.LIZJ()) {
            try {
                throw queryQuestionValidation.LJ();
            } catch (Exception e2) {
                0HH.LIZ(e2);
            }
        }
        return (C2853Az3) queryQuestionValidation.LIZLLL();
    }

    public static BMQ LIZ(long j, int i, int i2, String str) {
        0Gp<BMQ> r1;
        if (str == null || str.isEmpty()) {
            r1 = LIZ.queryQuestionVideos(j, i, i2);
        } else {
            r1 = LIZ.queryQuestionVideos(j, i, i2, str);
        }
        try {
            r1.LJFF();
        } catch (InterruptedException e) {
            0HH.LIZ(e);
        }
        if (!r1.LIZJ()) {
            return (BMQ) r1.LIZLLL();
        }
        throw r1.LJ();
    }
}
