Microsoft.PowerPlatform.DevOps.vNext.psm1

[cmdletbinding()]
Param()

$global:devops_OldVerbose = $VerbosePreference
$VerbosePreference = $global:devops_Verbose

Write-Verbose "Importing Functions"

# Import everything in these folders
foreach ($folder in @('Private', 'Scripts')) {
    
    $root = Join-Path -Path $PSScriptRoot -ChildPath $folder
    if (Test-Path -Path $root) {
        Write-Verbose "processing folder $root"
        $files = Get-ChildItem -Path $root -Filter *.ps1

        # dot source each file
        $files | where-Object { $_.name -NotLike '*.Tests.ps1' } | 
        ForEach-Object { Write-Verbose "dot loading Library $($_.name) "; . $_.FullName }
    }
}

$global:devops_ToolPath = $PSScriptRoot

function Test-IsGuid {
    [OutputType([bool])]
    param
    (
        [Parameter(Mandatory = $true)]
        [string]$StringGuid
    )
 
    $ObjectGuid = [System.Guid]::empty
    return [System.Guid]::TryParse($StringGuid, [System.Management.Automation.PSReference]$ObjectGuid) # Returns True if successfully parsed
}

function Start-PPDODocker {
    Param(
        [string] [Parameter(Mandatory = $true)] $PAT,
        [string] [Parameter(Mandatory = $true)] $ADOOrg,
        [string] [Parameter(Mandatory = $true)] $ADOProject
    )
    & $PSScriptRoot\Docker\go.ps1 -PAT $PAT -ADOOrg $ADOOrg -ADOProject $ADOProject
}

Export-ModuleMember -Function 'Test-IsGuid'
#New-Alias -Name ppdo -Value Invoke-PowerPlatformDevOps -Scope Global