type WithId = { id: number | string };

export function applyOptimisticDelete<T extends WithId>(
	items: T[],
	total: number,
	deletedId: number | string
): { items: T[]; total: number } {
	return {
		items: items.filter((item) => String(item.id) !== String(deletedId)),
		total: Math.max(0, total - 1)
	};
}
