// QmsPlugin.mm
#import "QmsPlugin.h"
#import "DashboardViewController.h"
#import "DrawerViewController.h"
#import "DrawerController.h"
#import "NetworkManager.h"

@implementation QmsPluginUI

+ (UIViewController *)makeViewController {
    // 0. Start network monitoring immediately
    [NetworkManager sharedManager];
  
    // 1. Create drawer
    DrawerViewController *drawer = [[DrawerViewController alloc] init];
    drawer.profileName = @"placeholder";
    drawer.profileEmail = @"placeholder";

    // 2. Client props
    NSString *clientID = @"clientID_loading";
    NSString *clientCode = @"clientCode_loading";
    NSString *userToken = @"userToken_loading";

    // 3. Root container
    DrawerController *drawerController =
        [[DrawerController alloc] initWithDrawerViewController:drawer
                                                      clientID:clientID
                                                    clientCode:clientCode
                                                     userToken:userToken];

    // 4. Back-reference
    if ([drawerController.mainViewController isKindOfClass:[DashboardViewController class]]) {
        ((DashboardViewController *)drawerController.mainViewController).drawerController =
            drawerController;
    }

    return drawerController;
}


@end
