package l;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
import java.util.LinkedHashSet;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.annotation.Nullable;
import okhttp3.Headers;
import okhttp3.HttpUrl;
import okhttp3.MediaType;

/* JADX INFO: compiled from: RequestFactory.java */
/* JADX INFO: loaded from: classes.dex */
public final class a0 {
    public final Method a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final HttpUrl f4976b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final String f4977c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    @Nullable
    public final String f4978d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    @Nullable
    public final Headers f4979e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    @Nullable
    public final MediaType f4980f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public final boolean f4981g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public final boolean f4982h;

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    public final boolean f4983i;

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public final x<?>[] f4984j;

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public final boolean f4985k;

    /* JADX INFO: compiled from: RequestFactory.java */
    public static final class a {
        public static final Pattern a = Pattern.compile("\\{([a-zA-Z][a-zA-Z0-9_-]*)\\}");

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        public static final Pattern f4986b = Pattern.compile("[a-zA-Z][a-zA-Z0-9_-]*");

        /* JADX INFO: renamed from: c, reason: collision with root package name */
        public final c0 f4987c;

        /* JADX INFO: renamed from: d, reason: collision with root package name */
        public final Method f4988d;

        /* JADX INFO: renamed from: e, reason: collision with root package name */
        public final Annotation[] f4989e;

        /* JADX INFO: renamed from: f, reason: collision with root package name */
        public final Annotation[][] f4990f;

        /* JADX INFO: renamed from: g, reason: collision with root package name */
        public final Type[] f4991g;

        /* JADX INFO: renamed from: h, reason: collision with root package name */
        public boolean f4992h;

        /* JADX INFO: renamed from: i, reason: collision with root package name */
        public boolean f4993i;

        /* JADX INFO: renamed from: j, reason: collision with root package name */
        public boolean f4994j;

        /* JADX INFO: renamed from: k, reason: collision with root package name */
        public boolean f4995k;

        /* JADX INFO: renamed from: l, reason: collision with root package name */
        public boolean f4996l;
        public boolean m;
        public boolean n;
        public boolean o;

        @Nullable
        public String p;
        public boolean q;
        public boolean r;
        public boolean s;

        @Nullable
        public String t;

        @Nullable
        public Headers u;

        @Nullable
        public MediaType v;

        @Nullable
        public Set<String> w;

        @Nullable
        public x<?>[] x;
        public boolean y;

        public a(c0 c0Var, Method method) {
            this.f4987c = c0Var;
            this.f4988d = method;
            this.f4989e = method.getAnnotations();
            this.f4991g = method.getGenericParameterTypes();
            this.f4990f = method.getParameterAnnotations();
        }

        public static Class<?> a(Class<?> cls) {
            return Boolean.TYPE == cls ? Boolean.class : Byte.TYPE == cls ? Byte.class : Character.TYPE == cls ? Character.class : Double.TYPE == cls ? Double.class : Float.TYPE == cls ? Float.class : Integer.TYPE == cls ? Integer.class : Long.TYPE == cls ? Long.class : Short.TYPE == cls ? Short.class : cls;
        }

        public final void b(String str, String str2, boolean z) {
            String str3 = this.p;
            if (str3 != null) {
                throw g0.j(this.f4988d, "Only one HTTP method is allowed. Found: %s and %s.", str3, str);
            }
            this.p = str;
            this.q = z;
            if (str2.isEmpty()) {
                return;
            }
            int iIndexOf = str2.indexOf(63);
            if (iIndexOf != -1 && iIndexOf < str2.length() - 1) {
                String strSubstring = str2.substring(iIndexOf + 1);
                if (a.matcher(strSubstring).find()) {
                    throw g0.j(this.f4988d, "URL query string \"%s\" must not have replace block. For dynamic query parameters use @Query.", strSubstring);
                }
            }
            this.t = str2;
            Matcher matcher = a.matcher(str2);
            LinkedHashSet linkedHashSet = new LinkedHashSet();
            while (matcher.find()) {
                linkedHashSet.add(matcher.group(1));
            }
            this.w = linkedHashSet;
        }

        public final void c(int i2, Type type) {
            if (g0.h(type)) {
                throw g0.l(this.f4988d, i2, "Parameter type must not include a type variable or wildcard: %s", type);
            }
        }
    }

    public a0(a aVar) {
        this.a = aVar.f4988d;
        this.f4976b = aVar.f4987c.f4999c;
        this.f4977c = aVar.p;
        this.f4978d = aVar.t;
        this.f4979e = aVar.u;
        this.f4980f = aVar.v;
        this.f4981g = aVar.q;
        this.f4982h = aVar.r;
        this.f4983i = aVar.s;
        this.f4984j = aVar.x;
        this.f4985k = aVar.y;
    }
}
