<?xml version="1.0" encoding="utf-8" ?>
<unity xmlns="http://schemas.microsoft.com/practices/2010/unity">
    <typeAliases>
        <typeAlias alias="IResolver" type="ZXMAK2.Dependency.IResolver, ZXMAK2.Dependency" />
        <typeAlias alias="ResolverUnity" type="ZXMAK2.Dependency.ResolverUnity, ZXMAK2.Dependency" />

        <typeAlias alias="IUserMessage" type="ZXMAK2.Host.Interfaces.IUserMessage, ZXMAK2.Host" />
        <typeAlias alias="UserMessage" type="ZXMAK2.Host.Services.UserMessage, ZXMAK2.Host" />

        <typeAlias alias="IUserQuery" type="ZXMAK2.Host.Interfaces.IUserQuery, ZXMAK2.Host" />
        <typeAlias alias="UserQueryProxy" type="ZXMAK2.Host.Services.UserQueryProxy, ZXMAK2.Host" />
        <typeAlias alias="UserQuery_WinForms" type="ZXMAK2.Host.WinForms.Services.UserQuery, ZXMAK2.Host.WinForms" />

        <typeAlias alias="IUserHelp" type="ZXMAK2.Host.Interfaces.IUserHelp, ZXMAK2.Host" />
        <typeAlias alias="UserHelp_WinForms" type="ZXMAK2.Host.WinForms.Services.UserHelp, ZXMAK2.Host.WinForms" />

        <typeAlias alias="IOpenFileDialog" type="ZXMAK2.Host.Interfaces.IOpenFileDialog, ZXMAK2.Host" />
        <typeAlias alias="OpenFileDialog_WinForms" type="ZXMAK2.Host.WinForms.Services.OpenFileDialog, ZXMAK2.Host.WinForms" />

        <typeAlias alias="ISaveFileDialog" type="ZXMAK2.Host.Interfaces.ISaveFileDialog, ZXMAK2.Host" />
        <typeAlias alias="SaveFileDialog_WinForms" type="ZXMAK2.Host.WinForms.Services.SaveFileDialog, ZXMAK2.Host.WinForms" />

        <typeAlias alias="ILauncher" type="ZXMAK2.Host.Presentation.Interfaces.ILauncher, ZXMAK2.Host.Presentation" />
        <typeAlias alias="Launcher" type="ZXMAK2.Host.Presentation.Launcher, ZXMAK2.Host.Presentation" />

        <!-- main view -->
        <typeAlias alias="IMainViewModel" type="ZXMAK2.Host.Presentation.Interfaces.IMainViewModel, ZXMAK2.Host.Presentation" />
        <typeAlias alias="MainViewModel" type="ZXMAK2.Host.Presentation.MainViewModel, ZXMAK2.Host.Presentation" />

        <typeAlias alias="IMainView" type="ZXMAK2.Host.Presentation.Interfaces.IMainView, ZXMAK2.Host.Presentation" />
        <typeAlias alias="MainView_WinForms" type="ZXMAK2.Host.WinForms.Views.MainView, ZXMAK2.Host.WinForms" />
        <typeAlias alias="MainView_Xna" type="ZXMAK2.Host.Xna4.Views.MainView, ZXMAK2.Host.Xna4" />

        <typeAlias alias="IAboutView" type="ZXMAK2.Host.Presentation.Interfaces.IAboutView, ZXMAK2.Host.Presentation" />
        <typeAlias alias="AboutView_WinForms" type="ZXMAK2.Host.WinForms.Views.FormAbout, ZXMAK2.Host.WinForms" />

        <typeAlias alias="IKeyboardView" type="ZXMAK2.Host.Presentation.Interfaces.IKeyboardView, ZXMAK2.Host.Presentation" />
        <typeAlias alias="KeyboardView_WinForms" type="ZXMAK2.Host.WinForms.Views.FormKeyboardHelp, ZXMAK2.Host.WinForms" />

        <typeAlias alias="IMachineSettingsView" type="ZXMAK2.Host.Presentation.Interfaces.IMachineSettingsView, ZXMAK2.Host.Presentation" />
        <typeAlias alias="MachineSettingsView_WinForms" type="ZXMAK2.Host.WinForms.Views.FormMachineSettings, ZXMAK2.Host.WinForms" />

        <typeAlias alias="IMemoryMapView" type="ZXMAK2.Host.Presentation.Interfaces.IMemoryMapView, ZXMAK2.Host.Presentation" />
        <typeAlias alias="MemoryMapView_WinForms" type="ZXMAK2.Hardware.WinForms.FormMemoryMap, ZXMAK2.Hardware.WinForms" />

        <typeAlias alias="ITapeView" type="ZXMAK2.Host.Presentation.Interfaces.ITapeView, ZXMAK2.Host.Presentation" />
        <typeAlias alias="TapeView_WinForms" type="ZXMAK2.Hardware.WinForms.TapeForm, ZXMAK2.Hardware.WinForms" />

        <typeAlias alias="IFddDebugView" type="ZXMAK2.Host.Presentation.Interfaces.IFddDebugView, ZXMAK2.Host.Presentation" />
        <typeAlias alias="FddDebugView_WinForms" type="ZXMAK2.Hardware.WinForms.dbgWD1793, ZXMAK2.Hardware.WinForms" />

        <typeAlias alias="IDebuggerGeneralView" type="ZXMAK2.Host.Presentation.Interfaces.IDebuggerGeneralView, ZXMAK2.Host.Presentation" />
        <typeAlias alias="DebuggerGeneralView_WinForms" type="ZXMAK2.Hardware.WinForms.General.FormCpu, ZXMAK2.Hardware.WinForms" />

        <typeAlias alias="IDebuggerExView" type="ZXMAK2.Host.Presentation.Interfaces.IDebuggerExView, ZXMAK2.Host.Presentation" />
        <typeAlias alias="DebuggerExView_WinForms" type="ZXMAK2.Hardware.WinForms.General.Views.FormDebuggerEx, ZXMAK2.Hardware.WinForms" />

        <typeAlias alias="IDebuggerSprinterView" type="ZXMAK2.Host.Presentation.Interfaces.IDebuggerSprinterView, ZXMAK2.Host.Presentation" />
        <typeAlias alias="DebuggerSprinterView_WinForms" type="ZXMAK2.Hardware.WinForms.Sprinter.DebugForm, ZXMAK2.Hardware.WinForms" />

        <typeAlias alias="IDebuggerAdlersView" type="ZXMAK2.Host.Presentation.Interfaces.IDebuggerAdlersView, ZXMAK2.Host.Presentation" />
        <typeAlias alias="DebuggerAdlersView_WinForms" type="ZXMAK2.Hardware.Adlers.Views.FormCpu, ZXMAK2.Hardware.Adlers" />
        
        <!-- Host -->
        <typeAlias alias="IHostSound" type="ZXMAK2.Host.Interfaces.IHostSound, ZXMAK2.Host" />
        <typeAlias alias="HostSound_Mdx" type="ZXMAK2.Host.WinForms.Mdx.DirectSound, ZXMAK2.Host.WinForms" />
        <typeAlias alias="HostSound_Xna" type="ZXMAK2.Host.Xna4.Xna.XnaSound, ZXMAK2.Host.Xna4" />

        <typeAlias alias="IHostKeyboard" type="ZXMAK2.Host.Interfaces.IHostKeyboard, ZXMAK2.Host" />
        <typeAlias alias="HostKeyboard_Mdx" type="ZXMAK2.Host.WinForms.Mdx.DirectKeyboard, ZXMAK2.Host.WinForms" />
        <typeAlias alias="HostKeyboard_Xna" type="ZXMAK2.Host.Xna4.Xna.XnaKeyboard, ZXMAK2.Host.Xna4" />
        <typeAlias alias="HostKeyboard_WinForms" type="ZXMAK2.Host.WinForms.Controls.WinFormsKeyboard, ZXMAK2.Host.WinForms" />

        <typeAlias alias="IHostMouse" type="ZXMAK2.Host.Interfaces.IHostMouse, ZXMAK2.Host" />
        <typeAlias alias="HostMouse_Mdx" type="ZXMAK2.Host.WinForms.Mdx.DirectMouse, ZXMAK2.Host.WinForms" />
        <typeAlias alias="HostMouse_Xna" type="ZXMAK2.Host.Xna4.Xna.XnaMouse, ZXMAK2.Host.Xna4" />

        <typeAlias alias="IHostJoystick" type="ZXMAK2.Host.Interfaces.IHostJoystick, ZXMAK2.Host" />
        <typeAlias alias="HostJoystick_Mdx" type="ZXMAK2.Host.WinForms.Mdx.DirectJoystick, ZXMAK2.Host.WinForms" />

        <typeAlias alias="ISettingService" type="ZXMAK2.Host.Presentation.Interfaces.ISettingService, ZXMAK2.Host.Presentation" />
        <typeAlias alias="SettingService" type="ZXMAK2.Host.WinForms.Services.SettingService, ZXMAK2.Host.WinForms" />

        
        <!-- Circuits -->
        <typeAlias alias="IPsgChip" type="ZXMAK2.Hardware.Circuits.Sound.IPsgChip, ZXMAK2.Hardware.Circuits" />
        <typeAlias alias="PsgChip" type="ZXMAK2.Hardware.Circuits.Sound.PsgChip, ZXMAK2.Hardware.Circuits" />
    </typeAliases>

    <containers>
        <container>
            <!-- 
                Allowed values: winforms, xna 
            -->
            <instance name="viewType" value="winforms" type="System.String" />

            <register type="IResolver" mapTo="ResolverUnity" name="View">
                <constructor>
                    <param name="containerName">
                        <dependency name="viewType" />
                    </param>
                </constructor>
                <lifetime type="transient" />
            </register>

            <!-- Services -->
            <register type="ISettingService" mapTo="SettingService">
                <lifetime type="singleton" />
            </register>
            <register type="IUserMessage" mapTo="UserMessage">
                <lifetime type="transient" />
            </register>
            <register type="IUserQuery" mapTo="UserQueryProxy">
                <lifetime type="transient" />
            </register>


            <register type="ILauncher" mapTo="Launcher">
                <lifetime type="singleton" />
            </register>
            <register type="IMainViewModel" mapTo="MainViewModel">
                <lifetime type="transient" />
            </register>

            <!-- Circuits -->
            <register type="IPsgChip" mapTo="PsgChip">
                <lifetime type="transient" />
            </register>
        </container>

        <container name="winforms">
            <!-- Services -->
            <register type="IUserMessage" mapTo="UserMessage">
                <lifetime type="singleton" />
            </register>
            <register type="IUserQuery" mapTo="UserQuery_WinForms">
                <lifetime type="singleton" />
            </register>
            <register type="IUserHelp" mapTo="UserHelp_WinForms">
                <lifetime type="transient" />
            </register>
            <register type="IOpenFileDialog" mapTo="OpenFileDialog_WinForms">
                <lifetime type="transient" />
            </register>
            <register type="ISaveFileDialog" mapTo="SaveFileDialog_WinForms">
                <lifetime type="transient" />
            </register>

            <!-- Emulator UI -->
            <register type="IMainView" mapTo="MainView_WinForms">
                <lifetime type="transient" />
            </register>
            <register type="IAboutView" mapTo="AboutView_WinForms">
                <lifetime type="transient" />
            </register>
            <register type="IKeyboardView" mapTo="KeyboardView_WinForms">
                <lifetime type="transient" />
            </register>
            <register type="IMachineSettingsView" mapTo="MachineSettingsView_WinForms">
                <lifetime type="transient" />
            </register>
            
            <!-- Host WinForms -->
            <register type="IHostSound" mapTo="HostSound_Mdx">
                <constructor>
                    <param name="form" />
                    <param name="sampleRate" value="44100" />
                    <param name="bufferCount" value="4" />
                </constructor>
                <lifetime type="transient" />
            </register>
            <!--
            <register type="IHostKeyboard" mapTo="HostKeyboard_WinForms">
                <constructor>
                    <param name="form" />
                </constructor>
                <lifetime type="transient" />
            </register>
            -->
            <register type="IHostKeyboard" mapTo="HostKeyboard_Mdx">
                <constructor>
                    <param name="form" />
                </constructor>
                <lifetime type="transient" />
            </register>
            <register type="IHostMouse" mapTo="HostMouse_Mdx">
                <constructor>
                    <param name="form" />
                </constructor>
                <lifetime type="transient" />
            </register>
            <register type="IHostJoystick" mapTo="HostJoystick_Mdx">
                <constructor>
                    <param name="form" />
                </constructor>
                <lifetime type="transient" />
            </register>


            <!-- Device UI -->
            <register type="IMemoryMapView" mapTo="MemoryMapView_WinForms">
                <lifetime type="transient" />
            </register>
            <register type="ITapeView" mapTo="TapeView_WinForms">
                <lifetime type="transient" />
            </register>
            <register type="IFddDebugView" mapTo="FddDebugView_WinForms">
                <lifetime type="transient" />
            </register>
            <register type="IDebuggerGeneralView" mapTo="DebuggerGeneralView_WinForms">
                <lifetime type="transient" />
            </register>
            <register type="IDebuggerExView" mapTo="DebuggerExView_WinForms">
                <lifetime type="transient" />
            </register>
            <register type="IDebuggerSprinterView" mapTo="DebuggerSprinterView_WinForms">
                <lifetime type="transient" />
            </register>
            <register type="IDebuggerAdlersView" mapTo="DebuggerAdlersView_WinForms">
                <lifetime type="transient" />
            </register>
        </container>

        <container name="xna">
            <!-- Services -->
            <register type="IUserMessage" mapTo="UserMessage">
                <lifetime type="singleton" />
            </register>
            <register type="IUserQuery" mapTo="UserQuery_WinForms">
                <lifetime type="singleton" />
            </register>
            <register type="IOpenFileDialog" mapTo="OpenFileDialog_WinForms">
                <lifetime type="transient" />
            </register>
            <register type="ISaveFileDialog" mapTo="SaveFileDialog_WinForms">
                <lifetime type="transient" />
            </register>

            <!-- Emulator UI -->
            <register type="IMainView" mapTo="MainView_Xna">
                <lifetime type="transient" />
            </register>
            <register type="IAboutView" mapTo="AboutView_WinForms">
                <lifetime type="transient" />
            </register>
            <register type="IKeyboardView" mapTo="KeyboardView_WinForms">
                <lifetime type="transient" />
            </register>

            <!-- Host XNA -->
            <register type="IHostSound" mapTo="HostSound_Xna">
                <constructor>
                    <param name="sampleRate" value="44100" />
                    <param name="bufferCount" value="4" />
                </constructor>
                <lifetime type="transient" />
            </register>
            <register type="IHostKeyboard" mapTo="HostKeyboard_Xna">
                <lifetime type="transient" />
            </register>
            <register type="IHostMouse" mapTo="HostMouse_Xna">
                <lifetime type="transient" />
            </register>

            <!-- Device UI -->
            <register type="IMemoryMapView" mapTo="MemoryMapView_WinForms">
                <lifetime type="transient" />
            </register>
            <register type="ITapeView" mapTo="TapeView_WinForms">
                <lifetime type="transient" />
            </register>
            <register type="IFddDebugView" mapTo="FddDebugView_WinForms">
                <lifetime type="transient" />
            </register>
            <register type="IDebuggerGeneralView" mapTo="DebuggerGeneralView_WinForms">
                <lifetime type="transient" />
            </register>
            <register type="IDebuggerExView" mapTo="DebuggerExView_WinForms">
                <lifetime type="transient" />
            </register>
            <register type="IDebuggerSprinterView" mapTo="DebuggerSprinterView_WinForms">
                <lifetime type="transient" />
            </register>
            <register type="IDebuggerAdlersView" mapTo="DebuggerAdlersView_WinForms">
                <lifetime type="transient" />
            </register>
        </container>
    </containers>
</unity>
