package com.ydl.ydlcommon.bean;

import java.io.Serializable;
import java.util.List;

//全局信息
public class GlobalInfo implements Serializable{
    public String version;
    public GlobalData info;

    public static class GlobalData implements Serializable{
        public SharAppData app_share;
        public String aboutUs;
        public String helpCenter;
        public String listenHelp;
        public String feedBack;
        public String logo;
        public String contactUs;
        public String tel;
        public String wechatAccount;
        public String work_time;
        public int listen_time;
        public float listen_fee;

        public String wxappid;
        public String wxappsecret;
        public String wxmerchantid;
        public String wxmerchantkey;

        public StartingPage startingPage;

        public int bonus_flag;//是否显示红包，1开启，2关闭
        public List<ComforWords> comfortWords;
        public List<NewYearKeyword> newYearKeywords;
        public int newYearSwitch;

        public List<String> user_home_bgs;//我的页面封面图选择列表

        public String join_doctor_url;//专家入住url
        public String notice_text; //首页公告内容
        public int is_show_notice;//1显示公告，2不显示
        public String notice_url;
        public PayNotice pay_notice;
        public int login_hide_wx;  //1隐藏，0显示


        public static class PayNotice implements Serializable{
            public String title;
            public String content;
        }

        public static class StartingPage  implements Serializable{

            public String title;
            public String desc;
            public String link_url;
            public String image_url;
            public String share_url;
            public String link_type;

        }

        public static class ComforWords  implements Serializable{
            public String word;
            public int type;
        }

        public static class NewYearKeyword  implements Serializable{
            public String comfortWord;
            public String direction;
            public String effect;
        }

        public NewYearKeyword getNewYearKeyWordByContent(String content){
            if (content == null){
                return null;
            }
            if (newYearSwitch == 1 && newYearKeywords != null){
                int minIndex =  -1;
                int showIndex = -1;
                for (int j = 0; j < newYearKeywords.size(); j++) {
                    NewYearKeyword c = newYearKeywords.get(j);
                    int tempIndex = content.indexOf(c.comfortWord);
                    if (tempIndex != -1) {
                        if (minIndex  == -1){
                            minIndex = tempIndex;
                            showIndex = j;
                        } else if (minIndex > tempIndex) {
                            minIndex = tempIndex;
                            showIndex = j;
                        }
                    }
                }
                if (showIndex != -1) {
                    return newYearKeywords.get(showIndex);
                }
            }
            return null;
        }
    }



    public static class SharAppData  implements Serializable{
        public String cover_url;
        public String descrip;
        public String dl_url;
        public String title;
    }


}