package com.parse.http;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import p138.p139.p143.p144.C2803;

/* JADX INFO: loaded from: classes.dex */
public final class ParseHttpRequest {
    public final ParseHttpBody body;
    public final Map<String, String> headers;
    public final Method method;
    public final String url;

    /* JADX INFO: renamed from: com.parse.http.ParseHttpRequest$1, reason: invalid class name */
    public static /* synthetic */ class AnonymousClass1 {
        public static final /* synthetic */ int[] $SwitchMap$com$parse$http$ParseHttpRequest$Method;

        static {
            int[] iArr = new int[Method.values().length];
            $SwitchMap$com$parse$http$ParseHttpRequest$Method = iArr;
            try {
                Method method = Method.GET;
                iArr[0] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                int[] iArr2 = $SwitchMap$com$parse$http$ParseHttpRequest$Method;
                Method method2 = Method.POST;
                iArr2[1] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                int[] iArr3 = $SwitchMap$com$parse$http$ParseHttpRequest$Method;
                Method method3 = Method.PUT;
                iArr3[2] = 3;
            } catch (NoSuchFieldError unused3) {
            }
            try {
                int[] iArr4 = $SwitchMap$com$parse$http$ParseHttpRequest$Method;
                Method method4 = Method.DELETE;
                iArr4[3] = 4;
            } catch (NoSuchFieldError unused4) {
            }
        }
    }

    public static final class Builder {
        public ParseHttpBody body;
        public Map<String, String> headers;
        public Method method;
        public String url;

        public Builder() {
            this.headers = new HashMap();
        }

        public Builder(ParseHttpRequest parseHttpRequest) {
            this.url = parseHttpRequest.url;
            this.method = parseHttpRequest.method;
            this.headers = new HashMap(parseHttpRequest.headers);
            this.body = parseHttpRequest.body;
        }
    }

    public enum Method {
        GET,
        POST,
        PUT,
        DELETE;

        /* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
        /* JADX WARN: Failed to restore switch over string. Please report as a decompilation issue */
        /* JADX WARN: Removed duplicated region for block: B:17:0x0033  */
        /*
            Code decompiled incorrectly, please refer to instructions dump.
        */
        public static Method fromString(String str) {
            byte b;
            switch (str.hashCode()) {
                case 70454:
                    b = !str.equals("GET") ? (byte) -1 : (byte) 0;
                    break;
                case 79599:
                    if (str.equals("PUT")) {
                        b = 2;
                        break;
                    }
                    break;
                case 2461856:
                    if (str.equals("POST")) {
                        b = 1;
                        break;
                    }
                    break;
                case 2012838315:
                    if (str.equals("DELETE")) {
                        b = 3;
                        break;
                    }
                    break;
            }
            if (b == 0) {
                return GET;
            }
            if (b == 1) {
                return POST;
            }
            if (b == 2) {
                return PUT;
            }
            if (b == 3) {
                return DELETE;
            }
            throw new IllegalArgumentException(C2803.m4880("Invalid http method: <", str, ">"));
        }

        @Override // java.lang.Enum
        public String toString() {
            int iOrdinal = ordinal();
            if (iOrdinal == 0) {
                return "GET";
            }
            if (iOrdinal == 1) {
                return "POST";
            }
            if (iOrdinal == 2) {
                return "PUT";
            }
            if (iOrdinal == 3) {
                return "DELETE";
            }
            throw new IllegalArgumentException("Invalid http method: <" + this + ">");
        }
    }

    public /* synthetic */ ParseHttpRequest(Builder builder, AnonymousClass1 anonymousClass1) {
        this.url = builder.url;
        this.method = builder.method;
        this.headers = Collections.unmodifiableMap(new HashMap(builder.headers));
        this.body = builder.body;
    }
}
