package com.engine.salary.entity.salarysob.dto;

import com.engine.salary.component.WeaFormOption;
import com.engine.salary.enums.SalaryCycleTypeEnum;
import com.engine.salary.enums.SalarySobStatusEnum;
import com.engine.salary.enums.salarysob.IncomeCategoryEnum;
import com.engine.salary.util.SalaryI18nUtil;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.google.common.collect.Lists;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.util.Collections;
import java.util.List;

/**
 * 薪资账套基础信息表单
 * <p>Copyright: Copyright (c) 2022</p>
 * <p>Company: 泛微软件</p>
 *
 * @author qiantao
 * @version 1.0
 **/
@Data
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
public class SalarySobBasicFormDTO {

    //主键id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;


//    //薪资账套的名称")
    private String name;

    private Long taxAgentId;
//    private String taxAgentName;

    /**
     * 薪资类型
     * @see IncomeCategoryEnum
     */
    private Integer taxableItems;

    /**
     * 薪资周期
     * @see SalaryCycleTypeEnum
     */
    private Integer salaryCycleType;

    //薪资周期的起始日期")
    private Integer salaryCycleFromDay;

    /**
     * 税款所属期
     * @see SalaryCycleTypeEnum
     */
    private Integer taxCycleType;

    /**
     * 考勤周期
     * @see SalaryCycleTypeEnum
     */
    private Integer attendCycleType;

    //考勤周期起始日期")
    private Integer attendCycleFromDay;

    /**
     * 福利台账月份
     * @see SalaryCycleTypeEnum
     */
    private Integer socialSecurityCycleType;

    //核算人员范围")
    private String employeeRange;

    /**
     * 目前薪资账套所处的步骤
     * @see SalarySobStatusEnum
     */
    private Integer status;

    //备注")
    private String description;

    /**
     * 分权，是否可编辑
     */
    private Boolean canEdit;

    /**
     * 薪资账套详情-薪资周期/考勤周期
     *
     * @return
     */
    public List<WeaFormOption> listCycleFromDayOption() {
        List<WeaFormOption> resultList = Lists.newArrayListWithExpectedSize(31);
        for (int i = 1; i <= 31; i++) {
            resultList.add(new WeaFormOption(String.valueOf(i), SalaryI18nUtil.getI18nLabel(98382, "{0}号").replace("{0}", "" + i)));
        }
        return resultList;
    }

    /**
     * 薪资账套详情-核算人员范围
     *
     * @return
     */
    public List<WeaFormOption> listEmployeeRangeOption() {
        WeaFormOption weaFormOption = new WeaFormOption("1", SalaryI18nUtil.getI18nLabel(98381, "【入职日期≤薪资周期止】且【离职日期≥薪资周期起】"));
        weaFormOption.setDisabled(true);
        return Collections.singletonList(weaFormOption);
    }
}
