# -*- mode: ruby -*-
# vi: set ft=ruby :

# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|

  config.vm.box = "gusztavvargadr/windows-11"
  config.vm.box_version = "2302.0.2409"
  config.vm.hostname = "windows-vpn"
  
  ## Enable bridge network
  config.vm.network "private_network", ip: "192.168.56.10"

  # VirtualBox settings
  config.vm.provider "virtualbox" do |vb|
    vb.name = "Windows-vpn"
    vb.memory = 1024
    vb.cpus = 1

    # Display the VirtualBox GUI when booting the machine
    vb.gui = true
  end

  # Provisioning

  ## Add custom Windows settings
  config.vm.provision "shell", path: "src/scripts/ps/WindowsSettings.ps1"
  ## Install Chocolatey
  config.vm.provision "shell", path: "src/scripts/ps/ChocolateyInstall.ps1"
  ## Install Chocolatey packages
  config.vm.provision "shell", path: "src/scripts/ps/ChocolateyInstallPackages.ps1"
  ## Set up proxy
  config.vm.provision "file", source: "./src/config/squid-proxy.conf", destination: "C:/Squid/etc/squid/squid.conf"
  ## Set up PAC
  config.vm.provision "shell", path: "src/scripts/ps/PacServer.ps1"
  ## Restart machine
  config.vm.provision :shell do |shell|
    shell.privileged = true
    shell.inline = 'echo rebooting'
    shell.reboot = true
  end
  
end
