@startuml
'https://plantuml.com/sequence-diagram
!theme plain

autonumber

actor User
boundary InterfaceUI
participant "System\nMachineService" as System
participant "System\nTHUMDER-App-Service" as THUMDER
participant Server
participant "Provider" as Firebase

activate User
group#Gold User login

end
User -> InterfaceUI: Open Config
activate InterfaceUI
User <- InterfaceUI: Show Config
User -> InterfaceUI: Set count floating point unit
InterfaceUI -> System: Set count floating point unit
activate System
alt #LightGreen Ok
  InterfaceUI <- System: Set delay floating point unit
else #Pink Error
  InterfaceUI <- System: Set count floating point unit to default
end
deactivate System

User -> InterfaceUI: Set delay floating point unit
InterfaceUI -> System: Set delay floating point unit
activate System
alt #LightGreen Ok
  InterfaceUI <- System: Set delay floating point unit
else #Pink Error
  InterfaceUI <- System: Set delay floating point unit to default
end
deactivate System

User -> InterfaceUI: Set memory size
InterfaceUI -> System: Set memory size
activate System
alt #LightGreen Ok
  InterfaceUI <- System: Set memory size
else #Pink Error
  InterfaceUI <- System: Set memory size to default
end
deactivate System

User -> InterfaceUI: Set auto save
InterfaceUI -> THUMDER: Set auto save
activate THUMDER
alt #LightGreen Ok
  InterfaceUI <- THUMDER: Set auto save
else #Pink Error
  InterfaceUI <- THUMDER: Set auto save to default
end
deactivate THUMDER

User -> InterfaceUI: Set time simulation step
InterfaceUI -> THUMDER: Set time simulation step
activate THUMDER
alt #LightGreen Ok
  InterfaceUI <- THUMDER: Set time simulation step
else #Pink Error
  InterfaceUI <- THUMDER: Set time simulation step to default
end
deactivate THUMDER

User -> InterfaceUI: Set config multiview
InterfaceUI -> THUMDER: Set config multiview
activate THUMDER
alt #LightGreen Ok
  InterfaceUI <- THUMDER: Set config multiview
else #Pink Error
  InterfaceUI <- THUMDER: Set config multiview to default
end
deactivate THUMDER

User -> InterfaceUI: Select save or reset
group #SkyBlue Select save
  InterfaceUI -> System: Save
  activate System
  System -> Server: Save machine with configuration
  alt #LightGreen Ok
    System <-- Server: Save machine with configuration ok
    System -> System: Reset machine
    InterfaceUI <- System: Save ok
    User <- InterfaceUI: Notification save
  else #Pink Error
    InterfaceUI <- System: Save error
    User x<- InterfaceUI: Notification error
  end
end

group #SkyBlue Select reset
  InterfaceUI -> System: Reset
  System -> Server: Reset machine with configuration
  alt #LightGreen Ok
    System <-- Server: Reset machine with configuration ok
    System -> System: Reset machine
    InterfaceUI <- System: Reset ok
    User <- InterfaceUI: Notification reset
  else #Pink Error
    System <-- Server: Reset machine with configuration error
    InterfaceUI <- System: Reset error
    User x<- InterfaceUI: Notification error
  end
  deactivate System
end
deactivate InterfaceUI
deactivate User

@enduml
