[CmdletBinding()]
param
(
    [Parameter(Mandatory=$false)]
    [string]$LogDir
)

Import-Module WebAdministration
Import-Module "$PSScriptRoot\ExecuteSqltoAXDB.psm1" -Force -DisableNameChecking
Import-Module "$PSScriptRoot\CommonRollBackUtilities.psm1" -Force -DisableNameChecking
Import-Module "$PSScriptRoot\AosEnvironmentUtilities.psm1" -Force -DisableNameChecking
Import-Module "$PSScriptRoot\SyncEngineUtilities.psm1" -Force -DisableNameChecking

if ((Get-Service | where Name -eq DynamicsAxBatch) -eq $null)
{
    throw 'Cannot upgrade data; DynamicsAX batch is not installed on this machine.'
}

if(!$LogDir)
{
    $LogDir = $PSScriptRoot
}

$metadataDirectory = Get-CommonBinDir

function AdjustSqlSequences
{
        #Adjust sql sequences for all the tables
        Write-Output 'Start adjusting sql sequences for all the tables' 

        $adjustsqlseq = Get-Content "$PSScriptRoot\AdjustSQLSequences.sql" -Raw

        Invoke-SQL -sqlCommand:$adjustsqlseq
        Write-Output 'Finished adjusting sql sequences for all the tables'
}

$sqlPwd = Get-DataAccessSqlPwd
$sqlUser = Get-DataAccessSqlUsr
$sqlServer = Get-DataAccessDbServer
$sqlDB = Get-DataAccessDatabase

$sqlParams = @{
   'Database' = $sqlDB
   'UserName' = $sqlUser
   'Password' = $sqlPwd
   'ServerInstance' = $sqlServer
   'Query' = "SELECT Top 1 Description FROM SYSSETUPLOG WHERE Name = 'ReleaseUpdateDBGetFromVersion' 
                          and Version = '7.0' order by Description desc"
}
$Version = Invoke-SqlCmd @sqlParams

switch($version.Description)
{
 "170" 
    { 
        AdjustSqlSequences
    }
 "180" 
    { 
        AdjustSqlSequences
    }
 default 
    { 
        Write-Output "Skipping SQL Sequence Adjustment"
    }
}

Write-Output 'Constructing the connection string for the SQL DB using the web.config'

$connectionString = Get-SyncEngineConnectionString $sqlServer $sqlUser $sqlPwd $sqlDB

$useLegacyIds = $false
Invoke-DbSyncPreReq $LogDir $metadataDirectory $connectionstring $useLegacyIds

#start aos to verify the system table and webconfig have been upgraded correctly
$aosSiteName = Get-AosWebSiteName
$aosAppPoolName = Get-AosAppPoolName
Start-WebSite $aosSiteName
Start-WebAppPool $aosAppPoolName
if((Get-WebAppPoolState $aosAppPoolName).Value -ne 'Started') 
{
    throw 'Failed to start the website $aosSiteName'
}

Stop-WebSite $aosSiteName
if((Get-WebAppPoolState $aosAppPoolName).Value -ne 'Stopped') 
{
    Stop-WebAppPool $aosAppPoolName
}


write-Output 'Finished pre requisites for running the data upgrade'
#Need a way to check if we can start AOS successfully

# SIG # Begin signature block
# MIIr/wYJKoZIhvcNAQcCoIIr8DCCK+wCAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCAHQ/QTNHk7L45x
# 1NPKUkyNMWAprDCiacKLZ7q4GExiWKCCEW4wggh+MIIHZqADAgECAhM2AAAB33OB
# lxa+Mv0NAAIAAAHfMA0GCSqGSIb3DQEBCwUAMEExEzARBgoJkiaJk/IsZAEZFgNH
# QkwxEzARBgoJkiaJk/IsZAEZFgNBTUUxFTATBgNVBAMTDEFNRSBDUyBDQSAwMTAe
# Fw0yNDAxMjAwMTMzNDRaFw0yNTAxMTkwMTMzNDRaMCQxIjAgBgNVBAMTGU1pY3Jv
# c29mdCBBenVyZSBDb2RlIFNpZ24wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
# AoIBAQDVucAmkbIWpspYysyydQyyRh2L8q5igYFcy2vDk8xGvVMRBhxwbOsJIEd0
# wY8N7WU/xgkYMnSsM4vmc2B49DGdrAjSJqbsx0zf+DLFjrBITUecdRhlq0VKGX8U
# bVOkg0aIfFNLRs4DSrCZYh26zyB8qkL/jUmB7DhcBEhhgOlXRQ4LHnUv7qf+iXqD
# uwFz9tUTAh8JGsgLRBK0oSsRfUB+FJF2KyUxzmeFXJKiEynsWz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