/**
 * Extract the numeric ID from an API Platform IRI string.
 * Example: "/api/projects/5" → 5
 */
export function extractIdFromIri(iri: string | null | undefined): number {
    if (!iri) return 0
    const lastSlash = iri.lastIndexOf('/')
    if (lastSlash === -1) return 0
    const id = Number(iri.substring(lastSlash + 1))
    return Number.isFinite(id) ? id : 0
}
