using Test.ViewModels;
using Test.Views;
using UICommon.CommonContainer;

namespace Test;

[Module(ModuleName = nameof(TestModule), OnDemand = false)]
public class TestModule : IModule
{
    public TestModule(ICommonContainer commonContainer)
    {
        commonContainer.AddModule(nameof(TestModule));
        commonContainer.AddNavigation(new(0, "Test", nameof(TestPage), true, null!));
    }

    public void OnInitialized(IContainerProvider containerProvider)
    {
        IRegionManager regionManager = containerProvider.Resolve<IRegionManager>();

        ICommonContainer commonContainer = containerProvider.Resolve<ICommonContainer>();
        regionManager.RegisterViewWithRegion(commonContainer.MainReginName, typeof(TestPage));
    }

    public void RegisterTypes(IContainerRegistry containerRegistry)
    {
        containerRegistry.RegisterForNavigation<TestPage, TestPageViewModel>(nameof(TestPage));
    }
}
