@startuml
title PCS TIA Sync - TIA To Repository 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 -> TIA : edit/debug PLC blocks
Engineer -> Gui : Capture TIA Snapshot
Gui -> Cli : pcs sync snapshot tia
Cli -> Openness : export block sources
Openness -> TIA : attach/open project
TIA --> Openness : current PLC sources
Openness --> Cli : generated snapshot files
Cli -> Repo : write local TIA snapshot

Engineer -> Gui : select TIA --> Repository rows
Gui -> Cli : pcs sync accept tia ...
Cli -> Repo : copy selected snapshot files into tia/exports
Cli --> Gui : accepted source files
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
