param(
    [Parameter(Mandatory = $true)]
    [ValidateSet('pc', 'windows', 'android', 'both')]
    [string]$Platform,
    [switch]$DryRun,
    [switch]$NoPush,
    [string]$Remote = 'origin'
)

$ErrorActionPreference = 'Stop'
$projectRoot = Split-Path -Parent $PSScriptRoot
$arguments = @(
    (Join-Path $PSScriptRoot 'version.dart'),
    'tag',
    $Platform,
    '--project-root',
    $projectRoot,
    '--remote',
    $Remote
)
if ($DryRun) { $arguments += '--dry-run' }
if ($NoPush) { $arguments += '--no-push' }

& dart @arguments
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
