package com.engine.salary.entity.salaryitem.param;

import com.engine.salary.enums.SalaryRoundingModeEnum;
import com.engine.salary.enums.SalarySystemTypeEnum;
import com.engine.salary.enums.SalaryValueTypeEnum;
import com.engine.salary.enums.salaryitem.SalaryDataTypeEnum;
import com.engine.salary.util.valid.DataCheck;
import com.engine.salary.util.valid.RuntimeTypeEnum;
import com.engine.salary.util.valid.ValidTypeEnum;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * <p>Copyright: Copyright (c) 2022</p>
 * <p>Company: 泛微软件</p>
 *
 * @author qiantao
 * @version 1.0
 **/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SalaryItemSaveParam {

    //主键id
    @JsonSerialize(using = ToStringSerializer.class)
    @DataCheck(require = true, runtime = {RuntimeTypeEnum.UPDATE}, message = "id不允许为空")
    private Long id;

    //名称
    @DataCheck(require = true, max = 40, message = "名称不允许为空,名称不能超过40个字符")
    private String name;

    /**
     * 是否是系统内置的薪资项目
     *
     * @see SalarySystemTypeEnum
     */
    private Integer systemType;

    //默认使用
    private Integer useDefault;

    //薪资档案引用
    private Integer useInEmployeeSalary;

    //核算时默认隐藏
    @DataCheck(require = true, message = "核算时隐藏不允许为空")
    private Integer hideDefault;


    /**
     * 舍入规则
     *
     * @see SalaryRoundingModeEnum
     */
    @DataCheck(require = true, message = "舍入规则不允许为空")
    private Integer roundingMode;

    //保留小数位
    @DataCheck(require = true, type = ValidTypeEnum.NUMBER, max = 8, message = "小数位最多为8")
    private Integer pattern;

    /**
     * 取值方式
     *
     * @see SalaryValueTypeEnum
     */
    @DataCheck(require = true, message = "取值方式不允许为空")
    private Integer valueType;

    /**
     * 字段类型
     * @see SalaryDataTypeEnum
     */
    @DataCheck(require = true, message = "字段类型不允许为空")
    private String dataType;


    //公式
    private Long formulaId;

    //备注
    private String description;

    /**
     * 可见范围：0公共｜1私有
     */
    private Integer sharedType;

    /**
     * 绑定人员范围，','分隔
     */
    private String taxAgentIds;

    /**
     * 排序
     */
    private Integer sortedIndex;

    /**
     * 宽度
     */
    private Integer width;
}
