<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
     xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
	<Fragment>
    <PropertyRef Id="STARTSERVICEONINSTALL"/>
    
    <ComponentGroup Id="DataCenterComponents">
      <ComponentRef Id="URLReservation"/>
      <ComponentRef Id="DataCenterFirewallConfig"/>
      <ComponentGroupRef Id="DataCenterFileGroup"/>
    </ComponentGroup>
    
    <ComponentGroup Id="DataCenterFileGroup" Directory="INSTALLFOLDER">
      <Component Id="MicrosoftOwin" Guid="{45563976-8620-4447-9DFE-216DEF263D5A}">
        <File Id="Microsoft.Owin.dll"
              Source="$(var.WindowsDataCenter.TargetDir)\Microsoft.Owin.dll"
              KeyPath="yes"
              Checksum="yes"/>
      </Component>
      <Component Id="MicrosoftOwinFileSystems" Guid="{45B6E4C5-FDD3-4B59-84A3-C58C8626BF61}">
        <File Id="Microsoft.Owin.FileSystems.dll"
              Source="$(var.WindowsDataCenter.TargetDir)Microsoft.Owin.FileSystems.dll"
              KeyPath="yes"
              Checksum="yes"/>
      </Component>
      <Component Id="MicrosoftOwinHostHttpListener" Guid="{5C9206E7-8C1B-4713-BE3B-8E754172ABE5}">
        <File Id="Microsoft.Owin.Host.HttpListener.dll"
              Source="$(var.WindowsDataCenter.TargetDir)Microsoft.Owin.Host.HttpListener.dll"
              KeyPath="yes"
              Checksum="yes"/>
      </Component>
      <Component Id="MicrosoftOwinHosting" Guid="{1A250453-173F-4FC6-BD72-5E3B3A67569B}">
        <File Id="Microsoft.Owin.Hosting.dll"
              Source="$(var.WindowsDataCenter.TargetDir)Microsoft.Owin.Hosting.dll"
              KeyPath="yes"
              Checksum="yes"/>
      </Component>
      <Component Id="MicrosoftOwinStaticFiles" Guid="{8F6B1D17-8D7C-4320-8BF6-26D6B3C5115E}">
        <File Id="Microsoft.Owin.StaticFiles.dll"
              Source="$(var.WindowsDataCenter.TargetDir)Microsoft.Owin.StaticFiles.dll"
              KeyPath="yes"
              Checksum="yes"/>
      </Component>
      <Component Id="MicrosoftWebInsfrastructure" Guid="{BCBEE2B7-3E75-4744-8B95-5928E69A8807}">
        <File Id="Microsoft.Web.Infrastructure.dll"
              Source="$(var.WindowsDataCenter.TargetDir)Microsoft.Web.Infrastructure.dll"
              KeyPath="yes"
              Checksum="yes"/>
      </Component>
      <Component Id="NewtonsoftJson" Guid="{972634F3-DEC1-41D9-B48E-3836D6C1FD1D}">
        <File Id="Newtonsoft.Json.dll"
              Source="$(var.WindowsDataCenter.TargetDir)Newtonsoft.Json.dll"
              KeyPath="yes"
              Checksum="yes"/>
      </Component>
      <Component Id="Ninject" Guid="{31D0E89E-F1F7-4B7D-84E9-229D5C7042B5}">
        <File Id="Ninject.dll"
              Source="$(var.WindowsDataCenter.TargetDir)Ninject.dll"
              KeyPath="yes"
              Checksum="yes"/>
      </Component>
      <Component Id="NinjectExtensionsContextPreservationDll" Guid="{580EAE73-1DBF-4F79-9153-8D5055C3A31F}">
        <File Id="Ninject.Extensions.ContextPreservation.dll"
              Source="$(var.WindowsDataCenter.TargetDir)Ninject.Extensions.ContextPreservation.dll"
              KeyPath="yes"
              Checksum="yes"/>
      </Component>
      <Component Id="NinjectExtensionsNamedScopeDll" Guid="{76602BE7-8A83-4BC2-AAA3-2A06F82353F0}">
        <File Id="Ninject.Extensions.NamedScope.dll"
              Source="$(var.WindowsDataCenter.TargetDir)Ninject.Extensions.NamedScope.dll"
              KeyPath="yes"
              Checksum="yes"/>
      </Component>
      <Component Id="NinjectExtensionsXmlDll" Guid="{3809511F-9C51-4C05-AFE5-F59160EDCB71}">
        <File Id="Ninject.Extensions.Xml.dll"
              Source="$(var.WindowsDataCenter.TargetDir)Ninject.Extensions.Xml.dll"
              KeyPath="yes"
              Checksum="yes"/>
      </Component>
      <Component Id="NinjectWebCommon" Guid="{A4D175A1-D68C-4E20-9E52-A0A8052B9E1D}">
        <File Id="Ninject.Web.Common.dll"
              Source="$(var.WindowsDataCenter.TargetDir)Ninject.Web.Common.dll"
              KeyPath="yes"
              Checksum="yes"/>
      </Component>
      <Component Id="NinjectWebCommonOwinHost" Guid="{156FF6D0-00DA-46BC-80C9-816F2CA8975E}">
        <File Id="Ninject.Web.Common.OwinHost.dll"
              Source="$(var.WindowsDataCenter.TargetDir)Ninject.Web.Common.OwinHost.dll"
              KeyPath="yes"
              Checksum="yes"/>
      </Component>
      <Component Id="NinjectWebWebApi" Guid="{20D06854-C822-4780-8EDC-D1601A835626}">
        <File Id="Ninject.Web.WebApi.dll"
              Source="$(var.WindowsDataCenter.TargetDir)Ninject.Web.WebApi.dll"
              KeyPath="yes"
              Checksum="yes"/>
      </Component>
      <Component Id="NinjectWebWebApiOwinHost" Guid="{024E48A9-CFAA-4AE1-9B55-399AC27E93B0}">
        <File Id="Ninject.Web.WebApi.OwinHost.dll"
              Source="$(var.WindowsDataCenter.TargetDir)Ninject.Web.WebApi.OwinHost.dll"
              KeyPath="yes"
              Checksum="yes"/>
      </Component>
      <Component Id="NinjectConfig" Guid="{85F6271F-7251-4E88-B44D-8EBDA4CBD29D}">
        <File Id="NinjectConfig.xml"
              Source="$(var.WindowsDataCenter.TargetDir)NinjectConfig.xml"
              KeyPath="yes"
              Checksum="yes"/>
      </Component>
      <Component Id="Owin" Guid="{B4A90231-65AB-40F1-BEEC-EE02B9DBD4EC}">
        <File Id="Owin.dll"
              Source="$(var.WindowsDataCenter.TargetDir)Owin.dll"
              KeyPath="yes"
              Checksum="yes"/>
      </Component>
      <Component Id="RazorEngine" Guid="{494124DC-1BD1-42C2-A249-53757289AAA4}">
        <File Id="RazorEngine.dll"
              Source="$(var.WindowsDataCenter.TargetDir)RazorEngine.dll"
              KeyPath="yes"
              Checksum="yes"/>
      </Component>
      <Component Id="SystemNetHttpFormatting" Guid="{53AB40B1-7A74-4B6B-9F0E-B1A74EE27467}">
        <File Id="System.Net.Http.Formatting.dll"
              Source="$(var.WindowsDataCenter.TargetDir)System.Net.Http.Formatting.dll"
              KeyPath="yes"
              Checksum="yes"/>
      </Component>
      <Component Id="SystemWebHttp" Guid="{B94609B3-B65E-4FB5-B226-B831D8597A9B}">
        <File Id="System.Web.Http.dll"
              Source="$(var.WindowsDataCenter.TargetDir)System.Web.Http.dll"
              KeyPath="yes"
              Checksum="yes"/>
      </Component>
      <Component Id="SystemWebHttpOwin" Guid="{99FF5381-765A-4B03-8668-1083ED498CAB}">
        <File Id="System.Web.Http.Owin.dll"
              Source="$(var.WindowsDataCenter.TargetDir)System.Web.Http.Owin.dll"
              KeyPath="yes"
              Checksum="yes"/>
      </Component>
      <Component Id="SystemWebHttpWebHost" Guid="{29E7462F-32C3-46E2-8295-FBF561D37E40}">
        <File Id="System.Web.Http.WebHost.dll"
              Source="$(var.WindowsDataCenter.TargetDir)System.Web.Http.WebHost.dll"
              KeyPath="yes"
              Checksum="yes"/>
      </Component>
      <Component Id="WebActivatorEx" Guid="{7AD6A619-5946-4E94-AAD3-1AEEB88272C0}">
        <File Id="WebActivatorEx.dll"
              Source="$(var.WindowsDataCenter.TargetDir)WebActivatorEx.dll"
              KeyPath="yes"
              Checksum="yes"/>
      </Component>
      <Component Id="WindowsDataCenter" Guid="{CD36814E-8C1B-4AC1-BDC7-D1595D2A4728}">
        <File Id="WindowsDataCenter.exe"
              Source="$(var.WindowsDataCenter.TargetDir)WindowsDataCenter.exe"
              KeyPath="yes"/>
        <ServiceInstall Id="DataCenterService"
                        Start="auto"
                        ErrorControl="normal"
                        Type="ownProcess"
                        Vital="yes"
                        Name="FlexitimeDataCenterService"
                        DisplayName="FlexitimeDataCenterService"
                        Description="Flexitime API Database and Website"
                        Account="LocalSystem">
          <util:PermissionEx  User="Everyone" 
                              ServicePauseContinue="yes" 
                              ServiceQueryStatus="yes"
                              ServiceStart="yes" 
                              ServiceStop="yes" 
                              ServiceUserDefinedControl="yes"  />
          <ServiceConfig Id="FlexiTimeServiceConfig"
                         OnInstall="yes"
                         DelayedAutoStart="0" />
          <util:ServiceConfig FirstFailureActionType="restart"
                              SecondFailureActionType="restart"
                              ThirdFailureActionType="restart"
                              ResetPeriodInDays="1"
                              RestartServiceDelayInSeconds="10" />
        </ServiceInstall>
      </Component>
      <Component Id="StartDataCenterServiceOnInsall" 
                 Guid="{884828DC-A47E-4CEF-AEEB-E46FFDFFBED3}"
                 KeyPath="yes">
        <ServiceControl Id="FlexitimeDataCenterStarter"
                        Start="install"
                        Stop="uninstall"
                        Remove="uninstall"
                        Name="FlexitimeDataCenterService"
                        Wait="yes"/>
        <Condition><![CDATA[STARTSERVICEONINSTALL <> "false"]]></Condition>
      </Component>
      <Component Id="WindowsDataCenterExeConfig" Guid="{CBFA53EB-0663-4A79-9990-451FC1105A12}">
        <File Id="WindowsDataCenter.exe.config"
              Source="$(var.WindowsDataCenter.TargetDir)WindowsDataCenter.exe.config"
              KeyPath="yes"
              Checksum="yes"/>
      </Component>
      <Component Id="WindowsDataCenterXml" Guid="{35A62230-0052-4EBE-9775-DE0266BADB4E}">
        <File Id="WindowsDataCenter.xml"
              Source="$(var.WindowsDataCenter.TargetDir)WindowsDataCenter.XML"
              KeyPath="yes"
              Checksum="yes"/>
      </Component>
    </ComponentGroup>
  </Fragment>
</Wix>
