package com.ss.android.ugc.aweme.im.sdk.chat.data.model;

import X.0HH;
import X.3Q4;
import android.text.TextUtils;
import com.bytedance.covode.number.Covode;
import com.google.gson.a.c;
import java.io.Serializable;
import java.util.Map;

public class SystemContent extends BaseContent {
    @c(LIZ = "fallback_tips")
    public String fallbackTips;
    @c(LIZ = "group_tips")
    public String groupNoticeTips;
    @c(LIZ = "android_filter_max_version")
    public String maxVersion;
    @c(LIZ = "android_filter_min_version")
    public String minVersion;
    @c(LIZ = "new_template")
    public Key[] newTemplate;
    @c(LIZ = "new_tips")
    public String newTips;
    @c(LIZ = "strong_template")
    public Key[] strongTemplate;
    @c(LIZ = "strong_tips")
    public String strongTips;
    @c(LIZ = "template")
    public Key[] template;
    @c(LIZ = "tips")
    public String tips;

    static {
        Covode.recordClassIndex(84144);
    }

    public static class Key implements Serializable {
        @c(LIZ = "action")
        public int action;
        @c(LIZ = "extra")
        public Map<String, String> extra;
        @c(LIZ = "key")
        public String key;
        @c(LIZ = "link")
        public String link;
        @c(LIZ = "name")
        public String name;

        static {
            Covode.recordClassIndex(84145);
        }

        public int getAction() {
            return this.action;
        }

        public Map<String, String> getExtra() {
            return this.extra;
        }

        public String getKey() {
            return this.key;
        }

        public String getLink() {
            return this.link;
        }

        public String getName() {
            return this.name;
        }

        public void setAction(int i) {
            this.action = i;
        }

        public void setExtra(Map<String, String> map) {
            this.extra = map;
        }

        public void setKey(String str) {
            this.key = str;
        }

        public void setLink(String str) {
            this.link = str;
        }

        public void setName(String str) {
            this.name = str;
        }
    }

    public String getFallbackTips() {
        return this.fallbackTips;
    }

    public Key[] getNewTemplate() {
        return this.newTemplate;
    }

    public String getNewTips() {
        return this.newTips;
    }

    public Key[] getStrongTemplate() {
        return this.strongTemplate;
    }

    public String getStrongTips() {
        return this.strongTips;
    }

    public Key[] getTemplate() {
        return this.template;
    }

    public String getTips() {
        return this.tips;
    }

    public long getMaxVersion() {
        return safelyReturnLong(this.maxVersion);
    }

    public long getMinVersion() {
        return safelyReturnLong(this.minVersion);
    }

    public String getMsgHint() {
        if (TextUtils.isEmpty(this.tips)) {
            return this.tips;
        }
        String str = this.tips;
        Key[] keyArr = this.template;
        if (keyArr != null) {
            for (Key key : keyArr) {
                str = str.replace(0HH.LIZ("{{%s}}", new Object[]{key.getKey()}), key.getName());
            }
        }
        return str;
    }

    public void setTemplate(Key[] keyArr) {
        this.template = keyArr;
    }

    public void setTips(String str) {
        this.tips = str;
    }

    private long safelyReturnLong(String str) {
        if (str == null) {
            return 0;
        }
        try {
            return Long.parseLong(str);
        } catch (Exception e) {
            3Q4.LIZ(e);
            return 0;
        }
    }

    public static class LinkTypeExtra {
        static {
            Covode.recordClassIndex(84146);
        }

        public static boolean isSafeWarningLink(Key key) {
            if (key != null) {
                try {
                    if (key.getExtra() != null) {
                        return TextUtils.equals(key.extra.get("link_type"), "safe_warning");
                    }
                } catch (Exception e) {
                    0HH.LIZ(e);
                }
            }
            return false;
        }
    }
}
