package com.ruoyi.web.modules.trading.support;

/**
 * 入场隔离登记常量。
 */
public final class EntryIsolationRules
{
    public static final String DEL_FLAG_NORMAL = "0";

    public static final String DEL_FLAG_DELETED = "2";

    public static final int MIN_CERT_NO_LEN = 1;

    public static final int MAX_CERT_NO_LEN = 50;

    public static final int MIN_ISOLATION_DAYS = 1;

    public static final int MAX_ISOLATION_DAYS = 3650;

    public static final int MIN_EAR_TAG_LEN = 1;

    public static final int MAX_EAR_TAG_LEN = 32;

    public static final int MAX_REMARK_LEN = 500;

    private EntryIsolationRules()
    {
    }

    public static boolean isCertExtensionAllowed(String filenameOrPath)
    {
        String ext = extensionOf(filenameOrPath);
        return ext.equals("pdf") || ext.equals("md") || ext.equals("doc") || ext.equals("docx")
                || ext.equals("xls") || ext.equals("xlsx") || ext.equals("ppt") || ext.equals("pptx");
    }

    public static String extensionOf(String name)
    {
        if (name == null)
        {
            return "";
        }
        int i = name.lastIndexOf('.');
        if (i < 0 || i == name.length() - 1)
        {
            return "";
        }
        return name.substring(i + 1).toLowerCase();
    }
}
