param(
    [string]$TemplatePath = "",
    [string]$OutputPath = "",
    [string]$OperationsPath = ""
)

$ErrorActionPreference = "Stop"
$root = Split-Path -Parent $PSScriptRoot

function Resolve-ProjectPath {
    param([string]$PathValue)

    if (-not $PathValue) {
        return $PathValue
    }
    if ([System.IO.Path]::IsPathRooted($PathValue)) {
        return $PathValue
    }
    return [System.IO.Path]::GetFullPath((Join-Path $root $PathValue))
}

if (-not $TemplatePath) {
    $TemplatePath = "Report.pptx"
}

if (-not $OutputPath) {
    $OutputPath = $TemplatePath
}

$TemplatePath = Resolve-ProjectPath $TemplatePath
$OutputPath = Resolve-ProjectPath $OutputPath
$OperationsPath = Resolve-ProjectPath $OperationsPath

powershell -ExecutionPolicy Bypass -File "$root\scripts\render_template_com.ps1" -TemplatePath "$TemplatePath" -OutputPath "$OutputPath" -OperationsPath "$OperationsPath"
