Public/Get-ConnectorSyncSessionOperationStatistics.ps1

<#
.SYNOPSIS
    Returns statistics about the operations

.DESCRIPTION
    Returns statistics about the operations

.OUTPUTS
    System.Collections.Hashtable

.EXAMPLE
    $Operations | Get-ConnectorSyncSessionOperationStatistics
#>

function Get-ConnectorSyncSessionOperationStatistics {
    [CmdletBinding()]
    [OutputType([System.Collections.Hashtable])]
    param (
        [Parameter(ValueFromPipeline = $true)]
        [System.Collections.Hashtable] $Operation
    )

    begin {
        $Stats = @{
            Create = 0
            Update = 0
            Delete = 0
        }
    }

    process {
        if ($Operation.OperationType -eq "Create") {
            $Stats.Create += 1
        }
        elseif ($Operation.OperationType -eq "Update") {
            $Stats.Update += 1
        }
        elseif ($Operation.OperationType -eq "Delete") {
            $Stats.Delete += 1
        }
        else {
            throw "Unknown operation type: $($Operation.OperationType)"
        }
    }

    end {
        return $Stats
    }
}