package jnpf.util;

import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Stream;

/**
 * 常量工具类
 *
 * @author yanwenfu
 * @create 2023-07-21
 */
public class ConstantUtil {

    /**
     * 配置key - 空间容量
     */
    public static final String CONFIG_SPACE = "totalSpace";

    /**
     * 配置key - 垃圾过期
     */
    public static final String CONFIG_RUBBISH_EXPIRE = "informationRecycleBin";

    /**
     * 配置key - 数据报表
     */
    public static final String CONFIG_DATA_REPORT = "dataReport";


    /**
     * 文件 - 空间
     */
    public static final int FILE_SPACE = 1;

    /**
     * 文件 - 文件夹
     */
    public static final int FILE_FOLDER = 2;

    /**
     * 离组
     */
    public static final int NUM_WITHDRAW = 3;
    /**
     * 是
     */
    public static final int NUM_TRUE = 1;

    /**
     * 否
     */
    public static final int NUM_FALSE = 0;

    /**
     * 结束
     */
    public static final int NUM_FINISH = 2;

    /**
     * 是
     */
    public static final String STR_TRUE = "1";

    /**
     * 否
     */
    public static final String STR_FALSE = "0";

    /**
     * 文件类型 - 文档
     */
    public static final String FILE_TYPE_DOC = "文档";
    /**
     * 文件类型 - 表格
     */
    public static final String FILE_TYPE_XLS = "表格";
    /**
     * 文件类型 - PPT
     */
    public static final String FILE_TYPE_PPT = "PPT";

    /**
     * 上传路径
     */
    public static final String UPLOAD_FOLDER = "UserDocument/%s/";

    // 单位
    public static final String UNIT_B = "B";
    public static final String UNIT_KB = "KB";
    public static final String UNIT_MB = "MB";
    public static final String UNIT_G = "G";

    /**
     * 类型 - 转发
     */
    public static final int ASSOCIATION_FORWARD = 3;
    /**
     * 类型 - 点赞
     */
    public static final int ASSOCIATION_LIKE = 4;

    /**
     * 点
     */
    public static final String POINT_SYMBOL = ".";
    public static final String LOG_DATA_FORM = "日志统计";
    public static final String CULTURE_CLOCK_IN_FORM = "文化打卡统计";
    /**
     * 计算方式 - 加
     */
    public static final String CAL_ADD = "add";
    /**
     * 计算方式 - 减
     */
    public static final String CAL_REDUCE = "reduce";
    /**
     * 计算方式 - 删
     */
    public static final String CAL_DELETE = "delete";

    /**
     * 上班
     */
    public static final String ON_DUTY = "onDuty";
    /**
     * 下班
     */
    public static final String OFF_DUTY = "offDuty";
    /**
     * 打卡类型 - 普通打卡
     */
    public static final int CLOCK_TYPE_NORMAL = 1;
    /**
     * 打卡类型 - 外勤打卡
     */
    public static final int CLOCK_TYPE_OUTSIDE = 2;
    /**
     * 打卡类型 - 补卡
     */
    public static final int CLOCK_TYPE_SUPPLY = 3;
    /**
     * 设备类型 - 地点
     */
    public static final int DEVICE_PLACE = 1;
    /**
     * 设备类型 - WIFI
     */
    public static final int DEVICE_WIFI = 2;
    /**
     * 设备类型 - 考勤机
     */
    public static final int DEVICE_MACHINE = 3;
    /**
     * 设备类型 - 未知
     */
    public static final int DEVICE_UNKNOWN = 99;
    /**
     * 状态 - 关闭
     */
    public static final int NUM_CLOSE = -1;
    /**
     * 早到早走晚到晚走
     */
    public static final int MODE_ECEG = 1;
    /**
     * 晚到早走若干分钟
     */
    public static final int MODE_LCEG = 2;
    /**
     * 仅第一次上班、最后一次下班生效
     */
    public static final int EFFECT_FIRST_LAST = 1;
    /**
     * 每次上班下班都生效
     */
    public static final int EFFECT_EVERY_TIME = 2;
    /**
     * 考勤
     */
    public static final int WORK_ATTENDANCE = 1;
    /**
     * 加班
     */
    public static final int WORK_OVERTIME = 2;
    /**
     * 请假
     */
    public static final int WORK_REST = 3;
    /**
     * 旷工打卡redis key
     */
    public static final String CLOCK_REDIS_KEY = "CLOCK_ABSENCE:";
    /**
     * 是否通过_是
     */
    public static final int PASS_TRUE = 0;
    /**
     * 是否通过_审批中
     */
    public static final int PASS_APPROVAL = 1;
    /**
     * 是否通过_否
     */
    public static final int PASS_FALSE = 2;
    /**
     * 租户设备关联
     */
    public static final String DEVICE_TENANT = "DEVICE_TENANT";
    /**
     * 考勤机设备
     */
    public static final String ATTENDANCE_DEVICE = "Attendance_Device:";

    /**
     * 上班
     */
    public static final Integer ON_WORK = 1;
    /**
     * 下班
     */
    public static final Integer OFF_WORK = 2;
    /**
     * 普通打卡
     */
    public static final int KIND_NORMAL = 1;
    /**
     * 外勤打卡
     */
    public static final int KIND_OUTSIDE = 2;
    /**
     * 最大值
     */
    public static final String MAX = "max";
    /**
     * 最小值
     */
    public static final String MIN = "min";
    /**
     * ftb旷工打卡redis key
     */
    public static final long EXPIRE_TIME_REDIS = 48 * 60 * 60;
    /**
     * ftb旷工打卡redis key
     */
    public static final String FTB_CLOCK_KEY = "FTB_CLOCK_ABSENCE:";
    /**
     * ftb打卡提醒redis key
     */
    public static final String FTB_REMIND_KEY = "FTB_CLOCK_REMIND:";

    /**
     * 考勤组类型 - 我的
     */
    public static final int GROUP_KIND_MINE = 1;
    /**
     * 考勤组类型 - 借出的
     */
    public static final int GROUP_KIND_LEND = 2;
    /**
     * 考勤组类型 - 借入的
     */
    public static final int GROUP_KIND_BORROW = 3;
    /**
     * 考勤组类型 - 原本的
     */
    public static final int GROUP_KIND_OLD = 4;
    /**
     * 审批类型 - 补卡
     */
    public static final int APPLY_REPAIR = 1;
    /**
     * 审批类型 - 出勤变更
     */
    public static final int APPLY_CHANGE = 2;
    /**
     * 审批类型 - 外勤
     */
    public static final int APPLY_OUTSIDE = 3;
    /**
     * 班
     */
    public static final int RULE_TYPE_WORK = 1;
    /**
     * 休
     */
    public static final int RULE_TYPE_REST = 2;
    /**
     * 请假
     */
    public static final int RULE_TYPE_LEAVE = 3;
    /**
     * 规划表
     */
    public static final int TABLE_TYPE_PLAN = 1;
    /**
     * 复查表
     */
    public static final int TABLE_TYPE_REVIEW = 2;
    /**
     * 检查表
     */
    public static final int TABLE_TYPE_CHECK = 3;
    /**
     * 部分
     */
    public static final int PART = 1;
    /**
     * 总共
     */
    public static final int TOTAL = 2;
    /**
     * 统计类型_种类
     */
    public static final int COUNT_TYPE_KIND = 1;
    /**
     * 统计类型_检查项
     */
    public static final int COUNT_TYPE_CHECK = 2;
    /**
     * 升序
     */
    public static final int ASC = 1;
    /**
     * 降序
     */
    public static final int DESC = 1;
    public static final String NAME_PLAN = "规划表";
    public static final String NAME_REVIEW = "复盘表";
    public static final String NAME_CHECK = "检查表";
    public static final String[] TITLE_STORE_TABLE = Stream.of("门店名称", "表名称", "提交人", "执行时间段", "提交时间", "提交状态").toArray(String[]::new);
    public static final String[] TITLE_STORE_CHECK_TABLE = Stream.of("门店名称", "专项", "频次", "表名称", "提交人", "执行时间段", "提交时间", "提交状态").toArray(String[]::new);
    public static final String[] TITLE_CULTURE_CLOCK_IN_TABLE = Stream.of("人员姓名", "所属组织", "最近打卡时间", "累计打卡天数", "连续打卡天数", "最长缺卡天数").toArray(String[]::new);
    /**
     * 导出表名称 - 门店执行力
     */
    public static final String NAME_STORE_EXECUTION = "门店执行力";
    /**
     * 导出表名称 - 检查表执行力
     */
    public static final String CHECK_STORE_EXECUTION = "检查表执行力";
    /**
     * 门店执行力导出表头
     */
    public static final String[] TITLE_STORE_EXECUTION = Stream.of("门店名称", "已提交规划表", "应提交规划表", "规划表完成率", "已提交复盘表", "应提交复盘表", "复盘表完成率").toArray(String[]::new);
    /**
     * 门店执行力导出表头2
     */
    public static final String[] TITLE_STORE_EXECUTION2 = Stream.of("门店名称", "应提交检查表", "未提交检查表", "已提交检查表", "待审批检查表", "检查表完成率", "审批完成率", "检查表复检率").toArray(String[]::new);
    /**
     * 检查表执行力 表头
     */
    public static final String[] CHECK_STORE_EXECUTION2 = Stream.of("门店名称", "专项名称", "专项表名称", "完成率", "查询率", "问题率").toArray(String[]::new);
    /**
     * 检查表问题
     */
    public static final String NAME_QUESTION_RANK = "检查表问题";
    /**
     * 问题排行导出表头
     */
    public static final String[] TITLE_QUESTION_RANK = Stream.of("门店名称", "日期范围", "检查表名称", "检查频次", "问题分类/出现次数").toArray(String[]::new);
    /**
     * 技能点异常
     */
    public static final String NAME_SKILL_ERROR = "技能点异常数据";
    /**
     * 技能点
     */
    public static final String NAME_SKILL_IMPORT = "技能点导入模板";
    /**
     * 技能点导入表头
     */
    public static final String[] TITLE_SKILL_IMPORT = Stream.of("*技能点名称", "分类", "技能点描述").toArray(String[]::new);
    /**
     * 技能点异常导出表头
     */
    public static final String[] TITLE_SKILL_ERROR = Stream.of("*技能点名称", "分类", "技能点描述", "异常原因").toArray(String[]::new);
    /**
     * object类型 - 检查表模板
     */
    public static final int OBJECT_TYPE_CHECK = 1;
    /**
     * 文件类型 - 附件
     */
    public static final int FILE_TYPE_FILE = 1;
    /**
     * 文件类型 - 图片
     */
    public static final int FILE_TYPE_PIC = 2;
    /**
     * 频率 - 每天
     */
    public static final int FREQUENCY_EVERY_DAY = 1;
    /**
     * 频率 - 每周
     */
    public static final int FREQUENCY_EVERY_WEEK = 2;
    /**
     * 频率 - 每月
     */
    public static final int FREQUENCY_EVERY_MONTH = 3;
    /**
     * 0 - decimal
     */
    public static final BigDecimal DECIMAL_ZERO = new BigDecimal("0.0000");
    /**
     * 0 - int
     */
    public static final int ZERO = 0;

    /**
     * 审批状态: 待审批
     */
    public static final int STATUS_PENDING_APPROVAL = 0;
    /**
     * 审批状态: 通过
     */
    public static final int STATUS_PASS = 1;
    /**
     * 审批状态: 未通过
     */
    public static final int STATUS_REFUSE = 2;
    /**
     * 审批状态: 撤回
     */
    public static final int STATUS_ROLLBACK = 3;
    /**
     * 存在
     */
    public static final int EXIST = 0;
    /**
     * 删除
     */
    public static final int DEL = 1;
    /**
     * 消息通知缓存-外勤
     */
    public static final String APPROVE_NOTICE_OUTSIDE = "APPROVE:OUTSIDE_";
    /**
     * 消息通知缓存-补卡
     */
    public static final String APPROVE_NOTICE_REPAIR = "APPROVE:REPAIR_";
    /**
     * 消息通知缓存-变更
     */
    public static final String APPROVE_NOTICE_CHANGE = "APPROVE:CHANGE_";
    public static final String FAIL_MESSAGE = "FAIL_MESSAGE:";
    /**
     * 请假
     */
    public static final String LEAVE_STR = "请假";
    /**
     * 上班
     */
    public static final String ON_WORK_STR = "上班";
    /**
     * 下班
     */
    public static final String OFF_WORK_STR = "下班";
    /**
     * 请假离岗
     */
    public static final String LEAVE_WORK_STR = "请假离岗";
    /**
     * 请假回岗
     */
    public static final String BACK_WORK_STR = "请假回岗";
    /**
     * 考勤机打卡结果保存redis-key
     */
    public static final String MACHINE_KEY = "MACHINE-RESULT:";
    /**
     * 猫瞳下发用户是否成功验证
     */
    public static final String SEND_USER_CHECK = "MACHINE_SEND_CHECK:";

    public static final List<String> IMAGE_CONTENT_TYPES = Arrays.asList(
            "image/jpeg",
            "image/jpg",
            "image/png",
            "image/webp"
            // 添加其他图片类型如果需要
    );
    public static final String EXTRA_PATH = "/jnpf-resource-1304460613/";
    public static final String URL_HEAD = "https://jnpf-resource-1304460613.cos.ap-chengdu.myqcloud.com";

    /**
     * 适配范围[参数] - 全部
     */
    public static final Integer SCOPE_ALL = 0;
    /**
     * 适配范围[参数] - 组织/成员
     */
    public static final Integer SCOPE_ORG_USER = 1;

    /**
     * 适配范围 - 全部
     */
    public static final Integer RULE_SCOPE_ALL = 3;
    /**
     * 适配范围 - 组织
     */
    public static final Integer RULE_SCOPE_ORG = 2;
    /**
     * 适配范围 - 个人
     */
    public static final Integer RULE_SCOPE_USER = 1;

    /**
     * 加班存休
     */
    public static final Integer BALANCE_ABLE = 1;
    /**
     * 加班不存休
     */
    public static final Integer BALANCE_ENABLE = 2;
    /**
     * 技能点导入 - 成功
     */
    public static final String SKILL_IMPORT_SUCCESS = "skill-import-success:";
    /**
     * 技能点导入 - 失败
     */
    public static final String SKILL_IMPORT_FAIL = "skill-import-fail:";
    /**
     * 是否需要更新_否[正常]
     */
    public static final Integer UPDATE_FALSE = 1;
    /**
     * 是否需要更新_是[异常]
     */
    public static final Integer UPDATE_TRUE = 2;
    /**
     * 考试类型 - 岗位
     */
    public static final Integer EXAM_TYPE_POST = 0;
    /**
     * 考试类型 - 自定义
     */
    public static final Integer EXAM_TYPE_CUSTOM = 1;
    /** 抽题类型 - 随机 */
    public static final int DRAW_MODE_RANDOM = 2;
    public static final int EASY = 1;
    public static final int MEDIUM = 2;
    public static final int HARD = 3;
    /** 分类 - 技能点 */
    public static final Integer LABEL_SKILL = 3;
    /** 默认ID -1 */
    public static final String DEFAULT_ID = "-1";
    public static final Integer TEN_MILLION = 10000000;

    public static String ONLINE_MAC = "ONLINE_MACHINE:%s:";
    /**
     * 考勤机: 科密(在线状态)
     */
    public static final String KE_MI = "KE_MI:";
    /**
     * 补卡审批类型
     */
    public static final String REPAIR_TYPE = "6";
    // 下发考勤人员信息
    public static String MACHINE_MESSAGE = "MACHINE_MSG:%s:";
}
