@startuml
class Observable {
    trigger(string event)
    on(string event, function fun)
}

class FlippR

class Game

Game --* Cabinet : isAchievementStrategy ?
Game --* State : observes >
Game "1" --* "*" TargetStrategy

class TargetStrategy
Target "1" o-- "1" TargetStrategy : observe <
State o-- TargetStrategy : changes <

class State {
    int ballsLeft
    int currentBall
}

State --* BallState

class BallState {
    int score
    int globalMultiplier
    addScore(int points)
}

class UpperPlayFieldTimer {
    int timeLeft = 0
    start()
    stop()
}

BallState --* UpperPlayFieldTimer
class Cabinet {
}

Observable <|-- Cabinet
Cabinet "1" --* "*" Target

Observable <|-- Target
abstract class Target {
    int points
    string name
    hit()
}

class AchievementTarget {

}

Target *-- AchievementTarget
Target <|-- AchievementTarget

class BankTarget {
    bool isHit
    hit()
    reset()
}
Target <|-- BankTarget

class Bank

Target <|-- Bank
Bank "1" --* "1..*" BankTarget : observe >

@enduml