package ink.wgink.service.role.pojo.vos;

import ink.wgink.annotation.CheckEmptyAnnotation;
import ink.wgink.common.enums.RoleDataRightEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.util.ArrayList;
import java.util.List;

/**
 * When you feel like quitting. Think about why you started
 * 当你想要放弃的时候，想想当初你为何开始
 *
 * @ClassName: RoleDataAuthorityVO
 * @Description: 角色数据权限
 * @Author: WangGeng
 * @Date: 2019/11/23 8:10 下午
 * @Version: 1.0
 **/
@ApiModel
public class RoleDataRightVO {

    @ApiModelProperty(name = "roleDataRight", value = "数据权限类型")
    @CheckEmptyAnnotation(name = "数据权限类型", types = {"all", "department", "custom", "self"})
    private String roleDataRight;
    @ApiModelProperty(name = "userIds", value = "角色数据权限列表")
    private List<String> userIds;

    public String getRoleDataRight() {
        return roleDataRight == null ? "" : roleDataRight.trim();
    }

    public void setRoleDataRight(String roleDataRight) {
        this.roleDataRight = roleDataRight;
    }

    public List<String> getUserIds() {
        if (userIds == null) {
            return new ArrayList<>();
        }
        return userIds;
    }

    public void setUserIds(List<String> userIds) {
        this.userIds = userIds;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("{");
        sb.append("\"roleDataRight\":\"")
                .append(roleDataRight).append('\"');
        sb.append(",\"userIds\":")
                .append(userIds);
        sb.append('}');
        return sb.toString();
    }
}
