package com.engine.salary.entity.taxrate;

import java.time.LocalDateTime;
import java.util.Date;
import java.util.Map;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import static com.engine.salary.constant.SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY;

/**
 * 个税扣缴义务人表
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class TaxAgent {
    /**
     * 创建时间
     */
    private Date createTime;
    /**
     * 创建人
     */
    private Long creator;
    /**
     * 是否已删除。0：未删除、1：已删除
     */
    private Integer deleteType;
    /**
     * 描述
     */
    private String description;
    /**
     * 主键
     */
    private Long id;
    /**
     * 名称
     */
    private String name;
    /**
     * 租户ID
     */
    private String tenantKey;
    /**
     * 更新时间
     */
    private Date updateTime;


    public static TaxAgent convertToPO(Map<String, Object> param, Long employeeId) {
        if (param == null) {
            return null;
        }
        return TaxAgent.builder()
                .id(param.get("id") == null ? null : (long) param.get("id"))
                .name(param.get("name") == null ? null : (String) param.get("name"))
                .description(param.get("description") == null ? null : (String) param.get("description"))
                .deleteType(0)
                .createTime(new Date())
                .updateTime(new Date())
                .creator(employeeId)
                .tenantKey(DEFAULT_TENANT_KEY)
//                .tenantKey(tenantKey)
                .build();
    }

}