import type { DriveShare } from "@/lib/api/types" import { NC_SHARE_TYPE } from "@/lib/drive/drive-share-types" export type ShareButtonIcon = "lock" | "users" | "globe" export function resolveShareButtonIcon(shares: DriveShare[]): ShareButtonIcon { if (shares.length === 0) return "lock" const hasPeople = shares.some( (share) => share.share_type === NC_SHARE_TYPE.USER || share.share_type === NC_SHARE_TYPE.EMAIL || share.share_type === NC_SHARE_TYPE.GROUP ) if (hasPeople) return "users" const hasPublicLink = shares.some( (share) => share.share_type === NC_SHARE_TYPE.LINK && (share.access_mode === "public" || !share.access_mode) ) if (hasPublicLink) return "globe" const hasAnyLink = shares.some((share) => share.share_type === NC_SHARE_TYPE.LINK) if (hasAnyLink) return "users" return "lock" }