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

    [parameter(Mandatory=$false)]
    [boolean] $useServiceFabric=$false,

    [Parameter(Mandatory = $false)]
    [string]$ActivityId,

    [Parameter(Mandatory=$false)]
	[hashtable]$AxDRConnectionString,

    [Parameter(Mandatory=$false)]
	[string[]]$EnabledServicingFeatures,

    [Parameter(Mandatory = $false)]
    [string]$RunbookId,
    
    [Parameter(Mandatory=$false)]
    [hashtable]$Credentials
)

# Check whether PITR required after running full sync.
function IsPITRRequiredDuringRollback([string]$ActivityId)
{
  if(!$ActivityId)
  {
      return $true
  }

  $axDBPwd = Get-DataAccessSqlPwd
  $axDBUser = Get-DataAccessSqlUsr
  $axDBDatabaseName = Get-DataAccessDatabase
  $axDBServer = Get-DataAccessDbServer

    $target_sqlParams = @{
		'Database' = $axDBDatabaseName
		'UserName' = $axDBUser
		'Password' = $axDBPwd
		'ServerInstance' = $axDBServer
		'EncryptConnection' = !(IsLocalServer($axDBServer))
		'QueryTimeout' = 0
	    }

    $target_sqlParams.Query = "Select ISNULL(MAX(CAST(PITRRequiredForRollback as INT)), 1) as PITRRequiredForRollback, ISNULL(MAX(CAST(DBSyncRequiredForRollback as INT)), 0) as DBSyncRequiredForRollback from DBSyncExecStats where SyncStep = 'FullAll' and RelatedActivityId = '$ActivityId'"

    try
    {
        $result = Invoke-SqlCmd @target_sqlParams
        if ($result -ne $null)
        {
            $successMessage = "[$(Get-Date)]:Get PITR required status succeeded. PITRRequiredForRollback: $($result.PITRRequiredForRollback), DBSyncRequiredForRollback: $($result.DBSyncRequiredForRollback), activity id: $ActivityId."
            Write-Host $successMessage
            EventWrite-RunbookScriptTrace -Message $successMessage -Component "servicing" -RunbookId $RunbookId| Out-Null

            return ($result.PITRRequiredForRollback -or $result.DBSyncRequiredForRollback)
        }
    }
    catch
    {
        $warningMessage = "[$(Get-Date)]:Get PITR required status failed, activity id: $ActivityId, Exception: [$($_.Exception)]"
        Write-Host $warningMessage
        EventWrite-RunbookScriptTrace -Message $warningMessage -Component "servicing" -RunbookId $RunbookId| Out-Null
    }

    return $true
}

Import-Module "$PSScriptRoot\AosEnvironmentUtilities.psm1" -Force -DisableNameChecking
Import-Module "$PSScriptRoot\CommonRollbackUtilities.psm1" -ArgumentList $useServiceFabric -DisableNameChecking
Import-Module "$PSScriptRoot\ExecuteSqltoAXDB.psm1" -Force -DisableNameChecking

$ErrorActionPreference = "stop"

$metadatadir = $(Get-AOSPackageDirectory)

$deltaSyncFolder = Join-Path "$(split-Path -parent $metadatadir)"  "DeltaSync"
$deltaSyncOutputSecurityMD = Join-Path $deltaSyncFolder  "DeltaSyncSecurityMD.xml"
$deltaSyncOutputTableMD = Join-Path $deltaSyncFolder  "DeltaSyncTableMD.xml"
$deltaSyncOutputEdtMD = Join-Path $deltaSyncFolder  "DeltaSyncEdtMD.xml"
$comparerDllPath = "$(split-Path -parent $PSScriptRoot)" | Split-Path -Parent

[System.Reflection.Assembly]::LoadFile("$comparerDllPath\Microsoft.Dynamics.AXCreateDeployablePackageBase.dll") >$null

$SecurityMdFileIdentical = [Microsoft.Dynamics.AXCreateDeployablePackageBase.DirectoryProcessing]::CustomDirectoryCompareIsIdentical($deltaSyncFolder,$metadatadir, "*AXSecurity*.md", $deltaSyncOutputSecurityMD  )
$TableMdFileIdentical = [Microsoft.Dynamics.AXCreateDeployablePackageBase.DirectoryProcessing]::CustomDirectoryCompareIsIdentical($deltaSyncFolder,$metadatadir, "*AXTable*.md", $deltaSyncOutputTableMD  )
$EdtMdFileIdentical = [Microsoft.Dynamics.AXCreateDeployablePackageBase.DirectoryProcessing]::CustomDirectoryCompareIsIdentical($deltaSyncFolder,$metadatadir, "*AXEdt*.md", $deltaSyncOutputEdtMD  )

$noSchemaImpactFlag = $(Join-Path $deltaSyncFolder  "noSchemaImpactMDChangeFound.xml")

if(($SecurityMdFileIdentical -eq $true) -and
($TableMdFileIdentical -eq $true) -and
($EdtMdFileIdentical -eq $true))
{
    Copy-Item $deltaSyncOutputTableMD -Destination $noSchemaImpactFlag
    Write-Output "No Schema Change detected, performing delta DbSync operation."
}
elseif(Test-Path $noSchemaImpactFlag)
{
    Remove-Item $noSchemaImpactFlag
}

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

# Inject & Turned On flighings before DB Sync PreCheck
$axDBPwd = Get-DataAccessSqlPwd
$axDBUser = Get-DataAccessSqlUsr
$axDBDatabaseName = Get-DataAccessDatabase
$axDBServer = Get-DataAccessDbServer
$flightings='DMFEnableSqlRowVersionChangeTrackingIndexing','DMFEnableCreateRecIdIndexForDataSynchronization','DMFDisableRecurringIntegrationImportRetryV2'

$target_sqlParams_insertFlightings = @{
    'Database' = $axDBDatabaseName
    'UserName' = $axDBUser
    'Password' = $axDBPwd
    'ServerInstance' = $axDBServer
    'EncryptConnection' = !(IsLocalServer($axDBServer))
    'QueryTimeout' = 0
}

foreach($Name in $flightings)
{
    $target_sqlParams_insertFlightings.Query = "SELECT FLIGHTNAME FROM SYSFLIGHTING WHERE FLIGHTNAME='$Name'"
    $res=Invoke-SqlCmd @target_sqlParams_insertFlightings
    if($res -eq $null)
    {
        $target_sqlParams_insertFlightings.Query = "INSERT INTO SYSFLIGHTING (FLIGHTNAME, ENABLED) VALUES('$Name', 1)"
        $result = Invoke-SqlCmd @target_sqlParams_insertFlightings            
    }
    else
    {
         Write-Host "$Name Exists in SYSFLIGHTING Table"
    }
}

# Run SQL Script to disable SysDeletedObjectSysRowVersion2 config based on status of SysDeletedObjectSysRowVersion while upgrading to PU63+
$TargetPUVersion = (Get-ProductPlatformBuildVersion)
if($TargetPUVersion -gt 7120)
{ 
    $configchecksql = Get-Content "$PSScriptRoot\Disable_Sysrowversion2Config_While_upgrade.sql" -Raw        
    Invoke-SQL -sqlCommand:$configchecksql
}

$deploySetupPs1 = "$PSScriptRoot\TriggerDeploymentSetupEngine.ps1"

# Run DB Sync PreCheck
$precheckScriptPath = "$PSScriptRoot\DBSyncPrecheck.ps1"
$precheckScriptPath = Resolve-Path -Path $precheckScriptPath
& $precheckScriptPath -LogDir $LogDir -ActivityId $ActivityId -RunbookId $RunbookId -EnabledServicingFeatures $EnabledServicingFeatures -Credentials $Credentials

# Run service sync (Full sync)
$deploymentSetupParameter = "-setupmode servicesync -syncmode fullall"
if($ActivityId)
{
    $deploymentSetupParameter += " -activityid $ActivityId"
}

[hashtable]$returnResult = @{}
$currentDateTime = [DateTime]::UtcNow.ToString("yyyyMMddHHmmss")
$logfile = Join-Path $LogDir "dbsync_$currentDateTime.log"
$errorfile = Join-Path $LogDir "dbsync.error_$currentDateTime.log"

try
{
    # Reset PITR required flag to true before invoking DB Sync
    Write-IsPITRRequiredDuringRollback -PitrRequired 'true'

    invoke-Expression "$deploySetupPs1 -deploymentSetupParameter: `"$deploymentSetupParameter`" -logfile:`"$logfile`" -errorfile:`"$errorfile`""
    Write-Output "DbSync completed."

    #Check whether PITR required on full sync success.    
    $pitrRequired = IsPITRRequiredDuringRollback -ActivityId $ActivityId

    # TODO: Uncomment below line after addressing Bug 533892
    # Write-IsPITRRequiredDuringRollback -PitrRequired $pitrRequired
}
catch
{
  #Check whether PITR required on full sync failure
  $pitrRequired = IsPITRRequiredDuringRollback -ActivityId $ActivityId  

  # TODO: Uncomment below line after addressing Bug 533892
  # Write-IsPITRRequiredDuringRollback -PitrRequired $pitrRequired

  throw $($_.Exception)
}

#creating AX ping service user
$webroot = Get-AosWebSitePhysicalPath
[boolean] $isPU3OrLater = Get-IsPlatformUpdate3OrLater -webroot:$webroot
if ($isPU3OrLater -eq $false)
{
    $deploymentSetupParameter = "-setupmode runstaticxppmethod -classname AxPingHelper -methodname createServiceUser"
    $logfile = Join-Path $LogDir "createAXPingServiceUser.log"
    $errorfile = Join-Path $LogDir "createAXPingServiceUser.error.log"

    try
    {
        invoke-Expression "$deploySetupPs1 -deploymentSetupParameter: `"$deploymentSetupParameter`" -logfile:`"$logfile`" -errorfile:`"$errorfile`""
    }
    catch
    {
        $createAXPingServiceUserError = Get-Content $errorfile
        if ($createAXPingServiceUserError -ne $null) 
        {
            if($createAXPingServiceUserError -like "*Couldn't find id for class AxPingHelper*")
            {
                Write-Output "AXPulse Module not found, skipping create AX Ping service user operation"
                return
            }
            throw $createAXPingServiceUserError
        }
    }
}

# SIG # Begin signature block
# MIIr5AYJKoZIhvcNAQcCoIIr1TCCK9ECAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCAGcbquQ0s2DIVe
# 5BDJBsHgYJITMRwbzew/D2rG+TLg46CCEW4wggh+MIIHZqADAgECAhM2AAAB33OB
# lxa+Mv0NAAIAAAHfMA0GCSqGSIb3DQEBCwUAMEExEzARBgoJkiaJk/IsZAEZFgNH
# QkwxEzARBgoJkiaJk/IsZAEZFgNBTUUxFTATBgNVBAMTDEFNRSBDUyBDQSAwMTAe
# Fw0yNDAxMjAwMTMzNDRaFw0yNTAxMTkwMTMzNDRaMCQxIjAgBgNVBAMTGU1pY3Jv
# c29mdCBBenVyZSBDb2RlIFNpZ24wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
# AoIBAQDVucAmkbIWpspYysyydQyyRh2L8q5igYFcy2vDk8xGvVMRBhxwbOsJIEd0
# wY8N7WU/xgkYMnSsM4vmc2B49DGdrAjSJqbsx0zf+DLFjrBITUecdRhlq0VKGX8U
# bVOkg0aIfFNLRs4DSrCZYh26zyB8qkL/jUmB7DhcBEhhgOlXRQ4LHnUv7qf+iXqD
# uwFz9tUTAh8JGsgLRBK0oSsRfUB+FJF2KyUxzmeFXJKiEynsWz4kqoM91ag1Yw0U
# 8d0e+RgAKi3Ft1cXA+3qKM6I1H11e/NdIjh7oThvrBtfEngwlwbTF3KZOHdhLBFZ
# 18U4v8VeTlb4r94346CY2+SKnQa7AgMBAAGjggWKMIIFhjApBgkrBgEEAYI3FQ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