package com.tencent.mm.opensdk.modelmsg;

import android.os.Bundle;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.opensdk.modelbase.BaseReq;
import com.tencent.mm.opensdk.utils.Log;

public class SendAuth$Req extends BaseReq {
    private static final int LENGTH_LIMIT = 1024;
    private static final String TAG = "MicroMsg.SDK.SendAuth.Req";
    public String scope;
    public String state;

    public SendAuth$Req(Bundle bundle) {
        AppMethodBeat.i(128249);
        fromBundle(bundle);
        AppMethodBeat.o(128249);
    }

    public boolean checkArgs() {
        AppMethodBeat.i(128252);
        if (this.scope == null || this.scope.length() == 0 || this.scope.length() > LENGTH_LIMIT) {
            Log.e(TAG, "checkArgs fail, scope is invalid");
            AppMethodBeat.o(128252);
            return false;
        } else if (this.state == null || this.state.length() <= LENGTH_LIMIT) {
            AppMethodBeat.o(128252);
            return true;
        } else {
            Log.e(TAG, "checkArgs fail, state is invalid");
            AppMethodBeat.o(128252);
            return false;
        }
    }

    public void fromBundle(Bundle bundle) {
        AppMethodBeat.i(128250);
        super.fromBundle(bundle);
        this.scope = bundle.getString("_wxapi_sendauth_req_scope");
        this.state = bundle.getString("_wxapi_sendauth_req_state");
        AppMethodBeat.o(128250);
    }

    public int getType() {
        return 1;
    }

    public void toBundle(Bundle bundle) {
        AppMethodBeat.i(128251);
        super.toBundle(bundle);
        bundle.putString("_wxapi_sendauth_req_scope", this.scope);
        bundle.putString("_wxapi_sendauth_req_state", this.state);
        AppMethodBeat.o(128251);
    }
}
