package j;

import javax.annotation.Nullable;
import okhttp3.Response;
import okhttp3.ResponseBody;

/* JADX INFO: compiled from: Response.java */
/* JADX INFO: loaded from: classes.dex */
public final class m<T> {
    private final Response a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    @Nullable
    private final T f4367b;

    private m(Response response, @Nullable T t, @Nullable ResponseBody responseBody) {
        this.a = response;
        this.f4367b = t;
    }

    public static <T> m<T> c(ResponseBody responseBody, Response response) {
        p.b(responseBody, "body == null");
        p.b(response, "rawResponse == null");
        if (response.isSuccessful()) {
            throw new IllegalArgumentException("rawResponse should not be successful response");
        }
        return new m<>(response, null, responseBody);
    }

    public static <T> m<T> f(@Nullable T t, Response response) {
        p.b(response, "rawResponse == null");
        if (response.isSuccessful()) {
            return new m<>(response, t, null);
        }
        throw new IllegalArgumentException("rawResponse must be successful response");
    }

    @Nullable
    public T a() {
        return this.f4367b;
    }

    public int b() {
        return this.a.code();
    }

    public boolean d() {
        return this.a.isSuccessful();
    }

    public String e() {
        return this.a.message();
    }

    public String toString() {
        return this.a.toString();
    }
}
