package com.offcn.im.demo.util;

import com.jyall.base.util.ValidateUtils;
import com.offcn.im.demo.bean.UserBean;

import java.util.ArrayList;
import java.util.List;

/**
 * 测试数据
 */
public class MockData {
    public static List<UserBean> getUsers() {
        UserBean friendBean1 = new UserBean("721573asdkjsajdka", "王721573", "", "721573ThXLFM/oGZPTks22QjPNnSvkJxD3aqwtLkmbsTlhm4t5p5G+RXCyx8SwRXv6GO1RVM3WGJzCxmef1N3WZ9euRt5tvKs1XLLYIDGe4PIEBqPrvxEReyZv0jSd+XWxE0EF");
        UserBean friendBean2 = new UserBean("555853asdkjsajdka", "王555853", "", "555853ThXLFM/oGZPTks22QjPNnSvkJxD3aqwtLkmbsTlhm4t5p5G+RXCyx8SwRXv6GO1RVM3WGJzCxmef1N3WZ9euRt5tvKs1XLLYIDGe4PIEBqPrvxEReyZv0jSd+XWxE0EF");
        UserBean friendBean3 = new UserBean("491503asdkjsajdka", "王491503", "", "491503ThXLFM/oGZPTks22QjPNnSvkJxD3aqwtLkmbsTlhm4t5p5G+RXCyx8SwRXv6GO1RVM3WGJzCxmef1N3WZ9euRt5tvKs1XLLYIDGe4PIEBqPrvxEReyZv0jSd+XWxE0EF");
        UserBean friendBean4 = new UserBean("132661asdkjsajdka", "王132661", "", "132661ThXLFM/oGZPTks22QjPNnSvkJxD3aqwtLkmbsTlhm4t5p5G+RXCyx8SwRXv6GO1RVM3WGJzCxmef1N3WZ9euRt5tvKs1XLLYIDGe4PIEBqPrvxEReyZv0jSd+XWxE0EF");
        UserBean friendBean5 = new UserBean("753977asdkjsajdka", "王753977", "", "753977ThXLFM/oGZPTks22QjPNnSvkJxD3aqwtLkmbsTlhm4t5p5G+RXCyx8SwRXv6GO1RVM3WGJzCxmef1N3WZ9euRt5tvKs1XLLYIDGe4PIEBqPrvxEReyZv0jSd+XWxE0EF");
        List<UserBean> list = new ArrayList<>();
        list.add(friendBean1);
        list.add(friendBean2);
        list.add(friendBean3);
        list.add(friendBean4);
        list.add(friendBean5);
        return list;
    }

    public static String[] getUserNames() {
        return new String[]{"王721573", "王555853", "王491503", "王132661", "王753977"};
    }

    public static UserBean getUserById(String id) {
        List<UserBean> dataList = getUsers();
        for (UserBean bean : dataList) {
            if (bean.getUser_id().equals(id)) {
                return bean;
            }
        }

        return null;
    }

    public static UserBean getUserByName(String name) {
        if (ValidateUtils.isEmpty(name)) {
            return null;
        }
        List<UserBean> dataList = getUsers();
        for (UserBean bean : dataList) {
            if (bean.getName().equals(name)) {
                return bean;
            }
        }

        return null;
    }
}
