# Architecture

## Purpose
- Crashing/Maintaining one Service should not affect all others.
- Configurator should be editable by authors.
- VirtualShowroom should work without web access.
- Data should be linked within its context
  - The context should probably be the project.
- The Showrooms can generate the available Units, Rooms and Objects, but this is not always the case.

## Diagram

``` plantuml
@startuml
!define STYLE_RG
!includeurl https://raw.githubusercontent.com/raumgleiter/PlantUML-Style/master/PlantUML_Style.puml
!include <tupadr3/common>
!include <tupadr3/font-awesome/rocket>
!include <tupadr3/font-awesome-5/user>
!include <tupadr3/font-awesome-5/archive>
!include <tupadr3/font-awesome-5/cube>
!include <tupadr3/font-awesome-5/cubes>
''!include <tupadr3/font-awesome-5/city>
!include <tupadr3/font-awesome-5/map>
!include <tupadr3/font-awesome-5/tint>
!include <tupadr3/font-awesome-5/shower>
!include <tupadr3/font-awesome-5/bath>
!include <tupadr3/font-awesome-5/toggle_on>
!include <tupadr3/font-awesome-5/circle>
!include <tupadr3/font-awesome-5/sliders_h>

' All Skinparams: https://plantuml-documentation.readthedocs.io/en/latest/formatting/all-skin-params.html
' skinparam defaultTextAlignment center

' allowmixing
' skinparam ClassAttributeIconSize 0.1
' skinparam CircledCharacterRadius 0
' skinparam CircledCharacterFontSize 0

'-----------------------------------------------------------------------------

'left to right direction

'******************************************************************************

class Project {
  <$archive>
  ---
  Collective Information
  about project data.
  ---
  projectNumber
  gateAccessCode
  projectName
}

class ConfiguratorDB <<(S, grey)>>
Project --* ConfiguratorDB

'-----------------------------------------------------------------------------

class Variant <<(S, grey)>>
Option --* Variant

'-----------------------------------------------------------------------------

'******************************************************************************

'-----------------------------------------------------------------------------

class Property {
  <$cubes>
  ---
  Unique physical location
}
class Unit {
  <$cube>
  ---
  Unique physical real estate unit
}
class Configurator <<Red>> {
  <$sliders_h>
  (UnitType)
  ---
  Similar by floorplan
}
class Scene <<Orange>> {
  <$tint>
  (RoomType, ConfiguratorPoint)
  ---
  Similar by room content
  --
  Name
  Image
  UnrealMap
}

class Option {
  <$bath>
  ---
}

class Variant {
  <$toggle_on>
  ---
}

Property --o Unit
Unit --o Configurator
Configurator --o Scene

'Configurator --> Variant : ???

Project --o Property
Scene --o Option

class PriceAdjustment <<(S, grey)>> {
  price
}
Variant -up-o PriceAdjustment
PriceAdjustment -up-* UnitType

'-----------------------------------------------------------------------------
'-----------------------------------------------------------------------------

'******************************************************************************

'-----------------------------------------------------------------------------


'-----------------------------------------------------------------------------
'-----------------------------------------------------------------------------

'******************************************************************************

@enduml
```

## Usage

``` plantuml
@startuml
!define STYLE_RG
!includeurl https://raw.githubusercontent.com/raumgleiter/PlantUML-Style/master/PlantUML_Style.puml
!include <tupadr3/common>
!include <tupadr3/font-awesome/rocket>
!include <tupadr3/font-awesome-5/user>

' All Skinparams: https://plantuml-documentation.readthedocs.io/en/latest/formatting/all-skin-params.html
' skinparam defaultTextAlignment center

' allowmixing
' skinparam ClassAttributeIconSize 0.1
' skinparam CircledCharacterRadius 0
' skinparam CircledCharacterFontSize 0

'-----------------------------------------------------------------------------

'left to right direction

'******************************************************************************

class Project {
  Collective Information
  about project data.
}
class Configurator {
  Information on how to access
  configurator data.
}
class VirtualShowroom {
  Data of VirtualShowrooms
}

Project --o Configurator
Project --o VirtualShowroom

'-----------------------------------------------------------------------------
' VirtualShowroom

package pTools {

package pVirtualShowroom {
  class UEMap <<Red>>
  class UEViewpoint <<Orange>>
  VirtualShowroom --o UEViewpoint
  UEMap --o UEViewpoint
}


'-----------------------------------------------------------------------------
' Generic Configurator

package pGenericConfShowroom {
  class UEGenMap <<Red>>
  class UEGenViewpoint <<Orange>>
  VirtualShowroom --o UEGenViewpoint
  UEGenMap --o UEGenViewpoint
}


'-----------------------------------------------------------------------------
' Configurator

package pConfigurator {
  class ConfScene <<Orange>>
  Configurator o--o ConfScene
}

}

'-----------------------------------------------------------------------------

UEViewpoint --o Option
UEGenViewpoint --o Option
ConfScene o--o Option
class Variant <<(S, grey)>>
Option --* Variant

'-----------------------------------------------------------------------------

'******************************************************************************

'-----------------------------------------------------------------------------

class Property {
  Unique physical location
}
class Unit {
  Unique physical real estate unit
}
class UnitType <<Red>> {
  Similar by floorplan
}
class RoomType <<Orange>> {
  Similar by room content
}

Property --o Unit
Unit --o UnitType
UnitType --o RoomType

UnitType --> Variant

Project --o Property
RoomType --o Option

'-----------------------------------------------------------------------------
'-----------------------------------------------------------------------------

'******************************************************************************

'-----------------------------------------------------------------------------


'-----------------------------------------------------------------------------
'-----------------------------------------------------------------------------

'******************************************************************************

@enduml
```

## Data Generation

``` plantuml
@startuml
!define STYLE_RG
!includeurl https://raw.githubusercontent.com/raumgleiter/PlantUML-Style/master/PlantUML_Style.puml
!include <tupadr3/common>
!include <tupadr3/font-awesome/rocket>
!include <tupadr3/font-awesome-5/user>

' All Skinparams: https://plantuml-documentation.readthedocs.io/en/latest/formatting/all-skin-params.html
' skinparam defaultTextAlignment center

' allowmixing
' skinparam ClassAttributeIconSize 0.1
' skinparam CircledCharacterRadius 0
' skinparam CircledCharacterFontSize 0

'-----------------------------------------------------------------------------

'left to right direction

'******************************************************************************

class Client

Client --> Unit
Client --> UnitType
Client --> RoomType

Unit -up-> EMonitor

UnitType --> UE.PlayerStart
Unit --> UE.UnitFinder
RoomType --> UE.ViewPoint

RoomType --> Gen.ViewPoint


'-----------------------------------------------------------------------------
'-----------------------------------------------------------------------------

'******************************************************************************

'-----------------------------------------------------------------------------


'-----------------------------------------------------------------------------
'-----------------------------------------------------------------------------

'******************************************************************************

@enduml
```

##### Emonitor
 - Emonitor does only have a list of Units and their Properties.
 - It requires lots of links to be set.
 - Also not every project uses Emonitor.
 - Usually, we cannot modify the Emonitor data.

Therefore, we could let the client fill out data in our own CMS and generate a link list, they can use to fill in the data in Emonitor.

``` plantuml
@startuml
!define STYLE_RG
!includeurl https://raw.githubusercontent.com/raumgleiter/PlantUML-Style/master/PlantUML_Style.puml
!include <tupadr3/common>
!include <tupadr3/font-awesome/rocket>
!include <tupadr3/font-awesome-5/user>

' All Skinparams: https://plantuml-documentation.readthedocs.io/en/latest/formatting/all-skin-params.html
' skinparam defaultTextAlignment center

' allowmixing
' skinparam ClassAttributeIconSize 0.1
' skinparam CircledCharacterRadius 0
' skinparam CircledCharacterFontSize 0

'-----------------------------------------------------------------------------

'left to right direction

'******************************************************************************

class Client

Client --> Unit
Client --> UnitType
Client --> RoomType

EMonitor --> Unit
EMonitor --> UnitType : LayoutPlan+Cost=ID?
Unit -up-> EMonitor : LinkTable?


'-----------------------------------------------------------------------------
'-----------------------------------------------------------------------------

'******************************************************************************

'-----------------------------------------------------------------------------


'-----------------------------------------------------------------------------
'-----------------------------------------------------------------------------

'******************************************************************************

@enduml
```

## Deployment

``` plantuml
@startuml
!define STYLE_RG
!includeurl https://raw.githubusercontent.com/raumgleiter/PlantUML-Style/master/PlantUML_Style.puml
!include <tupadr3/common>
!include <tupadr3/font-awesome/rocket>
!include <tupadr3/font-awesome-5/user>

' All Skinparams: https://plantuml-documentation.readthedocs.io/en/latest/formatting/all-skin-params.html
' skinparam defaultTextAlignment center

' allowmixing
' skinparam ClassAttributeIconSize 0.1
' skinparam CircledCharacterRadius 0
' skinparam CircledCharacterFontSize 0

'-----------------------------------------------------------------------------

'left to right direction

'******************************************************************************

cloud Internet {
  database RGProjectAPI
  'database ConfiguratorAPI
  'database ShowroomDatabase
}

node Showroom {
  actor ShowroomAgent
  actor ShowroomClient
  entity VRController
  entity XboxController

  cloud Network {
    entity Mobile

    node Computer {
      frame Unreal
      frame MobileUI
      database RGProjectAPI_localCopy
    }
  }

  ShowroomAgent -- Mobile
  ShowroomAgent -- XboxController
  ShowroomClient -- VRController
  XboxController -- Unreal
  VRController -- Unreal
  Mobile -- MobileUI
  MobileUI -- Unreal

  MobileUI .. RGProjectAPI_localCopy
  MobileUI .. RGProjectAPI
}


'-----------------------------------------------------------------------------
'-----------------------------------------------------------------------------

'******************************************************************************

'-----------------------------------------------------------------------------


'-----------------------------------------------------------------------------
'-----------------------------------------------------------------------------

'******************************************************************************

@enduml
```
