package com.toughra.ustadmobile.databinding;
import com.toughra.ustadmobile.R;
import com.toughra.ustadmobile.BR;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import android.view.View;
@SuppressWarnings("unchecked")
public class ItemCourseGroupMemberEditBindingImpl extends ItemCourseGroupMemberEditBinding  {

    @Nullable
    private static final androidx.databinding.ViewDataBinding.IncludedLayouts sIncludes;
    @Nullable
    private static final android.util.SparseIntArray sViewsWithIds;
    static {
        sIncludes = null;
        sViewsWithIds = new android.util.SparseIntArray();
        sViewsWithIds.put(R.id.item_group_member_text_input, 4);
    }
    // views
    @NonNull
    private final androidx.constraintlayout.widget.ConstraintLayout mboundView0;
    // variables
    // values
    // listeners
    // Inverse Binding Event Handlers
    private androidx.databinding.InverseBindingListener itemGroupMemberTextInputTextselectedMessageIdOptionAttrChanged = new androidx.databinding.InverseBindingListener() {
        @Override
        public void onChange() {
            // Inverse of groupMember.member.cgmGroupNumber
            //         is groupMember.member.setCgmGroupNumber((int) callbackArg_0)
            int callbackArg_0 = com.ustadmobile.port.android.view.binding.MessageIdAutoCompleteTextViewBindingsKt.getSelectedMessageIdOption(itemGroupMemberTextInputText);
            // localize variables for thread safety
            // groupMember.member != null
            boolean groupMemberMemberJavaLangObjectNull = false;
            // groupMember
            com.ustadmobile.lib.db.entities.CourseGroupMemberPerson groupMember = mGroupMember;
            // groupMember.member
            com.ustadmobile.lib.db.entities.CourseGroupMember groupMemberMember = null;
            // groupMember.member.cgmGroupNumber
            int groupMemberMemberCgmGroupNumber = 0;
            // groupMember != null
            boolean groupMemberJavaLangObjectNull = false;



            groupMemberJavaLangObjectNull = (groupMember) != (null);
            if (groupMemberJavaLangObjectNull) {


                groupMemberMember = groupMember.getMember();

                groupMemberMemberJavaLangObjectNull = (groupMemberMember) != (null);
                if (groupMemberMemberJavaLangObjectNull) {




                    groupMemberMember.setCgmGroupNumber(((int) (callbackArg_0)));
                }
            }
        }
    };

    public ItemCourseGroupMemberEditBindingImpl(@Nullable androidx.databinding.DataBindingComponent bindingComponent, @NonNull View root) {
        this(bindingComponent, root, mapBindings(bindingComponent, root, 5, sIncludes, sViewsWithIds));
    }
    private ItemCourseGroupMemberEditBindingImpl(androidx.databinding.DataBindingComponent bindingComponent, View root, Object[] bindings) {
        super(bindingComponent, root, 0
            , (de.hdodenhof.circleimageview.CircleImageView) bindings[1]
            , (android.widget.TextView) bindings[2]
            , (com.google.android.material.textfield.TextInputLayout) bindings[4]
            , (com.ustadmobile.port.android.view.IdOptionAutoCompleteTextView) bindings[3]
            );
        this.itemGroupMemberIcon.setTag(null);
        this.itemGroupMemberName.setTag(null);
        this.itemGroupMemberTextInputText.setTag(null);
        this.mboundView0 = (androidx.constraintlayout.widget.ConstraintLayout) bindings[0];
        this.mboundView0.setTag(null);
        setRootTag(root);
        // listeners
        invalidateAll();
    }

    @Override
    public void invalidateAll() {
        synchronized(this) {
                mDirtyFlags = 0x4L;
        }
        requestRebind();
    }

    @Override
    public boolean hasPendingBindings() {
        synchronized(this) {
            if (mDirtyFlags != 0) {
                return true;
            }
        }
        return false;
    }

    @Override
    public boolean setVariable(int variableId, @Nullable Object variable)  {
        boolean variableSet = true;
        if (BR.groupList == variableId) {
            setGroupList((java.util.List<com.ustadmobile.core.util.IdOption>) variable);
        }
        else if (BR.groupMember == variableId) {
            setGroupMember((com.ustadmobile.lib.db.entities.CourseGroupMemberPerson) variable);
        }
        else {
            variableSet = false;
        }
            return variableSet;
    }

    public void setGroupList(@Nullable java.util.List<com.ustadmobile.core.util.IdOption> GroupList) {
        this.mGroupList = GroupList;
        synchronized(this) {
            mDirtyFlags |= 0x1L;
        }
        notifyPropertyChanged(BR.groupList);
        super.requestRebind();
    }
    public void setGroupMember(@Nullable com.ustadmobile.lib.db.entities.CourseGroupMemberPerson GroupMember) {
        this.mGroupMember = GroupMember;
        synchronized(this) {
            mDirtyFlags |= 0x2L;
        }
        notifyPropertyChanged(BR.groupMember);
        super.requestRebind();
    }

    @Override
    protected boolean onFieldChange(int localFieldId, Object object, int fieldId) {
        switch (localFieldId) {
        }
        return false;
    }

    @Override
    protected void executeBindings() {
        long dirtyFlags = 0;
        synchronized(this) {
            dirtyFlags = mDirtyFlags;
            mDirtyFlags = 0;
        }
        java.lang.String groupMemberFirstNamesJavaLangStringGroupMemberLastName = null;
        com.ustadmobile.port.android.view.util.ForeignKeyAttachmentUriAdapter personDetailFragmentFOREIGNKEYADAPTERPERSON = null;
        java.util.List<com.ustadmobile.core.util.IdOption> groupList = mGroupList;
        java.lang.String groupMemberLastName = null;
        com.ustadmobile.lib.db.entities.CourseGroupMember groupMemberMember = null;
        int groupMemberMemberCgmGroupNumber = 0;
        java.lang.String groupMemberFirstNamesJavaLangString = null;
        com.ustadmobile.lib.db.entities.CourseGroupMemberPerson groupMember = mGroupMember;
        long groupMemberPersonUid = 0;
        java.lang.String groupMemberFirstNames = null;

        if ((dirtyFlags & 0x4L) != 0) {

                // read PersonDetailFragment.FOREIGNKEYADAPTER_PERSON
                personDetailFragmentFOREIGNKEYADAPTERPERSON = com.ustadmobile.port.android.view.PersonDetailFragment.getFOREIGNKEYADAPTER_PERSON();
        }
        if ((dirtyFlags & 0x7L) != 0) {


            if ((dirtyFlags & 0x6L) != 0) {

                    if (groupMember != null) {
                        // read groupMember.lastName
                        groupMemberLastName = groupMember.getLastName();
                        // read groupMember.personUid
                        groupMemberPersonUid = groupMember.getPersonUid();
                        // read groupMember.firstNames
                        groupMemberFirstNames = groupMember.getFirstNames();
                    }


                    // read (groupMember.firstNames) + (" ")
                    groupMemberFirstNamesJavaLangString = (groupMemberFirstNames) + (" ");


                    // read ((groupMember.firstNames) + (" ")) + (groupMember.lastName)
                    groupMemberFirstNamesJavaLangStringGroupMemberLastName = (groupMemberFirstNamesJavaLangString) + (groupMemberLastName);
            }

                if (groupMember != null) {
                    // read groupMember.member
                    groupMemberMember = groupMember.getMember();
                }


                if (groupMemberMember != null) {
                    // read groupMember.member.cgmGroupNumber
                    groupMemberMemberCgmGroupNumber = groupMemberMember.getCgmGroupNumber();
                }
        }
        // batch finished
        if ((dirtyFlags & 0x4L) != 0) {
            // api target 1

            com.ustadmobile.port.android.view.binding.ImageViewBindingsKt.setImageForeignKeyAdapter(this.itemGroupMemberIcon, personDetailFragmentFOREIGNKEYADAPTERPERSON);
            com.ustadmobile.port.android.view.binding.ImageViewBindingsKt.imageForeignKeyPlaceholder(this.itemGroupMemberIcon, androidx.appcompat.content.res.AppCompatResources.getDrawable(itemGroupMemberIcon.getContext(), R.drawable.ic_account_circle_black_24dp));
            com.ustadmobile.port.android.view.binding.MessageIdAutoCompleteTextViewBindingsKt.setSelectedMessageIdListener(this.itemGroupMemberTextInputText, itemGroupMemberTextInputTextselectedMessageIdOptionAttrChanged);
        }
        if ((dirtyFlags & 0x6L) != 0) {
            // api target 1

            com.ustadmobile.port.android.view.binding.ImageViewBindingsKt.setImageForeignKey(this.itemGroupMemberIcon, groupMemberPersonUid, (java.lang.String)null);
            androidx.databinding.adapters.TextViewBindingAdapter.setText(this.itemGroupMemberName, groupMemberFirstNamesJavaLangStringGroupMemberLastName);
        }
        if ((dirtyFlags & 0x7L) != 0) {
            // api target 1

            com.ustadmobile.port.android.view.binding.MessageIdAutoCompleteTextViewBindingsKt.setMessageIdOptions(this.itemGroupMemberTextInputText, groupList, groupMemberMemberCgmGroupNumber);
        }
    }
    // Listener Stub Implementations
    // callback impls
    // dirty flag
    private  long mDirtyFlags = 0xffffffffffffffffL;
    /* flag mapping
        flag 0 (0x1L): groupList
        flag 1 (0x2L): groupMember
        flag 2 (0x3L): null
    flag mapping end*/
    //end
}