//#region src/rbac-flat.ts
/** Role names sourced from a prior app's production role set. */
const FLAT_ROLE_NAMES = [
	"owner",
	"admin",
	"moderator",
	"member",
	"guest"
];
/** Default capability map sourced from a prior app's production permissions. */
const DEFAULT_FLAT_ROLE_CAPABILITIES = {
	owner: [
		"manage_settings",
		"manage_users",
		"moderate_posts",
		"read"
	],
	admin: [
		"manage_settings",
		"manage_users",
		"moderate_posts",
		"read"
	],
	moderator: [
		"moderate_posts",
		"ban_users",
		"read",
		"create_post"
	],
	member: [
		"read",
		"create_post",
		"create_thread"
	],
	guest: ["read"]
};
function createFlatRbac(config = {}) {
	const roleMap = config.roleMap ?? DEFAULT_FLAT_ROLE_CAPABILITIES;
	return { async resolveCapabilities(input) {
		const caps = roleMap[input.roleKey];
		if (!caps) return [];
		return [...caps];
	} };
}
//#endregion
export { DEFAULT_FLAT_ROLE_CAPABILITIES, FLAT_ROLE_NAMES, createFlatRbac };
