@startuml
title PCS TIA Sync - Repository To TIA Overview

actor Engineer
participant "PCS GUI" as Gui
participant "PCS CLI" as Cli
participant "TIA Openness" as Openness
participant "TIA Portal" as TIA
database "Repository" as Repo
participant "Git" as Git

Engineer -> Gui : select Repository --> TIA rows
Gui -> Cli : pcs deploy blocks=...
Cli -> Repo : read selected tia/exports sources
Cli -> Openness : generate selected sources
Openness -> TIA : attach/open project
Openness -> TIA : import/generate blocks
TIA --> Openness : compile/save result
Openness --> Cli : deployment result
Cli --> Gui : success / warnings / errors

Gui -> Engineer : suggest verification snapshot
Engineer -> Gui : Capture now
Gui -> Cli : pcs sync snapshot tia
Cli -> Openness : export current TIA sources
Openness -> TIA : read PLC blocks
Cli -> Repo : update local TIA snapshot
Gui -> Cli : pcs sync status --json
Cli --> Gui : Repo and TIA alignment state

note over Repo, Git
Commit/push happens after alignment is verified.
end note

@enduml
