parameters:
- name: imageName
  type: string
  default: 'windows-latest'
# Must be a mapping of id-suitable-name -> actual version number with dot
- name: pythonVersions
  type: object
- name: reactor
  type: string
  values:
  - select
  - iocp

jobs:
- ${{ each pyver in parameters.pythonVersions }}:
  - job: ${{ format('windows_{0}_{1}reactor', pyver.key, parameters.reactor) }}
    displayName: ${{ format('Windows Py{0} {1}reactor', pyver.value, parameters.reactor) }}
    pool:
      vmImage: ${{ parameters.imageName }}
    variables:
      # Set PYTHONUTF8 environment variable to force UTF-8 mode on Python 3.7+
      # on Windows.
      #
      # Set PYTHONIOENCODING to force UTF-8 encoding on Python 3.6.
      # This allows people with non-ASCII characters in their names to file pull requests
      # and not trigger CI errors.
      PYTHONUTF8: 1
      PYTHONIOENCODING: "utf-8:surrogateescape"
    steps:
    - template: 'run_test_steps.yml'
      parameters:
        platform: windows
        pythonVersion: ${{ pyver.value }}
        windowsReactor: ${{ parameters.reactor }}
