import { createAccessControl } from "better-auth/plugins/access";
import { adminAc, defaultStatements } from "better-auth/plugins/admin/access";

export const statement = {
	...defaultStatements,
	dashboard: ["access"],
	libraries: ["create", "read", "update", "delete"],
	extensions: ["create", "read", "update", "delete"],
} as const;

export const accessControl = createAccessControl(statement);

export const adminRole = accessControl.newRole({
	...adminAc.statements,
	dashboard: ["access"],
	libraries: ["create", "read", "update", "delete"],
	extensions: ["create", "read", "update", "delete"],
});

export const moderatorRole = accessControl.newRole({
	dashboard: ["access"],
	libraries: ["read"],
	extensions: ["read"],
});

export const userRole = accessControl.newRole({
	libraries: ["read"],
	extensions: ["read"],
});
