import { requireOrganizationAccess as requireOrganizationAccessFromSession } from '@/lib/auth/session';
import { getCurrentUserContext } from '@/features/foundation/auth-context/service';

export async function getCurrentOrganization() {
  const context = await getCurrentUserContext();

  return context?.activeOrganization ?? null;
}

export async function getActiveOrganizationId() {
  const context = await getCurrentUserContext();

  return context?.activeOrganization?.id ?? null;
}

export const requireOrganizationAccess = requireOrganizationAccessFromSession;
