package kz.arta.synergy.workflow.mobile.android.documents.common.adapters;

import android.content.Context;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.TextUtils;
import android.text.style.ForegroundColorSpan;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import java.util.List;

import kz.arta.synergy.workflow.mobile.android.R;
import kz.arta.synergy.workflow.mobile.android.common.models.Person;
import kz.arta.synergy.workflow.mobile.android.common.utils.DateUtils;
import kz.arta.synergy.workflow.mobile.android.common.utils.Fonts;
import kz.arta.synergy.workflow.mobile.android.documents.DocumentConst;
import kz.arta.synergy.workflow.mobile.android.documents.common.models.DocumentItem;

/**
 * Created by neox on 05.03.14.
 * Адаптер списка документов (фильтр "Все")
 */
public class AdapterDocumentsAll extends ArrayAdapter<DocumentItem> {

    private Context context;
    private List<DocumentItem> documents;
    private boolean childList;
    private String filterType;
    private Person person;

    public AdapterDocumentsAll(Context context, List<DocumentItem> documents,
                               boolean childList, int id, String filterType, Person person) {
        super(context, id, documents);
        this.context = context;
        this.documents = documents;
        this.childList = childList;
        this.filterType = filterType;
        this.person = person;
    }

    @Override
    public View getView(int position, View rowView, ViewGroup parent) {

        ViewHolder holder;

        if (rowView == null) {
            LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            rowView = inflater.inflate(R.layout.item_documents_list_all, parent, false);
            holder = new ViewHolder();

            // полная и неполная плашка
            holder.partItem = (RelativeLayout) rowView.findViewById(R.id.part_item);
            holder.fullItem = (RelativeLayout) rowView.findViewById(R.id.full_document_item);

            holder.name = (TextView) rowView.findViewById(R.id.document_name);
            holder.documentIcon = (ImageView) rowView.findViewById(R.id.document_icon_document_item);
            holder.createDate = (TextView) rowView.findViewById(R.id.create_date_document_item);
            holder.inProgress = (ImageView) rowView.findViewById(R.id.in_progress_icon_document_item);
            holder.fromToLabel = (TextView) rowView.findViewById(R.id.from_label_document_item);
            holder.fromToUser = (TextView) rowView.findViewById(R.id.from_user_document_item);
            holder.fromToLabel2 = (TextView) rowView.findViewById(R.id.from_label2_document_item);
            holder.fromToUser2 = (TextView) rowView.findViewById(R.id.from_user2_document_item);

            // компоненты полной плашки
            holder.iconTypeFull = (ImageView) rowView.findViewById(R.id.document_icon_document_type_full);
            holder.iconResolutionFull = (ImageView) rowView.findViewById(R.id.document_icon_document_resolution_full);
            holder.iconControlledFull = (ImageView) rowView.findViewById(R.id.document_icon_document_controlled_full);
            holder.iconDefectiveFull = (ImageView) rowView.findViewById(R.id.document_icon_document_defective_full);
            holder.iconRejectedFull = (ImageView) rowView.findViewById(R.id.document_icon_document_rejected_full);
            holder.iconInProgressFull = (ImageView) rowView.findViewById(R.id.document_icon_document_in_progress_full);
            holder.documentNumberFull = (TextView) rowView.findViewById(R.id.document_number_document_item_full);
            holder.documentNameFull = (TextView) rowView.findViewById(R.id.document_name_full);
            holder.createDateTitleFull = (TextView) rowView.findViewById(R.id.full_document_item_create_date_title);
            holder.createDateFull = (TextView) rowView.findViewById(R.id.full_document_item_create_date);
            holder.fromTitle = (TextView) rowView.findViewById(R.id.full_document_item_from_title);
            holder.from = (TextView) rowView.findViewById(R.id.full_document_item_from);
            holder.toTitle = (TextView) rowView.findViewById(R.id.full_document_item_to_title);
            holder.to = (TextView) rowView.findViewById(R.id.full_document_item_to);
            holder.registrationPanel = (RelativeLayout) rowView.findViewById(R.id.document_full_item_registration_panel);
            holder.registrationTitle = (TextView) rowView.findViewById(R.id.full_document_item_registration_title);
            holder.iconStatusFull = (ImageView) rowView.findViewById(R.id.status_icon_document_item_full);
            holder.iconRegistrationFull = (ImageView) rowView.findViewById(R.id.registration_icon_document_item_full);
            holder.registeredUserTitle = (TextView) rowView.findViewById(R.id.full_document_item_registered_user_title);
            holder.registeredDateTitle = (TextView) rowView.findViewById(R.id.full_document_item_registered_date_title);
            holder.registeredUnsubscribeTitle = (TextView) rowView.findViewById(R.id.full_document_item_registered_unsubscribe_title);
            holder.registeredResUsersTitle = (TextView) rowView.findViewById(R.id.full_document_item_registered_res_users_title);
            holder.registeredUser = (TextView) rowView.findViewById(R.id.full_document_item_registered_user);
            holder.registeredDate = (TextView) rowView.findViewById(R.id.full_document_item_registered_date);
            holder.registeredUnsubscribe = (TextView) rowView.findViewById(R.id.full_document_item_registered_unsubscribe);
            holder.registeredResUsers = (TextView) rowView.findViewById(R.id.full_document_item_registered_res_users);
            holder.subworksIcon = (ImageView) rowView.findViewById(R.id.document_subworks_icon);
            holder.gradient1 = (ImageView) rowView.findViewById(R.id.gradient1_documents_item_all);
            holder.gradient2 = (ImageView) rowView.findViewById(R.id.gradient2_documents_item_all);
            rowView.setTag(holder);
        } else {
            holder = (ViewHolder) rowView.getTag();
        }

        // если открыта полная плашка
        if (documents.get(position).isOpened()) {
            // тип документа
            if (documents.get(position).getType().equals(DocumentConst.DOCUMENT)) {
                holder.iconTypeFull.setImageDrawable(context.getResources().getDrawable(R.drawable.document_icon));
            } else if (documents.get(position).getType().equals(DocumentConst.EMAIL)) {
                holder.iconTypeFull.setImageDrawable(context.getResources().getDrawable(R.drawable.email_icon));
            }

            // резолюция ли
            if (documents.get(position).getHasResolution().equals("true")) {
                holder.iconResolutionFull.setVisibility(View.VISIBLE);
            } else {
                holder.iconResolutionFull.setVisibility(View.GONE);
            }

            // контрольный ли
            if (documents.get(position).getControlled().equals("true")) {
                holder.iconControlledFull.setVisibility(View.VISIBLE);
            } else {
                holder.iconControlledFull.setVisibility(View.GONE);
            }

            // бракован ли
            if (documents.get(position).getDefective().equals("true")) {
                holder.iconDefectiveFull.setVisibility(View.VISIBLE);
            } else {
                holder.iconDefectiveFull.setVisibility(View.GONE);
            }
            // отклонен ли
            if (documents.get(position).getStatusID().equals(DocumentConst.REJECTED)) {
                holder.iconRejectedFull.setVisibility(View.VISIBLE);
            } else {
                holder.iconRejectedFull.setVisibility(View.GONE);
            }

            // в прогрессе ли
            if (documents.get(position).getInProgress().equals("true")) {
                holder.iconInProgressFull.setVisibility(View.VISIBLE);
            } else {
                holder.iconInProgressFull.setVisibility(View.GONE);
            }

            // если документ зарегистрирован - отображаем его номер
            if (documents.get(position).getRegistered().equals("true")) {
                if (documents.get(position).getDocTypeID().equals(DocumentConst.INTERNAL_DOCS)) {
                    holder.documentNumberFull.setText(documents.get(position).getNumber() + " - " + documents.get(position).getAuthor());
                } else {
                    if (!TextUtils.isEmpty(documents.get(position).getCorrespondentOrg())) {
                        holder.documentNumberFull.setText(documents.get(position).getNumber() + " - " + documents.get(position).getCorrespondentOrg());
                    } else if (!TextUtils.isEmpty(documents.get(position).getCorrespondent())) {
                        holder.documentNumberFull.setText(documents.get(position).getNumber() + " - " + documents.get(position).getCorrespondent());
                    } else {
                        holder.documentNumberFull.setText(documents.get(position).getNumber());
                    }
                }
                holder.documentNumberFull.setTypeface(Fonts.getMedium(context));
                holder.documentNumberFull.setVisibility(View.VISIBLE);
            } else {
                holder.documentNumberFull.setVisibility(View.GONE);
            }

            // жирность имени документа
            if (documents.get(position).getIsNew().equals("true")) {
                holder.documentNameFull.setTypeface(Fonts.getMedium(context));
            } else {
                holder.documentNameFull.setTypeface(Fonts.getRoman(context));
            }

            // имя документа
            if (!documents.get(position).getContent().isEmpty()) {
                Spannable ss1 = new SpannableString(documents.get(position).getName() + " - " + documents.get(position).getContent());
                ss1.setSpan(new ForegroundColorSpan(context.getResources().getColor(R.color.default_color_work)), 0,
                        documents.get(position).getName().length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
                holder.documentNameFull.setText(ss1);
                holder.documentNameFull.setTextColor(context.getResources().getColor(R.color.document_item_content_color));
            } else {
                holder.documentNameFull.setText(documents.get(position).getName());
                holder.documentNameFull.setTextColor(context.getResources().getColor(R.color.default_color_work));
            }

            // лейбл для даты
            if (!TextUtils.isEmpty(documents.get(position).getFrom()) && !TextUtils.isEmpty(documents.get(position).getTo())) {
                holder.createDateTitleFull.setTypeface(Fonts.getRoman(context));
                holder.createDateTitleFull.setText("Отправлено: ");
            } else {
                if (!TextUtils.isEmpty(documents.get(position).getFrom())) {
                    holder.createDateTitleFull.setTypeface(Fonts.getRoman(context));
                    holder.createDateTitleFull.setText("Получено: ");
                } else if (!TextUtils.isEmpty(documents.get(position).getTo())) {
                    holder.createDateTitleFull.setTypeface(Fonts.getRoman(context));
                    holder.createDateTitleFull.setText("Отправлено: ");
                } else {
                    holder.createDateTitleFull.setTypeface(Fonts.getRoman(context));
                    holder.createDateTitleFull.setText("Создано: ");
                }
            }

            // дата
            holder.createDateFull.setTypeface(Fonts.getRoman(context));
            holder.createDateFull.setText(DateUtils.getFullDateDocumentItem(documents.get(position).getCreateDate()));

            if (!TextUtils.isEmpty(documents.get(position).getFrom())) {
                holder.fromTitle.setTypeface(Fonts.getRoman(context));
                holder.from.setTypeface(Fonts.getRoman(context));
                holder.fromTitle.setVisibility(View.VISIBLE);
                holder.from.setVisibility(View.VISIBLE);
                holder.from.setText(documents.get(position).getFrom());
            } else {
                holder.fromTitle.setVisibility(View.GONE);
                holder.from.setVisibility(View.GONE);
            }

            if (!TextUtils.isEmpty(documents.get(position).getTo())) {
                holder.toTitle.setTypeface(Fonts.getRoman(context));
                holder.to.setTypeface(Fonts.getRoman(context));
                holder.toTitle.setVisibility(View.VISIBLE);
                holder.to.setVisibility(View.VISIBLE);
                holder.to.setText(documents.get(position).getTo());
            } else {
                holder.toTitle.setVisibility(View.GONE);
                holder.to.setVisibility(View.GONE);
            }

            // если документ зарегистрирован
            if (documents.get(position).getRegistered().equals("true")) {
                holder.registrationPanel.setVisibility(View.VISIBLE);
                holder.registrationTitle.setTypeface(Fonts.getRoman(context));

                if (documents.get(position).getStatusID().equals(DocumentConst.NOT_STARTED)) {
                    holder.iconRegistrationFull.setImageDrawable(context.getResources().getDrawable(R.drawable.in_registration_icon));
                } else if (documents.get(position).getRegistered().equals("true")) {
                    holder.iconRegistrationFull.setImageDrawable(context.getResources().getDrawable(R.drawable.registered_icon));
                }

                if (documents.get(position).getFinished().equals("true")) {
                    holder.iconStatusFull.setImageDrawable(context.getResources().getDrawable(R.drawable.progress_done_icon));
                } else {
                    holder.iconStatusFull.setImageDrawable(context.getResources().getDrawable(R.drawable.calendar_status_icon));
                }

                if (!TextUtils.isEmpty(documents.get(position).getUser())) {
                    holder.registeredUnsubscribeTitle.setText(person.getSettings().getSignedOff() + ": ");
                    holder.registeredUnsubscribeTitle.setTypeface(Fonts.getRoman(context));
                    holder.registeredUnsubscribe.setTypeface(Fonts.getRoman(context));
                    holder.registeredUnsubscribe.setText(documents.get(position).getUser());
                    holder.registeredUnsubscribeTitle.setVisibility(View.VISIBLE);
                    holder.registeredUnsubscribe.setVisibility(View.VISIBLE);
                } else {
                    holder.registeredUnsubscribeTitle.setVisibility(View.GONE);
                    holder.registeredUnsubscribe.setVisibility(View.GONE);
                }

                if (!TextUtils.isEmpty(documents.get(position).getUser())) {
                    holder.registeredUnsubscribeTitle.setTypeface(Fonts.getRoman(context));
                    holder.registeredUnsubscribe.setTypeface(Fonts.getRoman(context));
                    holder.registeredUnsubscribe.setText(documents.get(position).getUser());
                    holder.registeredUnsubscribeTitle.setVisibility(View.VISIBLE);
                    holder.registeredUnsubscribe.setVisibility(View.VISIBLE);
                } else {
                    holder.registeredUnsubscribeTitle.setVisibility(View.GONE);
                    holder.registeredUnsubscribe.setVisibility(View.GONE);
                }

                if (!TextUtils.isEmpty(documents.get(position).getRegDate())) {
                    holder.registeredDateTitle.setTypeface(Fonts.getRoman(context));
                    holder.registeredDate.setTypeface(Fonts.getRoman(context));
                    holder.registeredDate.setText(DateUtils.getDateDocumentItem(documents.get(position).getRegDate()));
                    holder.registeredDateTitle.setVisibility(View.VISIBLE);
                    holder.registeredDate.setVisibility(View.VISIBLE);
                } else {
                    holder.registeredDateTitle.setVisibility(View.GONE);
                    holder.registeredDate.setVisibility(View.GONE);
                }

                if (!TextUtils.isEmpty(documents.get(position).getResUsers())) {
                    holder.registeredResUsersTitle.setTypeface(Fonts.getRoman(context));
                    holder.registeredResUsers.setTypeface(Fonts.getRoman(context));
                    holder.registeredResUsers.setText(documents.get(position).getResUsers());
                    holder.registeredResUsersTitle.setVisibility(View.VISIBLE);
                    holder.registeredResUsers.setVisibility(View.VISIBLE);
                } else {
                    holder.registeredResUsersTitle.setVisibility(View.GONE);
                    holder.registeredResUsers.setVisibility(View.GONE);
                }

                if (!TextUtils.isEmpty(documents.get(position).getRegUser())) {
                    holder.registeredUserTitle.setTypeface(Fonts.getRoman(context));
                    holder.registeredUser.setTypeface(Fonts.getRoman(context));
                    holder.registeredUser.setText(documents.get(position).getRegUser());
                    holder.registeredUserTitle.setVisibility(View.VISIBLE);
                    holder.registeredUser.setVisibility(View.VISIBLE);
                } else {
                    holder.registeredUserTitle.setVisibility(View.GONE);
                    holder.registeredUser.setVisibility(View.GONE);
                }

            } else {
                holder.registrationPanel.setVisibility(View.GONE);
            }

            holder.fullItem.setVisibility(View.VISIBLE);
            holder.partItem.setVisibility(View.GONE);

        } else {

            // жирность имени документа
            if (documents.get(position).getIsNew().equals("true")) {
                holder.name.setTypeface(Fonts.getMedium(context));
            } else {
                holder.name.setTypeface(Fonts.getRoman(context));
            }

            // цвет имени документа
            holder.name.setTextColor(context.getResources().getColor(R.color.default_color_work));

            // имя документа
            if (!documents.get(position).getContent().isEmpty()) {
                Spannable ss1 = new SpannableString(documents.get(position).getName() + " - " + documents.get(position).getContent());
                ss1.setSpan(new ForegroundColorSpan(context.getResources().getColor(R.color.default_color_work)), 0,
                        documents.get(position).getName().length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
                holder.name.setText(ss1);
                holder.name.setTextColor(context.getResources().getColor(R.color.document_item_content_color));
            } else {
                holder.name.setText(documents.get(position).getName());
                holder.name.setTextColor(context.getResources().getColor(R.color.default_color_work));
            }

            // признак происхождения
            if (documents.get(position).getHasResolution().equals("true")) {
                holder.documentIcon.setImageDrawable(context.getResources().getDrawable(R.drawable.resolution));
            } else {
                if (documents.get(position).getType().equals(DocumentConst.DOCUMENT)) {
                    holder.documentIcon.setImageDrawable(context.getResources().getDrawable(R.drawable.document_icon));
                } else if (documents.get(position).getType().equals(DocumentConst.EMAIL)) {
                    holder.documentIcon.setImageDrawable(context.getResources().getDrawable(R.drawable.email_icon));
                }
            }

            // признак нахождения документа в процессе
            if (documents.get(position).getInProgress().equals("true")) {
                holder.inProgress.setVisibility(View.VISIBLE);
            } else {
                holder.inProgress.setVisibility(View.GONE);
            }

            // дата создания
            holder.createDate.setTypeface(Fonts.getRoman(context));
            holder.createDate.setText(DateUtils.getFullDateDocumentItem(documents.get(position).getCreateDate()));

            // есть ли дочерние работы у документа
            if (documents.get(position).getHasChildren().equals("true")) {
                holder.subworksIcon.setVisibility(View.VISIBLE);
            } else {
                holder.subworksIcon.setVisibility(View.GONE);
            }

            switch (filterType) {
                case DocumentConst.USER_RECEIVED_DOCUMENTS:
                    if (!TextUtils.isEmpty(documents.get(position).getFrom())) {
                        holder.fromToLabel.setTypeface(Fonts.getRoman(context));
                        holder.fromToLabel.setText("От: ");
                        holder.fromToLabel.setVisibility(View.VISIBLE);
                        holder.fromToUser.setTypeface(Fonts.getRoman(context));
                        holder.fromToUser.setText(documents.get(position).getFrom());
                        holder.fromToUser.setVisibility(View.VISIBLE);
                        holder.fromToLabel2.setVisibility(View.GONE);
                        holder.fromToUser2.setVisibility(View.GONE);
                    } else {
                        holder.fromToLabel.setVisibility(View.GONE);
                        holder.fromToUser.setVisibility(View.GONE);
                        holder.fromToLabel2.setVisibility(View.GONE);
                        holder.fromToUser2.setVisibility(View.GONE);
                    }
                    break;
                case DocumentConst.USER_SENT_DOCUMENTS:
                    if (!TextUtils.isEmpty(documents.get(position).getTo())) {
                        holder.fromToLabel.setTypeface(Fonts.getRoman(context));
                        holder.fromToLabel.setText("Кому: ");
                        holder.fromToLabel.setVisibility(View.VISIBLE);
                        holder.fromToUser.setTypeface(Fonts.getRoman(context));
                        holder.fromToUser.setText(documents.get(position).getTo());
                        holder.fromToUser.setVisibility(View.VISIBLE);
                        holder.fromToLabel2.setVisibility(View.GONE);
                        holder.fromToUser2.setVisibility(View.GONE);
                    } else {
                        holder.fromToLabel.setVisibility(View.GONE);
                        holder.fromToUser.setVisibility(View.GONE);
                        holder.fromToLabel2.setVisibility(View.GONE);
                        holder.fromToUser2.setVisibility(View.GONE);
                    }
                    break;
                default:
                    if (!TextUtils.isEmpty(documents.get(position).getFrom()) && !TextUtils.isEmpty(documents.get(position).getTo())) {
                        holder.fromToLabel.setTypeface(Fonts.getRoman(context));
                        holder.fromToLabel.setText("От: ");
                        holder.fromToLabel.setVisibility(View.VISIBLE);
                        holder.fromToUser.setTypeface(Fonts.getRoman(context));
                        holder.fromToUser.setText(documents.get(position).getFrom());
                        holder.fromToUser.setVisibility(View.VISIBLE);
                        holder.fromToLabel2.setTypeface(Fonts.getRoman(context));
                        holder.fromToLabel2.setText("Кому: ");
                        holder.fromToLabel2.setVisibility(View.VISIBLE);
                        holder.fromToUser2.setTypeface(Fonts.getRoman(context));
                        holder.fromToUser2.setText(documents.get(position).getTo());
                        holder.fromToUser2.setVisibility(View.VISIBLE);
                    } else if (!TextUtils.isEmpty(documents.get(position).getTo())) {
                        holder.fromToLabel.setTypeface(Fonts.getRoman(context));
                        holder.fromToLabel.setText("Кому: ");
                        holder.fromToLabel.setVisibility(View.VISIBLE);
                        holder.fromToUser.setTypeface(Fonts.getRoman(context));
                        holder.fromToUser.setText(documents.get(position).getTo());
                        holder.fromToUser.setVisibility(View.VISIBLE);
                        holder.fromToLabel2.setVisibility(View.GONE);
                        holder.fromToUser2.setVisibility(View.GONE);
                    } else if (!TextUtils.isEmpty(documents.get(position).getFrom())) {
                        holder.fromToLabel.setTypeface(Fonts.getRoman(context));
                        holder.fromToLabel.setText("От: ");
                        holder.fromToLabel.setVisibility(View.VISIBLE);
                        holder.fromToUser.setTypeface(Fonts.getRoman(context));
                        holder.fromToUser.setText(documents.get(position).getFrom());
                        holder.fromToUser.setVisibility(View.VISIBLE);
                        holder.fromToLabel2.setVisibility(View.GONE);
                        holder.fromToUser2.setVisibility(View.GONE);
                    } else {
                        holder.fromToLabel.setVisibility(View.GONE);
                        holder.fromToUser.setVisibility(View.GONE);
                        holder.fromToLabel2.setVisibility(View.GONE);
                        holder.fromToUser2.setVisibility(View.GONE);
                    }
                    break;
            }

            // если открыты дочерние работы - делаем перую работу серым цветом
            if (childList && position == 0) {
                holder.subworksIcon.setVisibility(View.GONE);
                holder.gradient1.setBackgroundResource(R.drawable.child_list_gradient);
                holder.gradient2.setBackgroundResource(R.drawable.child_list_gradient);
                holder.name.setTypeface(Fonts.getMedium(context));
                holder.partItem.setBackgroundColor(context.getResources().getColor(R.color.first_item_child_documents_color));
            } else {
                holder.gradient1.setBackgroundResource(R.drawable.main_list_gradient);
                holder.gradient2.setBackgroundResource(R.drawable.main_list_gradient);
                holder.partItem.setBackgroundColor(context.getResources().getColor(R.color.background_documents_list_color));
            }

            holder.fullItem.setVisibility(View.GONE);
            holder.partItem.setVisibility(View.VISIBLE);
        }

        return rowView;
    }

    static class ViewHolder {

        // полная и неполная плашка
        RelativeLayout partItem;
        RelativeLayout fullItem;

        // компоненты для неполной плашки
        ImageView documentIcon;
        ImageView inProgress;
        TextView createDate;
        TextView name;
        TextView fromToLabel;
        TextView fromToUser;
        TextView fromToLabel2;
        TextView fromToUser2;
        ImageView subworksIcon;
        ImageView gradient1;
        ImageView gradient2;

        // компоненты для полной плашки
        ImageView iconTypeFull;
        ImageView iconResolutionFull;
        ImageView iconControlledFull;
        ImageView iconDefectiveFull;
        ImageView iconRejectedFull;
        ImageView iconInProgressFull;
        TextView documentNumberFull;
        TextView documentNameFull;
        TextView createDateTitleFull;
        TextView createDateFull;
        TextView fromTitle;
        TextView from;
        TextView toTitle;
        TextView to;

        RelativeLayout registrationPanel;
        TextView registrationTitle;
        ImageView iconStatusFull;
        ImageView iconRegistrationFull;

        TextView registeredUserTitle;
        TextView registeredDateTitle;
        TextView registeredUnsubscribeTitle;
        TextView registeredResUsersTitle;

        TextView registeredUser;
        TextView registeredDate;
        TextView registeredUnsubscribe;
        TextView registeredResUsers;
    }
}
