import type { RoleKey } from "@prisma/client";
import type { UserRole } from "@/lib/types";

export const ROLE_SCOPE: Record<UserRole, RoleKey[]> = {
  owner: ["owner", "leader", "employee"],
  leader: ["employee"],
  employee: ["employee"],
};

export function getAssignableRoles(role: UserRole | undefined): RoleKey[] {
  if (!role) {
    return [];
  }
  return ROLE_SCOPE[role] ?? [];
}

export function canInviteUsers(role: UserRole | undefined): boolean {
  return role === "owner" || role === "leader";
}
