[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','DisableNullFieldValueSupportedForFnOTables'

$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
# MIIr8wYJKoZIhvcNAQcCoIIr5DCCK+ACAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCCCyKsqDOcVjdnq
# zPWakNAq/z3jUprRqO2Ofwvebj3Y6qCCEX0wggiNMIIHdaADAgECAhM2AAACAR26
# 8SCNUOBoAAIAAAIBMA0GCSqGSIb3DQEBCwUAMEExEzARBgoJkiaJk/IsZAEZFgNH
# QkwxEzARBgoJkiaJk/IsZAEZFgNBTUUxFTATBgNVBAMTDEFNRSBDUyBDQSAwMTAe
# Fw0yNDExMDgxMjQ0MTRaFw0yNTExMDgxMjQ0MTRaMCQxIjAgBgNVBAMTGU1pY3Jv
# c29mdCBBenVyZSBDb2RlIFNpZ24wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
# AoIBAQC5EbpMULKgL3ArJn1rQqUye5Mzq2Eqlu0Ov9Vv2X+MvePQtXj4Cr7dLpJO
# VjPrUvirL6Jn8gYuDRxhVZbj3s81AfC8wq0sC/928aXCleSUDwX4scwK7vbpur2+
# TJm0WZ0E1gk8VY1bAjG9G3sQ2A+bpcMaBu7soLLH0ofyYzf6cl9irH3iHAw1ZucU
# mpROzEZcn3cmcxNwS0P2MX1nPE3qJEPoa3odBFZd5RXfDo7ro62MeNVjR/4bPjic
# IcnT/G0wWEXwKwTOkxFHibmmbhgfWAxDh75LZMYeLSeGkXhhBgQ/7Y11swZdaK3l
# okxcrV7d6jus7is+p6o8nep1OGGrAgMBAAGjggWZMI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