package org.xyzh.api.system.vo;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.xyzh.common.vo.BaseVO;

/**
 * @description    访问控制列表视图对象
 * @filename    AclVO.java
 * @author    yslg
 * @copyright yslg
 * @since 2025-11-04
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Schema(description = "访问控制列表视图对象")
public class AclVO extends BaseVO {
    // TbSysAclDTO对应字段
    @Schema(description = "权限ID")
    private String aclId;

    @Schema(description = "对象类型：article/file/course/...")
    private String objectType;

    @Schema(description = "对象ID")
    private String objectId;

    @Schema(description = "主体类型：user/dept/role")
    private String principalType;

    @Schema(description = "主体ID")
    private String principalId;

    @Schema(description = "当主体为role且限定到某部门时的部门ID（支持某部门的某角色）")
    private String principalDeptId;

    @Schema(description = "权限位：1读 2写 4执行")
    private Integer permission;

    @Schema(description = "允许或显式拒绝", defaultValue = "true")
    private Boolean allow = true;

    @Schema(description = "是否包含子级（对dept/role生效）", defaultValue = "false")
    private Boolean includeDescendants = false;

    // TbSysAclPolicyDTO对应字段
    @Schema(description = "策略ID")
    private String policyId;
    
    @Schema(description = "策略名称")
    private String policyName;

    @Schema(description = "对象类型：article/file/course/..")
    private String policyObjectType; 

    @Schema(description = "编辑层级规则：parent_only/parent_or_same_admin/owner_only/none")
    private String editHierarchyRule;

    @Schema(description = "可见层级规则 children_all/children_specified/none")
    private String viewHierarchyRule;

    @Schema(description = "默认权限（无显式ACL时应用）", defaultValue = "0")
    private Integer defaultPermission = 0;

    @Schema(description = "默认是否允许", defaultValue = "true")
    private Boolean defaultAllow = true;
    
    @Schema(description = "是否默认应用到子级", defaultValue = "true")
    private Boolean applyToChildren = true;
}
