Checks/Aws/Test-CloudtrailInsightsExist.ps1

function Test-CloudtrailInsightsExist {
    <#
    .SYNOPSIS
        CloudTrail trail has Insights enabled

    .DESCRIPTION
        **CloudTrail trails** that are logging are evaluated for **Insights** via `insight selectors`, which enable anomaly detection on management-event patterns (API call and error rates). The finding pinpoints logging trails where these selectors are missing.

    .PARAMETER Check
        CIEMCheck object containing check metadata.
    #>

    [CmdletBinding()]
    [OutputType([PSCustomObject[]])]
    param(
        [Parameter(Mandatory)]
        [CIEMCheck]$Check
    )

    $ErrorActionPreference = 'Stop'

    # TODO: Implement check logic based on Prowler check: cloudtrail_insights_exist

    [CIEMScanResult]::Create($Check, 'MANUAL', 'This check requires manual implementation. See Prowler check cloudtrail_insights_exist for reference.', 'N/A', 'cloudtrail Resources')
}