@startuml

namespace MellowPlayer.Application {

class ISettingsProvider

class UserScripts {
    + UserScripts(QString serviceName);
    + count() : int
    + toList() : QList<IUserScript*>
    + add(IUserScript* userScript)
    + remove(QString name)
}
UserScripts "*" -> IUserScript
UserScripts -left-> ISettingsProvider
UserScripts --> IUserScriptFactory

interface IUserScript {
    path(): QString
    name(): QString
    setName(QString)
    code() : QString
    import(QString path)
    load(QString path)
}

interface IUserScriptFactory {
    create(): IUserScript*
}

class UserScriptBase {
    - name_: QString
    # path_: QString
    # code_: QString
    + path(): QString
    + name(): QString
    + setName(QString):
    + code(): QString
}

IUserScript <|-- UserScriptBase

}

namespace MellowPlayer.Infrastructure {

class UserScript {
    + import(QString)
    + load(QString)
}

class UserScriptFactory {
    + create(): IUserScript*
}

MellowPlayer.Application.UserScriptBase <|-- UserScript
MellowPlayer.Application.IUserScriptFactory <|-- UserScriptFactory
UserScriptFactory .> UserScript: <<create>>

}

namespace MellowPlayer.Presentation {
    class UserScriptsViewModel {
        + model(): ListModel
        + addScript(name, path)
        + removeScript(QString name)
    }
    class UserScriptViewModel {
        - model_: IUserScript&
        + code(): QString
        + name(): QString
        + setName(QString)
        + path(): QString
    }

    class StreamingServiceViewModel {
        - _userScripts: UserScriptViewModel*
        + userScripts(): UserScriptViewModel*
    }

    StreamingServiceViewModel -> UserScriptsViewModel
    UserScriptsViewModel --> MellowPlayer.Application.UserScripts
    UserScriptViewModel --> MellowPlayer.Application.IUserScript
    UserScriptsViewModel "*" -> UserScriptViewModel
}

@enduml
