package com.engine.salary.entity.datacollection.bo;

import com.cloudstore.eccom.pc.table.WeaTableColumn;
import com.engine.salary.util.SalaryI18nUtil;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;

import java.util.LinkedList;
import java.util.List;
import java.util.Map;

/**
 * 考勤引用-字段管理
 * <p>Copyright: Copyright (c) 2022</p>
 * <p>Company: 泛微软件</p>
 *
 * @author qiantao
 * @version 1.0
 **/
public class AttendQuoteFieldBO {


    public static List<WeaTableColumn> buildRecordTableColumns() {
        List<WeaTableColumn> result = Lists.newArrayListWithExpectedSize(5);
        result.add(new WeaTableColumn("20%", SalaryI18nUtil.getI18nLabel(87628, "字段名称"), "fieldName"));
        result.add(new WeaTableColumn("20%", SalaryI18nUtil.getI18nLabel(87617, "来源"), "sourceType"));
        result.add(new WeaTableColumn("20%", SalaryI18nUtil.getI18nLabel(84758, "类型"), "fieldType"));
        result.add(new WeaTableColumn("20%", SalaryI18nUtil.getI18nLabel(87629, "是否启用"), "enableStatus"));
        result.add(new WeaTableColumn("20%", SalaryI18nUtil.getI18nLabel(84961, "备注"), "description"));
        return result;
    }

//    public static Map<String, EditableTableItem> buildEditableTableItemMap() {
//        Map<String, EditableTableItem> resultMap = Maps.newHashMapWithExpectedSize(9);
//        resultMap.put("fieldName", new EditableTableItem(EditableTableItemType.INPUT, "", true));
//        resultMap.put("sourceType", new EditableTableItem(EditableTableItemType.INPUT, "", true));
//        resultMap.put("fieldType", new EditableTableItem(EditableTableItemType.INPUT, "", true));
//        resultMap.put("enableStatus", new EditableTableItem(EditableTableItemType.SWITCH, "", false));
//        resultMap.put("description", new EditableTableItem(EditableTableItemType.INPUT, "", true));
//        return resultMap;
//    }

    /**
     * 考勤模块固定字段编码
     * 注意：目前固定，后期考勤模块会管理维护
     *
     * @return
     */
    public static List<Map<String, String>> buildAttendFixedFields() {
        List<Map<String, String>> attendFixedFields = new LinkedList<>();

        //-------------------------------按小时------------------------------------------------------------

        // 应出勤工时
        attendFixedFields.add(attendFixedField("workmins_hour", 92040, "应出勤工时"));
        // 实际出勤工时
        attendFixedFields.add(attendFixedField("attendancemins_hour", 92042, "实际出勤工时"));

        // 迟到工时
        attendFixedFields.add(attendFixedField("belatemins_hour", 92043, "迟到时长"));
        attendFixedFields.add(attendFixedField("gravebelatemins_hour", 92043, "严重迟到时长"));
        // 早退工时
        attendFixedFields.add(attendFixedField("leaveearlymins_hour", 92044, "早退时长"));
        attendFixedFields.add(attendFixedField("graveleaveearlymins_hour", 92044, "严重早退时长"));

        // 未出勤工时
//        attendFixedFields.add(attendFixedField("forgotcheckmins_hour", 92045, "漏签时长"));
        // 旷工工时
        attendFixedFields.add(attendFixedField("absenteeism_hour", 92046, "旷工次数"));
        attendFixedFields.add(attendFixedField("absenteeismmins_hour", 92046, "旷工工时"));

        //----------------------------按天-------------------------------------------------------------

        // 应出勤天数
        attendFixedFields.add(attendFixedField("workdays_day", 92059, "应出勤天数"));
        // 实际出勤天数
        attendFixedFields.add(attendFixedField("attendancedays_day", 92061, "实际出勤天数"));

        /* ====== 异常缺勤 ==================================== */
        // 迟到天数
        attendFixedFields.add(attendFixedField("belate_day", 92062, "迟到次数"));
        attendFixedFields.add(attendFixedField("gravebelate_day", 92043, "严重迟到次数"));
        // 早退天数
        attendFixedFields.add(attendFixedField("leaveeearly_day", 92063, "早退次数"));
        attendFixedFields.add(attendFixedField("graveleaveearly_day", 92044, "严重早退次数"));
        // 未出勤天数
        attendFixedFields.add(attendFixedField("forgotcheck_day", 92064, "漏签次数"));
        // 旷工天数
        attendFixedFields.add(attendFixedField("absenteeism_day", 92065, "旷工天数"));

        //请假
//        attendFixedFields.add(attendFixedField("leavemins_day", 92065, "请假时长"));
//        attendFixedFields.add(attendFixedField("evectionmins_day", 92065, "出差时长"));
//        attendFixedFields.add(attendFixedField("toutmins_day", 92065, "公出时长"));


        return attendFixedFields;
    }

    private static Map<String, String> attendFixedField(String code, int labelId, String name) {
        Map<String, String> map = Maps.newHashMapWithExpectedSize(2);
        map.put("code", code);
        map.put("name", name);
        return map;
    }
}
