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

@implementation QmsPluginUI

+ (UIViewController *)makeViewController {

    // 1. Create main dashboard screen (props will be set via DrawerController)
    DrawerViewController *drawer = [[DrawerViewController alloc] init];
    drawer.profileName = @"placeholder";
    drawer.profileEmail = @"placeholder";

    // 2. Set client props (replace with actual values from your globals or RN)
    NSString *clientID = @"clientID_loading";
    NSString *clientCode = @"clientCode_loading";
    NSString *userToken = @"userToken_loading";

    // 3. Create DrawerController with drawer + props
    DrawerController *drawerController =
        [[DrawerController alloc] initWithDrawerViewController:drawer
                                                      clientID:clientID
                                                    clientCode:clientCode
                                                     userToken:userToken];

    // 4. Allow dashboard to call openDrawer() via drawerController.mainViewController
    if ([drawerController.mainViewController isKindOfClass:[DashboardViewController class]]) {
        ((DashboardViewController *)drawerController.mainViewController).drawerController = drawerController;
    }

    NSLog(@"drawerController.mainViewController = %@", drawerController.mainViewController);

    return drawerController;
}

@end
