# 将 web/promotion/视频发布 中文路径素材复制到 web/promotion/social（英文文件名）
# 用法：在项目根 powershell 执行 .\scripts\sync-video-assets-to-social.ps1
$ErrorActionPreference = "Stop"
$Root = [System.IO.Path]::GetFullPath((Join-Path $PSScriptRoot ".."))
$Src = Join-Path $Root "web\promotion\视频发布"
$Dst = Join-Path $Root "web\promotion\social"
New-Item -ItemType Directory -Force -Path $Dst | Out-Null

function Copy-First($toName, [string[]]$fromRels) {
    $to = Join-Path $Dst $toName
    foreach ($rel in $fromRels) {
        $from = Join-Path $Src $rel
        if (Test-Path -LiteralPath $from) {
            Copy-Item -LiteralPath $from -Destination $to -Force
            Write-Host "OK $toName <= $rel"
            return
        }
    }
    Write-Warning "SKIP (均未找到): -> $toName"
}

Copy-First "video-calc-demo-1-cover.jpg" @(
    "宇恒一号操作计算软件实例（一）\宣传片-封面.jpg",
    "宇恒一号操作计算软件实例（一）\宇恒一号操作计算软件实例（一）-封面.jpg"
)
Copy-First "video-calc-demo-1.mov" @(
    "宇恒一号操作计算软件实例（一）\宣传片.mov",
    "宇恒一号操作计算软件实例（一）\宇恒一号操作计算软件实例（一）.mov"
)
Copy-First "video-calc-demo-2-cover.jpg" @(
    "宇恒一号操作计算软件实例（二）\宇恒一号操作计算软件实例（二）-封面.jpg",
    "宇恒一号操作计算软件实例（二）\宣传片-封面.jpg"
)
Copy-First "video-calc-demo-2.mov" @(
    "宇恒一号操作计算软件实例（二）\宇恒一号操作计算软件实例（二）.mov",
    "宇恒一号操作计算软件实例（二）\宣传片.mov"
)
Copy-First "video-aiword-cover.jpg" @("宇恒一号AIWord简介\宇恒一号AIWord简介-封面.jpg")
Copy-First "video-aiword.mov" @("宇恒一号AIWord简介\宇恒一号AIWord简介.mov")
Copy-First "video-voice-office-cover.jpg" @("宇恒一号语音办公实例\宇恒一号语音办公实例-封面.jpg")
Copy-First "video-voice-office.mov" @("宇恒一号语音办公实例\宇恒一号语音办公实例.mov")
Copy-First "video-invoice-ai-cover.jpg" @("宇恒一号，AI 全自动办发票\宇恒一号，AI 全自动办发票-封面.jpg")
Copy-First "video-invoice-ai.mov" @("宇恒一号，AI 全自动办发票\宇恒一号，AI 全自动办发票.mov")

Write-Host "完成。Linux 服务器上建议在 social 目录执行: chmod -R a+rX ."
