Classes/license.class.ps1

using namespace System.Management.Automation

<#
    .SYNOPSIS Class used to Autocomplete and validate License parameter
#>

class PwshFwSupportedLicenses : IValidateSetValuesGenerator {

    static $ValidValues = (Invoke-RestMethod https://gitlab.com/api/v4/templates/licenses).key

    ## GetValidValues
    ## @brief used by ValidateSet parameter validator
    [string[]] GetValidValues() {
        # $Values = $this.ValidValues
        return [PwshFwSupportedLicenses]::ValidValues
    }

    ## GetValues
    ## @brief static function used in code
    static [string[]] GetValues() {
        # $Values = @('Linux', 'macOS', 'Windows')
        return [PwshFwSupportedLicenses]::ValidValues
    }
}

<#
    .SYNOPSIS Class used to Autocomplete and validate Architecture parameter
#>

class AnyPKGSupportedArchitectures : IValidateSetValuesGenerator {

    static $ValidValues = @('arm32', 'arm64', 'x86', 'x64')

    ## GetValidValues
    ## @brief used by ValidateSet parameter validator
    [string[]] GetValidValues() {
        # $Values = $this.ValidValues
        return [AnyPKGSupportedArchitectures]::ValidValues
    }

    ## GetValues
    ## @brief static function used in code
    static [string[]] GetValues() {
        # $Values = @('Linux', 'macOS', 'Windows')
        return [AnyPKGSupportedArchitectures]::ValidValues
    }
}

# EXAMPLE
# function Clear-FileInCurrentLocation {
# [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'High')]
# param(
# [Parameter(Position = 0, Mandatory)]
# [ValidateSet( [AnyPKGSupportedPlatforms] )]
# [string]
# $Path
# )

# Clear-Content -Path $Path
# }