scripts/modules/environment/windows/setup-windows-env.ps1

# strangeloop Setup - Windows Environment Setup Module
# Version: 1.0.0


param()

# Import shared modules
$SharedPath = Split-Path (Split-Path $PSScriptRoot -Parent) -Parent | Join-Path -ChildPath "shared"
Import-Module "$SharedPath\write-functions.ps1" -Force -DisableNameChecking
Import-Module "$SharedPath\test-functions.ps1" -Force -DisableNameChecking
Import-Module "$SharedPath\path-functions.ps1" -Force -DisableNameChecking

function Initialize-WindowsEnvironment {
    
    Write-Step "Setting up Windows Development Environment..."
    
    try {
        # Verify Windows environment
        Write-Progress "Verifying Windows environment..."
        
        if (-not (Test-WindowsVersion -MinimumVersion "10.0")) {
            Write-Error "Windows 10 or later is required"
            return $false
        }
        
        Write-Success "Windows version check passed"
        
        # Check .NET Framework/Core availability
        Write-Progress "Checking .NET availability..."
        
        $dotnetAvailable = Test-Command "dotnet"
        if ($dotnetAvailable) {
            Write-Success ".NET is available"
        } else {
            Write-Info ".NET not found - this may be required for some loops"
        }
        
        # Verify development tools paths
        Write-Progress "Verifying development tools..."
        
        $tools = @{
            "Git" = "git"
            "Azure CLI" = "az"
            "strangeloop CLI" = "strangeloop"
        }
        
        foreach ($tool in $tools.GetEnumerator()) {
            if (Test-Command $tool.Value) {
                Write-Success "$($tool.Key) is available"
            } else {
                Write-Warning "$($tool.Key) is not available"
            }
        }
        
        # Ensure working directory is writable
        $workingDir = Get-Location
        if (Test-DirectoryWritable $workingDir) {
            Write-Success "Working directory is writable"
        } else {
            Write-Warning "Working directory may not be writable"
        }
        
        Write-Success "Windows environment setup completed"
        return $true
        
    } catch {
        Write-Error "Windows environment setup failed: $($_.Exception.Message)"
        return $false
    }
}

# Main execution
if ($MyInvocation.InvocationName -ne '.') {
    $result = Initialize-WindowsEnvironment
    
    if ($result) {
        Write-Success "Windows environment setup completed successfully"
        return $true
    } else {
        Write-Error "Windows environment setup failed"
        return $false
    }
}

# Export functions for module usage
Export-ModuleMember -Function @(
    'Initialize-WindowsEnvironment'
)