public/Set-CTRecordingGeneral.ps1

Function Set-CTRecordingGeneral {
    [cmdletBinding(
        DefaultParameterSetName='Hanwha',
        #SupportsShouldProcess = $true,
        ConfirmImpact='high'
        )]
    Param(
        [Parameter(
            Mandatory=$true,
            ParameterSetName='Hanwha'
        )]
        [String]$IP,

        [Parameter(
            Mandatory=$true,
            ParameterSetName='Hanwha'
        )]
        [pscredential]$Credential,

        [Parameter(
            Mandatory=$false,
            ParameterSetName='Hanwha'
        )]
        [String]$Channel,

        [Parameter(
            Mandatory=$false,
            ParameterSetName='Hanwha'
        )]
        [String]$PreEventDuration,

        [Parameter(
            Mandatory=$false,
            ParameterSetName='Hanwha'
        )]
        [String]$PostEventDuration

    )
    DynamicParam {
        $DynamicParameters = @{
            CameraType = @{
                Mandatory = $true
                #Position = 1
                ParameterSetName = "Hanwha"
                Enum = $Script:SupportedCameraModels
            }
            Continuous = @{
                Mandatory = $true
                #Position = 2
                ParameterSetName = "Hanwha"
                Enum = @(
                    'I-Frame'
                    'Full'
                    'Off'
                )
                DefaultValue = 'Full'
            }
            Event = @{
                Mandatory = $false
                #Position = 3
                ParameterSetName = "Hanwha"
                Enum = @(
                    'I-Frame'
                    'Full'
                    'Off'
                )
                DefaultValue = 'Full'
            }
            FileType = @{
                Mandatory = $false
                #Position = 3
                ParameterSetName = "Hanwha"
                Enum = @(
                    'STW'
                    'AVI'
                )
                DefaultValue = 'AVI'
            }
        }
        
        return New-DynamicParameterSet -ParameterTable $DynamicParameters
    }
    Begin {
        Write-Debug "[Set-CTRecordingGeneral] Started"
        $CameraType = $PSBoundParameters.CameraType
        $Continuous = $PSBoundParameters.Continuous
        $CamEvent = $PSBoundParameters.Event
        $FileType = $PSBoundParameters.FileType

        #Build Submission Object
        $obj = @{
            IP = $IP
            Credential = $Credential
            Continuous = $Continuous
            CamEvent = $CamEvent
            FileType = $FileType
            Channel = $Channel
            PreEventDuration = $PreEventDuration
            PostEventDuration = $PostEventDuration
        }

        #Choose Camera Model
        Switch ($CameraType) {
            Hanwha {
                return Set-HanwhaRecordingGeneral -Object $obj
            }
        }
    }
}