package com.usoftchina.qywx.sdk.dto;

import java.util.HashMap;
import java.util.Map;

/**
 * @author yingp
 */
public class UpdateDepartmentReq {
    /**
     * 部门名称。长度限制为1~32个字符，字符不能包括\:?”<>｜
     */
    private String name;
    /**
     * 英文名称，需要在管理后台开启多语言支持才能生效。长度限制为1~32个字符，字符不能包括\:?”<>｜
     */
    private String enName;
    /**
     * 父部门id，32位整型
     */
    private Integer parentId;
    /**
     * 在父部门中的次序值。order值大的排序靠前。有效的值范围是[0, 2^32)
     */
    private Integer order;
    /**
     * 部门id
     */
    private Integer id;

    public UpdateDepartmentReq name(String name) {
        this.name = name;
        return this;
    }

    public UpdateDepartmentReq enName(String enName) {
        this.enName = enName;
        return this;
    }

    public UpdateDepartmentReq parent(Integer parentId) {
        this.parentId = parentId;
        return this;
    }

    public UpdateDepartmentReq order(Integer order) {
        this.order = order;
        return this;
    }

    public UpdateDepartmentReq id(Integer id) {
        this.id = id;
        return this;
    }

    public Map<String, Object> build() {
        Map<String, Object> data = new HashMap<>(3);
        data.put("name", name);
        if (null != enName) {
            data.put("name_en", enName);
        }
        data.put("parentid", parentId);
        if (null != order) {
            data.put("order", order);
        }
        data.put("id", id);
        return data;
    }
}
