package com.yuchen.saas.manage.system.api.vo;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.yuchen.saas.manage.system.api.entity.Dept;
import com.yuchen.saas.manage.system.api.entity.NestFeature;
import com.yuchen.saas.manage.system.api.entity.Role;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.nest.springwrap.core.tool.node.INode;

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


@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "RoleVO对象", description = "RoleVO对象")
public class RoleListVO extends Role implements INode<RoleListVO>, Cloneable{
    private static final long serialVersionUID = 1L;


    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;


    @JsonSerialize(using = ToStringSerializer.class)
    private Long parentId;


    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private List<RoleListVO> children;

    @Override
    public List<RoleListVO> getChildren() {
        if (this.children == null) {
            this.children = new ArrayList<>();
        }
        return this.children;
    }


    private String parentName;


    @ApiModelProperty(value = "功能ID集合")
    private List<NestFeature> features;

    @ApiModelProperty(value = "业务id集合")
    private List<RoleBusinessScopeVO> businessScopes;

    @ApiModelProperty(value = "用户姓名集合")
    private List<RoleUserNameVO> usersNames;

    @ApiModelProperty(value = "组织id集合")
    private List<Dept> depts;

    private String remarkName;

    @Override
    public Object clone() throws CloneNotSupportedException {
        return super.clone();
    }
}
