package com.zhongshu.card.client.model.org.role;

import com.github.microservice.auth.security.type.AuthType;
import com.zhongshu.card.client.model.base.SuperModel;
import com.zhongshu.card.client.type.DataState;
import com.zhongshu.card.client.type.RoleType;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.Set;

/**
 * @author TRX
 * @date 2024/5/31
 */
@Data
public class RoleModel extends SuperModel {
    @Schema(description = "名称")
    private String name;

    @Schema(description = "角色编码")
    private String code;

    @Schema(description = "角色类型")
    private AuthType authType;

    private String authTypeStr;

    public String getAuthTypeStr() {
        if (authType != null) {
            return authType.getRemark();
        }
        return "";
    }

    @Schema(description = "角色类型")
    private RoleType roleType;

    private String roleTypeStr;

    @Schema(description = "角色权限列表")
    private Set<String> auth;

    @Schema(description = "状态")
    private DataState state = DataState.Enable;

    private String stateStr;

    public String getStateStr() {
        if (state != null) {
            return state.getRemark();
        }
        return "";
    }

    public String getRoleTypeStr() {
        if (roleType != null) {
            return roleType.getRemark();
        }
        return "";
    }

    @Schema(description = "是否管理角色")
    private Boolean isAdmin = Boolean.FALSE;

    @Schema(description = "是否是游客角色")
    private Boolean isVisitor = Boolean.FALSE;
}
