package cn.novalon.manage.sys.core.domain;

import cn.novalon.manage.common.util.SnowflakeId;
import io.swagger.v3.oas.annotations.media.Schema;

/**
 * 权限领域对象
 * 
 * @author 张翔
 * @date 2026-03-25
 */
@Schema(description = "系统权限实体")
public class SysPermission extends BaseDomain {

    @Schema(description = "权限名称", example = "用户管理")
    private String permissionName;

    @Schema(description = "权限编码", example = "system:user:view")
    private String permissionCode;

    @Schema(description = "资源路径", example = "/api/users")
    private String resource;

    @Schema(description = "操作类型", example = "GET")
    private String action;

    @Schema(description = "描述", example = "查看用户列表")
    private String description;

    @Schema(description = "状态：0-禁用，1-正常", example = "1")
    private Integer status;

    public String getPermissionName() {
        return permissionName;
    }

    public void setPermissionName(String permissionName) {
        this.permissionName = permissionName;
    }

    public String getPermissionCode() {
        return permissionCode;
    }

    public void setPermissionCode(String permissionCode) {
        this.permissionCode = permissionCode;
    }

    public String getResource() {
        return resource;
    }

    public void setResource(String resource) {
        this.resource = resource;
    }

    public String getAction() {
        return action;
    }

    public void setAction(String action) {
        this.action = action;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    /**
     * 生成主键ID
     * 
     * @return 主键ID
     */
    public Long generateId() {
        this.id = SnowflakeId.nextId();
        return this.id;
    }

    /**
     * 删除权限
     */
    public void delete() {
        this.deletedAt = java.time.LocalDateTime.now();
    }

    /**
     * 恢复权限
     */
    public void restore() {
        this.deletedAt = null;
    }
}