fun History.toPendingDeletionHistory(): PendingDeletionHistory { return when (this) { is History.Regular -> PendingDeletionHistory.Item(visitedAt = visitedAt, url = url) is History.Group -> PendingDeletionHistory.Group( visitedAt = visitedAt, historyMetadata = items.map { historyMetadata -> PendingDeletionHistory.MetaData( historyMetadata.visitedAt, historyMetadata.historyMetadataKey, ) }, ) is History.Metadata -> PendingDeletionHistory.MetaData(visitedAt, historyMetadataKey) } }
Maps an instance of [History] to an instance of [PendingDeletionHistory].