config/domains/infrastructure.psd1

@{
    # ===================================================================
    # INFRASTRUCTURE - System and Infrastructure Settings
    # ===================================================================
    Infrastructure           = @{
        # Provider settings
        Provider         = 'opentofu'
        Hypervisor       = 'hyperv'
        WorkingDirectory = './infrastructure'

        # Default resource settings
        DefaultVMPath    = 'C:\VMs'
        DefaultMemory    = '2GB'
        DefaultCPU       = 2

        # Directory paths
        Directories      = @{
            LocalPath     = 'C:/temp'
            HyperVPath    = 'C:/HyperV'
            IsoSharePath  = 'C:/iso_share'
            InfraRepoPath = 'C:/Temp/base-infra'
        }

        # HyperV specific settings
        HyperV           = @{
            EnableManagementTools = $true
            Https                 = $true
            Insecure              = $true
            UseNtlm               = $true
            Timeout               = '30s'
            Port                  = 5986
            ScriptPath            = 'C:/Temp/tofu_%RAND%.cmd'
            ProviderVersion       = '1.2.1'
        }

        # Repository settings
        Repositories     = @{
            RepoUrl      = 'https://github.com/Aitherium/AitherLabs.git'
            InfraRepoUrl = 'https://github.com/Aitherium/aitherium-infrastructure.git'
        }

        # Git Submodule Management for Infrastructure
        # Infrastructure repositories are configured as Git submodules for flexible, versioned deployments
        Submodules       = @{
            Enabled      = $true
            AutoInit     = $true  # Automatically initialize submodules on bootstrap
            AutoUpdate   = $false # Don't auto-update submodules (requires explicit action)

            # Default infrastructure repository (Aitherium Infrastructure)
            # Tailored for customized mass deployments to any environment
            Default      = @{
                Name        = 'aitherium-infrastructure'
                Url         = 'https://github.com/Aitherium/aitherium-infrastructure.git'
                Path        = 'infrastructure/aitherium'
                Branch      = 'main'
                Description = 'Default Aitherium infrastructure templates for mass deployment'
                Enabled     = $true
                Repositories = @{}
                Behavior     = @{
                    RecursiveInit    = $true
                    ShallowClone     = $false
                    ParallelJobs     = 4
                    TimeoutSeconds   = 300
                    RetryAttempts    = 3
                    VerifySignatures = $false
                }
            }

            # Additional infrastructure repositories can be configured here
            # Each entry will be managed as a separate Git submodule
            Repositories = @{}

            # Submodule behavior settings
            Behavior     = @{
                RecursiveInit    = $true  # Initialize submodules recursively
                ShallowClone     = $false # Use full clone (not shallow) for better git history
                ParallelJobs     = 4      # Number of parallel jobs for submodule operations
                TimeoutSeconds   = 300    # Timeout for submodule operations
                RetryAttempts    = 3      # Number of retry attempts for failed operations
                VerifySignatures = $false # Verify GPG signatures on submodule commits
            }
        }
    }

    # ===================================================================
    # PSSESSION MANAGEMENT - PowerShell Remoting Session Configuration
    # ===================================================================
    PSSessionManagement         = @{
        # Default session settings
        DefaultPort             = @{
            WinRM               = 5985
            WinRMHTTPS          = 5986
            SSH                 = 22
        }

        # Session storage
        SavedSessionsPath       = './library/saved-sessions'

        # Session pooling
        EnableSessionPooling   = $true
        MaxPoolSize             = 10
        SessionTimeout          = 3600  # seconds (1 hour)

        # Connection settings
        ConnectionTimeout       = 30  # seconds
        OperationTimeout        = 300  # seconds (5 minutes)

        # Security settings
        RequireSSL              = $false  # Set to $true for production WinRM
        VerifyHostKeys          = $true  # For SSH connections

        # Retry settings
        MaxRetries              = 3
        RetryDelay              = 5  # seconds
    }

    Features = @{
        # Infrastructure components
        Infrastructure = @{
            System               = @{
                Enabled       = $false
                InstallScript = '0100'
                Platforms     = @('Windows', 'Linux', 'macOS')
                Description   = 'Base system configuration'
            }
            HyperV               = @{
                Enabled           = $false
                InstallScript     = '0105'
                Platforms         = @('Windows')
                RequiresElevation = $true
                Configuration     = @{
                    PrepareHost           = $false
                    EnableManagementTools = $true
                    DefaultVMPath         = 'C:\VMs'
                    DefaultVHDPath        = 'C:\VHDs'
                    Host                  = 'localhost'
                    User                  = 'Administrator'
                    Port                  = 5985
                    Https                 = $true
                    Insecure              = $true
                    UseNtlm               = $true
                    Timeout               = '30s'
                }
            }
            WSL2                 = @{
                Enabled           = $false
                InstallScript     = '0106'
                Platforms         = @('Windows')
                RequiresElevation = $true
                Configuration     = @{
                    Distribution = 'Ubuntu'
                    Version      = '2'
                    Settings     = @{
                        Memory              = '4GB'
                        Processors          = 2
                        SwapSize            = '2GB'
                        LocalhostForwarding = $true
                    }
                }
            }
            WindowsAdminCenter   = @{
                Enabled           = $false
                InstallScript     = '0106'
                Platforms         = @('Windows')
                RequiresElevation = $true
                Description       = 'Windows Admin Center for remote management'
            }
            CertificateAuthority = @{
                Enabled           = $false
                InstallScript     = '0104'
                Platforms         = @('Windows')
                RequiresElevation = $true
                Description       = 'Certificate Authority installation'
            }
            PXE                  = @{
                Enabled           = $false
                InstallScript     = '0112'
                Platforms         = @('Windows')
                RequiresElevation = $true
                Description       = 'PXE boot configuration'
            }
            OpenTofu             = @{
                Enabled          = $false
                Version          = 'latest'
                InstallScript    = '0008'
                InitializeScript = '0009'
                Platforms        = @('Windows', 'Linux', 'macOS')
                Configuration    = @{
                    Initialize       = $false
                    WorkingDirectory = './infrastructure'
                }
            }
            Go                   = @{
                Enabled       = $false
                Version       = 'latest'
                InstallScript = '0007'
                Platforms     = @('Windows', 'Linux', 'macOS')
                Description   = 'Go programming language'
            }
            ValidationTools      = @{
                Enabled       = $true  # Enabled by default for code quality
                InstallScript = '0006'
                Platforms     = @('Windows', 'Linux', 'macOS')
                Description   = 'Validation and linting tools (actionlint, etc.)'
            }
            Directories          = @{
                Enabled       = $true
                InstallScript = '0002'
                Configuration = @{
                    HyperVPath    = 'C:\VMs'
                    IsoSharePath  = 'C:\ISOs'
                    LocalPath     = '$HOME/aitherzero/infra'
                    InfraRepoPath = '$HOME/aitherzero/infra-repo'
                }
            }
            Defaults             = @{
                Provider         = 'opentofu'
                Hypervisor       = 'hyperv'
                WorkingDirectory = './infrastructure'
                DefaultVMPath    = 'C:\VMs'
                DefaultMemory    = '2GB'
                DefaultCPU       = 2
            }
        }
    }
}