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

import ink.wgink.annotation.CheckEmptyAnnotation;
import ink.wgink.annotation.CheckNumberAnnotation;
import ink.wgink.service.permission.service.IPermissionService;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

/**
 * @ClassName: PermissionVO
 * @Description: 权限
 * @Author: WenG
 * @Date: 2020-05-27 15:58
 * @Version: 1.0
 **/
@ApiModel
public class PermissionVO {

    @ApiModelProperty(name = "permissionTitle", value = "权限名称")
    @CheckEmptyAnnotation(name = "权限名称")
    private String permissionTitle;
    @ApiModelProperty(name = "permissionType", value = "权限类型")
    @CheckEmptyAnnotation(name = "权限类型", types = {IPermissionService.PERMISSION_INSERT, IPermissionService.PERMISSION_DELETE, IPermissionService.PERMISSION_UPDATE, IPermissionService.PERMISSION_QUERY})
    private String permissionType;
    @ApiModelProperty(name = "permissionUrl", value = "权限路径")
    private String permissionUrl;
    @ApiModelProperty(name = "apiTag", value = "接口标识")
    @CheckEmptyAnnotation(name = "系统标识")
    private String apiTag;
    @ApiModelProperty(name = "systemTag", value = "系统标识")
    private String systemTag;
    @ApiModelProperty(name = "isPublic", value = "是否公共")
    @CheckNumberAnnotation(name = "是否公共", types = {"0", "1"})
    private Integer isPublic;

    public String getPermissionTitle() {
        return permissionTitle == null ? "" : permissionTitle.trim();
    }

    public void setPermissionTitle(String permissionTitle) {
        this.permissionTitle = permissionTitle;
    }

    public String getPermissionType() {
        return permissionType == null ? "" : permissionType.trim();
    }

    public void setPermissionType(String permissionType) {
        this.permissionType = permissionType;
    }

    public String getPermissionUrl() {
        return permissionUrl == null ? "" : permissionUrl.trim();
    }

    public void setPermissionUrl(String permissionUrl) {
        this.permissionUrl = permissionUrl;
    }

    public String getApiTag() {
        return apiTag == null ? "" : apiTag.trim();
    }

    public void setApiTag(String apiTag) {
        this.apiTag = apiTag;
    }

    public String getSystemTag() {
        return systemTag == null ? IPermissionService.DEFAULT_SYSTEM_TAG : systemTag.trim();
    }

    public void setSystemTag(String systemTag) {
        this.systemTag = systemTag;
    }

    public Integer getIsPublic() {
        return isPublic;
    }

    public void setIsPublic(Integer isPublic) {
        this.isPublic = isPublic;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("{");
        sb.append("\"permissionTitle\":\"")
                .append(permissionTitle).append('\"');
        sb.append(",\"permissionType\":\"")
                .append(permissionType).append('\"');
        sb.append(",\"permissionUrl\":\"")
                .append(permissionUrl).append('\"');
        sb.append(",\"apiTag\":\"")
                .append(apiTag).append('\"');
        sb.append(",\"systemTag\":\"")
                .append(systemTag).append('\"');
        sb.append(",\"isPublic\":")
                .append(isPublic);
        sb.append('}');
        return sb.toString();
    }
}
