package tech.easyflow.system.entity;

import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.RelationOneToMany;
import com.mybatisflex.annotation.Table;
import tech.easyflow.system.entity.base.SysApiKeyBase;

import java.math.BigInteger;
import java.util.List;


/**
 *  实体类。
 *
 * @author Administrator
 * @since 2025-04-18
 */
@Table("tb_sys_api_key")
public class SysApiKey extends SysApiKeyBase {

    public static final String KEY_Apikey = "Apikey";

    @Column(ignore = true)
    List<BigInteger> permissionIds;

    @Column(ignore = true)
    private Boolean knowledgeShareEnabled;

    @Column(ignore = true)
    private Boolean knowledgeReadEnabled;

    @Column(ignore = true)
    private Boolean knowledgeImportEnabled;

    @Column(ignore = true)
    private Boolean knowledgeMaintenanceEnabled;

    @Column(ignore = true)
    private Boolean workflowApiEnabled;

    @RelationOneToMany(selfField = "id", targetField = "apiKeyId", targetTable = "tb_sys_api_key_resource_mapping")
    private List<SysApiKeyResourceMapping> resourcePermissions;

    public List<SysApiKeyResourceMapping> getResourcePermissions() {
        return resourcePermissions;
    }

    public void setResourcePermissions(List<SysApiKeyResourceMapping> resourcePermissions) {
        this.resourcePermissions = resourcePermissions;
    }

    public List<BigInteger> getPermissionIds() {
        return permissionIds;
    }

    public void setPermissionIds(List<BigInteger> permissionIds) {
        this.permissionIds = permissionIds;
    }

    public Boolean getKnowledgeShareEnabled() {
        return knowledgeShareEnabled;
    }

    public void setKnowledgeShareEnabled(Boolean knowledgeShareEnabled) {
        this.knowledgeShareEnabled = knowledgeShareEnabled;
    }

    /**
     * 获取知识库读取权限开关。
     *
     * @return 是否开启读取权限
     */
    public Boolean getKnowledgeReadEnabled() {
        return knowledgeReadEnabled;
    }

    /**
     * 设置知识库读取权限开关。
     *
     * @param knowledgeReadEnabled 是否开启读取权限
     */
    public void setKnowledgeReadEnabled(Boolean knowledgeReadEnabled) {
        this.knowledgeReadEnabled = knowledgeReadEnabled;
    }

    /**
     * 获取知识库导入权限开关。
     *
     * @return 是否开启导入权限
     */
    public Boolean getKnowledgeImportEnabled() {
        return knowledgeImportEnabled;
    }

    /**
     * 设置知识库导入权限开关。
     *
     * @param knowledgeImportEnabled 是否开启导入权限
     */
    public void setKnowledgeImportEnabled(Boolean knowledgeImportEnabled) {
        this.knowledgeImportEnabled = knowledgeImportEnabled;
    }

    /**
     * 获取知识库维护权限开关。
     *
     * @return 是否开启维护权限
     */
    public Boolean getKnowledgeMaintenanceEnabled() {
        return knowledgeMaintenanceEnabled;
    }

    /**
     * 设置知识库维护权限开关。
     *
     * @param knowledgeMaintenanceEnabled 是否开启维护权限
     */
    public void setKnowledgeMaintenanceEnabled(Boolean knowledgeMaintenanceEnabled) {
        this.knowledgeMaintenanceEnabled = knowledgeMaintenanceEnabled;
    }

    public Boolean getWorkflowApiEnabled() {
        return workflowApiEnabled;
    }

    public void setWorkflowApiEnabled(Boolean workflowApiEnabled) {
        this.workflowApiEnabled = workflowApiEnabled;
    }
}
