using DataContracts;
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Text.RegularExpressions;

namespace Ato.EN.IntegrationServices.CodeGenerationCTR
{
    public partial class CTR2026Validator
    {
        #region VR.ATO.CTR.430216

        /*  VR.ATO.CTR.430216
        Check taxable/net income/loss for the Company, in Reconciliation to taxable income or loss

        Legacy Rule Format:
        IF  ([CTR120] <> 
        (([CTR57]+[CTR58]+[CTR59]+[CTR60]+[CTR61]+[CTR63]+
        [CTR64]+[CTR65]+[CTR66]+
        [CTR67]+[CTR68]+[CTR70]+[CTR71])
        -
        ([CTR72]+[CTR73]+[CTR364]+[CTR75]+[CTR76]+[CTR77]+
        [CTR78]+[CTR79]+[CTR80]+[CTR81]+[CTR365]+[CTR366]+
        [CTR84]+[CTR85]+[CTR86]+[CTR87]+[CTR88])  
        + 
        ([CTR91]+[CTR92]+[CTR93]+[CTR94]+[CTR255]+[CTR95]+
        [CTR96]+[CTR97])
        - 
        ([CTR98]+[CTR99]+[CTR100]+[CTR101]+ 
        [CTR102]+[CTR103]+[CTR104]+[CTR111]+[CTR112]+    
        [CTR114]+[CTR115]+[CTR256]+[CTR116]+[CTR117]+   
        [CTR118]) 
        ) +/- 30)
            RETURN VALIDATION MESSAGE
        ENDIF

        Technical Business Rule Format:
        (^CTR120 <>   ((^CTR57+^CTR58+^CTR59+^CTR60+^CTR61+^CTR63+     ^CTR64+^CTR65+^CTR66+     ^CTR67+^CTR68+^CTR70+^CTR71)     -     (^CTR72+^CTR73+^CTR364+^CTR75+^CTR76+^CTR77+      ^CTR78+^CTR79+^CTR80+^CTR81+^CTR365+^CTR366+      ^CTR84+^CTR85+^CTR86+^CTR87+^CTR88)      +      (^CTR91+^CTR92+^CTR93+^CTR94+^CTR255+^CTR95+      ^CTR96+^CTR97)    -       (^CTR98+^CTR99+^CTR100+^CTR101+        ^CTR102+^CTR103+^CTR104+^CTR111+^CTR112+           ^CTR114+^CTR115+^CTR256+^CTR116+^CTR117+          ^CTR118)    ) +/- 30)

        Data Elements:
    
        ^CTR120 = RP:Income.Taxable.Amount
    
        ^CTR57 = RP:Remuneration.PaymentToForeignResidentGross.Amount
    
        ^CTR58 = RP:Remuneration.ABNNotQuotedPaymentGross.Amount
    
        ^CTR59 = RP:Income.SaleOfGoodsAndServices.Other.Amount
    
        ^CTR60 = RP:Income.PartnershipDistributionGross.Amount
    
        ^CTR61 = RP:TrustDistributionIncome:Income.TrustDistributionGross.Amount
    
        ^CTR63 = RP:Income.ForestryManagedInvestmentScheme.Amount
    
        ^CTR64 = RP:Income.Interest.Gross.Amount
    
        ^CTR65 = RP:Income.RentLeasingHiringGross.Amount
    
        ^CTR66 = RP:Income.DividendsTotal.Amount
    
        ^CTR67 = RP:Remuneration.FringeBenefits.EmployeeContribution.Amount
    
        ^CTR68 = RP:GovernmentFunding.GovernmentIndustryPaymentsAssessable.Amount
    
        ^CTR70 = RP:Income.AssetRevaluationsUnrealisedGains.Amount
    
        ^CTR71 = RP:Income.OtherGross.Amount
    
        ^CTR72 = RP:Expense.ForeignResidentWithholding.Amount
    
        ^CTR73 = RP:Expense.Operating.CostOfSales.Amount
    
        ^CTR364 = RP:Remuneration.WagesAndSalaries.PaymentsContractorAndConsultant.Amount
    
        ^CTR75 = RP:SuperannuationContribution.EmployerContributions.Amount
    
        ^CTR76 = RP:Expense.Operating.BadDebts.Amount
    
        ^CTR77 = RP.JAUS:Expense.Operating.Lease.Amount
    
        ^CTR78 = RP.JFOREIGN:Expense.Operating.Lease.Amount
    
        ^CTR79 = RP:Expense.Operating.Rent.Amount
    
        ^CTR80 = RP.JAUS:Expense.Operating.Interest.Amount
    
        ^CTR81 = RP.JFOREIGN:Expense.Operating.Interest.Amount
    
        ^CTR365 = RP.JAUS:Expense.Royalties.Amount
    
        ^CTR366 = RP.JFOREIGN:Expense.Royalties.Amount
    
        ^CTR84 = RP:Expense.DepreciationAndAmortisation.Amount
    
        ^CTR85 = RP:Expense.Operating.MotorVehicle.Amount
    
        ^CTR86 = RP:Expense.Operating.RepairsAndMaintenance.Amount
    
        ^CTR87 = RP:Expense.AssetRevaluationsUnrealisedLosses.Amount
    
        ^CTR88 = RP:Expense.Other.Amount
    
        ^CTR91 = RP:Income.CapitalGainsNet.Amount
    
        ^CTR92 = RP:Expense.NonDeductibleExemptIncome.Amount
    
        ^CTR93 = RP:IncomeTax.FrankingCredits.ReceivedFromAustralianCompanies.Amount
    
        ^CTR94 = RP:IncomeTax.FrankingCredits.ReceivedFromNewZealandCompanies.Amount
    
        ^CTR255 = RP.TOFA:Income.OtherTotal.Amount
    
        ^CTR95 = RP:Income.AssessableOther.Amount
    
        ^CTR96 = RP:Expense.NonDeductible.Amount
    
        ^CTR97 = RP:TaxConcession.ResearchAndDevelopment.WriteBackOfAccountingExpenditure.Amount
    
        ^CTR98 = RP:Expense.FlowOnDividendDeduction.Amount
    
        ^CTR99 = RP:Expense.DepreciationAllowableDeduction.Amount
    
        ^CTR100 = RP:Expense.ForestryManagedInvestmentSchemeDeduction.Amount
    
        ^CTR101 = RP:Expense.CapitalExpenditureImmediateDeduction.Amount
    
        ^CTR102 = RP:Expense.ProjectPoolAllowableDeduction.Amount
    
        ^CTR103 = RP:Expense.CapitalWorksDeduction.Amount
    
        ^CTR104 = RP:Expense.CapitalExpenditureSpecifiedAllowableDeduction.Amount
    
        ^CTR111 = RP.Y0:Expense.LandcareOperationsAcceleratedDepreciation.Amount
    
        ^CTR112 = RP:Expense.EnvironmentalProtectionDeduction.Amount
    
        ^CTR114 = RP:Income.Exempt.Amount
    
        ^CTR115 = RP:Income.NotincludedInAssessableOther.Amount
    
        ^CTR256 = RP.TOFA:Expense.DeductibleOther.Amount
    
        ^CTR116 = RP:Expense.DeductibleOther.Amount
    
        ^CTR117 = RP:IncomeTax.Deduction.TaxLossesDeducted.Amount
    
        ^CTR118 = RP:IncomeTax.TaxLossesTransferredIn.Amount
        */
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public virtual void VRATOCTR430216(List<ProcessMessageDocument> response, CTR2026 report)
        {
            ProcessMessageDocument processMessage;
            bool assertion;

            assertion = OutsideRange(report.CTR120.GetValueOrDefault(), report.CTR57.GetValueOrDefault() + report.CTR58.GetValueOrDefault() + report.CTR59.GetValueOrDefault() + report.CTR60.GetValueOrDefault() + report.CTR61.GetValueOrDefault() + report.CTR63.GetValueOrDefault() + report.CTR64.GetValueOrDefault() + report.CTR65.GetValueOrDefault() + report.CTR66.GetValueOrDefault() + report.CTR67.GetValueOrDefault() + report.CTR68.GetValueOrDefault() + report.CTR70.GetValueOrDefault() + report.CTR71.GetValueOrDefault() - (report.CTR72.GetValueOrDefault() + report.CTR73.GetValueOrDefault() + report.CTR364.GetValueOrDefault() + report.CTR75.GetValueOrDefault() + report.CTR76.GetValueOrDefault() + report.CTR77.GetValueOrDefault() + report.CTR78.GetValueOrDefault() + report.CTR79.GetValueOrDefault() + report.CTR80.GetValueOrDefault() + report.CTR81.GetValueOrDefault() + report.CTR365.GetValueOrDefault() + report.CTR366.GetValueOrDefault() + report.CTR84.GetValueOrDefault() + report.CTR85.GetValueOrDefault() + report.CTR86.GetValueOrDefault() + report.CTR87.GetValueOrDefault() + report.CTR88.GetValueOrDefault()) + (report.CTR91.GetValueOrDefault() + report.CTR92.GetValueOrDefault() + report.CTR93.GetValueOrDefault() + report.CTR94.GetValueOrDefault() + report.CTR255.GetValueOrDefault() + report.CTR95.GetValueOrDefault() + report.CTR96.GetValueOrDefault() + report.CTR97.GetValueOrDefault()) - (report.CTR98.GetValueOrDefault() + report.CTR99.GetValueOrDefault() + report.CTR100.GetValueOrDefault() + report.CTR101.GetValueOrDefault() + report.CTR102.GetValueOrDefault() + report.CTR103.GetValueOrDefault() + report.CTR104.GetValueOrDefault() + report.CTR111.GetValueOrDefault() + report.CTR112.GetValueOrDefault() + report.CTR114.GetValueOrDefault() + report.CTR115.GetValueOrDefault() + report.CTR256.GetValueOrDefault() + report.CTR116.GetValueOrDefault() + report.CTR117.GetValueOrDefault() + report.CTR118.GetValueOrDefault()), 30);
            if (assertion)
            {
                processMessage = new ProcessMessageDocument()
                {
                    Code = "CMN.ATO.CTR.430216",
                    Severity = ProcessMessageSeverity.Error,
                    Description = @"Check taxable/net income/loss for the Company, in Reconciliation to taxable income or loss",
                    LongDescription = @"The Taxable/net income/loss must be equal to the sum of all income items less the sum of all expense items plus extraordinary revenue/expenses, total capital gains, non deductible exempt income expenditure, other assessable income and non deductible expenses items less other expense items",
                    Location = "/xbrli:xbrl/tns:Income.Taxable.Amount",
                    Parameters = new ProcessMessageParameters() { new ProcessMessageParameter() { Name = "RuleIdentifier", Value = "VR.ATO.CTR.430216" } },
                };

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR120", Value = GetValueOrEmpty(report.CTR120) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR57", Value = GetValueOrEmpty(report.CTR57) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR58", Value = GetValueOrEmpty(report.CTR58) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR59", Value = GetValueOrEmpty(report.CTR59) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR60", Value = GetValueOrEmpty(report.CTR60) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR61", Value = GetValueOrEmpty(report.CTR61) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR63", Value = GetValueOrEmpty(report.CTR63) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR64", Value = GetValueOrEmpty(report.CTR64) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR65", Value = GetValueOrEmpty(report.CTR65) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR66", Value = GetValueOrEmpty(report.CTR66) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR67", Value = GetValueOrEmpty(report.CTR67) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR68", Value = GetValueOrEmpty(report.CTR68) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR70", Value = GetValueOrEmpty(report.CTR70) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR71", Value = GetValueOrEmpty(report.CTR71) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR72", Value = GetValueOrEmpty(report.CTR72) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR73", Value = GetValueOrEmpty(report.CTR73) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR364", Value = GetValueOrEmpty(report.CTR364) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR75", Value = GetValueOrEmpty(report.CTR75) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR76", Value = GetValueOrEmpty(report.CTR76) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR77", Value = GetValueOrEmpty(report.CTR77) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR78", Value = GetValueOrEmpty(report.CTR78) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR79", Value = GetValueOrEmpty(report.CTR79) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR80", Value = GetValueOrEmpty(report.CTR80) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR81", Value = GetValueOrEmpty(report.CTR81) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR365", Value = GetValueOrEmpty(report.CTR365) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR366", Value = GetValueOrEmpty(report.CTR366) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR84", Value = GetValueOrEmpty(report.CTR84) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR85", Value = GetValueOrEmpty(report.CTR85) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR86", Value = GetValueOrEmpty(report.CTR86) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR87", Value = GetValueOrEmpty(report.CTR87) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR88", Value = GetValueOrEmpty(report.CTR88) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR91", Value = GetValueOrEmpty(report.CTR91) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR92", Value = GetValueOrEmpty(report.CTR92) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR93", Value = GetValueOrEmpty(report.CTR93) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR94", Value = GetValueOrEmpty(report.CTR94) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR255", Value = GetValueOrEmpty(report.CTR255) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR95", Value = GetValueOrEmpty(report.CTR95) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR96", Value = GetValueOrEmpty(report.CTR96) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR97", Value = GetValueOrEmpty(report.CTR97) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR98", Value = GetValueOrEmpty(report.CTR98) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR99", Value = GetValueOrEmpty(report.CTR99) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR100", Value = GetValueOrEmpty(report.CTR100) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR101", Value = GetValueOrEmpty(report.CTR101) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR102", Value = GetValueOrEmpty(report.CTR102) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR103", Value = GetValueOrEmpty(report.CTR103) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR104", Value = GetValueOrEmpty(report.CTR104) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR111", Value = GetValueOrEmpty(report.CTR111) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR112", Value = GetValueOrEmpty(report.CTR112) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR114", Value = GetValueOrEmpty(report.CTR114) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR115", Value = GetValueOrEmpty(report.CTR115) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR256", Value = GetValueOrEmpty(report.CTR256) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR116", Value = GetValueOrEmpty(report.CTR116) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR117", Value = GetValueOrEmpty(report.CTR117) });

                processMessage.Parameters.Add(new ProcessMessageParameter
                { Name = "CTR118", Value = GetValueOrEmpty(report.CTR118) });

                response.Add(processMessage);
            }
        }

        #endregion // VR.ATO.CTR.430216

        #region VR.ATO.CTR.500406
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public virtual void VRATOCTR500406()
        {
            ProcessMessageDocument processMessage;
            bool assertion;
            /*  VR.ATO.CTR.500406
            A text character must be one of the following: A to Z a to z 0 to 9 ! @ $ % & * ( ) - = [ ] ; : ' " , . ? / or a space character
    
            Legacy Rule Format:
            IF ([CTR15] <> NULLORBLANK) AND (ANY CHARACTER OF [CTR15] <> SET(a-z,A-Z,0-9,"!","@","$","%","&","*","(",")","-","=","[","]",";",":","'",""",",",".","?","/"," "))
               RETURN VALIDATION MESSAGE
            ENDIF

            Technical Business Rule Format:
            (^CTR15 <> BLANK) AND (NotCharacterInSet(^CTR15, 'a-z,A-Z,0-9,"!","@","$","%","&","*","(",")","-","=","[","]",";",":","'",""",",",".","?","/"," "'))
    
            Data Elements:
    
            ^CTR15 = RP:AddressDetails:AddressDetails.Line1.Text WHERE [AddressDetails.Usage.Code='POS'].[AddressDetails.Currency.Code='C']
            */
            assertion = (!string.IsNullOrWhiteSpace(report.CTR15) && !IsMatch(report.CTR15, @"^[a-z,A-Z,0-9,""!@\$%&\*\(\)\-=\[\];:'"",\.\?/ ""]*$", RegexOptions.IgnoreCase)) || IsMatch(report.CTR15, Environment.NewLine) || IsMatch(report.CTR15, "\n") || IsMatch(report.CTR15, "\r");
            if (assertion)
            {
                processMessage = new ProcessMessageDocument()
                {
                    Code = "CMN.ATO.CTR.500406",
                    Severity = ProcessMessageSeverity.Error,
                    Description = @"Business Entity Current postal address - Line 1 contains invalid text",
                    LongDescription = @"A text character must be one of the following: A to Z a to z 0 to 9 ! @ $ % & * ( ) - = [ ] ; : ' "" , . ? / or a space character",
                    Location = "/xbrli:xbrl/tns:AddressDetails" + OccurrenceIndex(report.AddressDetailsCollection_POS_C_RPOccurrenceIndex) + "/tns:AddressDetails.Line1.Text",
                    Parameters = new ProcessMessageParameters()
                    {
                        new ProcessMessageParameter()
                        {
                            Name = "RuleIdentifier",
                            Value = "VR.ATO.CTR.500406"
                        }
                    },
                };
                processMessage.Parameters.Add(new ProcessMessageParameter { Name = "CTR15", Value = report.CTR15 });
                response.Add(processMessage);
            }
        }

        #endregion
        #region VR.ATO.CTR.500407
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public virtual void VRATOCTR500407()
        {
            ProcessMessageDocument processMessage;
            bool assertion;
            /*  VR.ATO.CTR.500407
            A text character must be one of the following: A to Z a to z 0 to 9 ! @ $ % & * ( ) - = [ ] ; : ' " , . ? / or a space character
    
            Legacy Rule Format:
            IF ([CTR16] <> NULLORBLANK) AND (ANY CHARACTER OF [CTR16] <> SET(a-z,A-Z,0-9,"!","@","$","%","&","*","(",")","-","=","[","]",";",":","'",""",",",".","?","/"," "))
               RETURN VALIDATION MESSAGE
            ENDIF

            Technical Business Rule Format:
            (^CTR16 <> BLANK) AND (NotCharacterInSet(^CTR16, 'a-z,A-Z,0-9,"!","@","$","%","&","*","(",")","-","=","[","]",";",":","'",""",",",".","?","/"," "'))
    
            Data Elements:
    
            ^CTR16 = RP:AddressDetails:AddressDetails.Line2.Text WHERE [AddressDetails.Usage.Code='POS'].[AddressDetails.Currency.Code='C']
            */
            assertion = (!string.IsNullOrWhiteSpace(report.CTR16) && !IsMatch(report.CTR16, @"^[a-z,A-Z,0-9,""!@\$%&\*\(\)\-=\[\];:'"",\.\?/ ""]*$", RegexOptions.IgnoreCase)) || IsMatch(report.CTR16, Environment.NewLine) || IsMatch(report.CTR16, "\n") || IsMatch(report.CTR16, "\r");
            if (assertion)
            {
                processMessage = new ProcessMessageDocument()
                {
                    Code = "CMN.ATO.CTR.500407",
                    Severity = ProcessMessageSeverity.Error,
                    Description = @"Business Entity Current postal address - Line 2 contains invalid text",
                    LongDescription = @"A text character must be one of the following: A to Z a to z 0 to 9 ! @ $ % & * ( ) - = [ ] ; : ' "" , . ? / or a space character",
                    Location = "/xbrli:xbrl/tns:AddressDetails" + OccurrenceIndex(report.AddressDetailsCollection_POS_C_RPOccurrenceIndex) + "/tns:AddressDetails.Line2.Text",
                    Parameters = new ProcessMessageParameters()
                    {
                        new ProcessMessageParameter()
                        {
                            Name = "RuleIdentifier",
                            Value = "VR.ATO.CTR.500407"
                        }
                    },
                };
                processMessage.Parameters.Add(new ProcessMessageParameter { Name = "CTR16", Value = GetValueOrEmpty(report.CTR16) });
                response.Add(processMessage);
            }
        }

        #endregion
        #region VR.ATO.CTR.500408
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public virtual void VRATOCTR500408()
        {
            ProcessMessageDocument processMessage;
            bool assertion;
            /*  VR.ATO.CTR.500408
            A text character must be one of the following: A to Z a to z 0 to 9 ! @ $ % & * ( ) - = [ ] ; : ' " , . ? / or a space character
    
            Legacy Rule Format:
            IF ([CTR24] <> NULLORBLANK) AND (ANY CHARACTER OF [CTR24] <> SET(a-z,A-Z,0-9,"!","@","$","%","&","*","(",")","-","=","[","]",";",":","'",""",",",".","?","/"," "))
               RETURN VALIDATION MESSAGE
            ENDIF

            Technical Business Rule Format:
            (^CTR24 <> BLANK) AND (NotCharacterInSet(^CTR24, 'a-z,A-Z,0-9,"!","@","$","%","&","*","(",")","-","=","[","]",";",":","'",""",",",".","?","/"," "'))
    
            Data Elements:
    
            ^CTR24 = RP:AddressDetails:AddressDetails.Line1.Text WHERE [AddressDetails.Usage.Code='POS'].[AddressDetails.Currency.Code='P']
            */
            assertion = (!string.IsNullOrWhiteSpace(report.CTR24) && ! IsMatch(report.CTR24, @"^[a-z,A-Z,0-9,""!@\$%&\*\(\)\-=\[\];:'"",\.\?/ ""]*$", RegexOptions.IgnoreCase)) || IsMatch(report.CTR24, Environment.NewLine) || IsMatch(report.CTR24, "\n") || IsMatch(report.CTR24, "\r");
            if (assertion)
            {
                processMessage = new ProcessMessageDocument()
                {
                    Code = "CMN.ATO.CTR.500408",
                    Severity = ProcessMessageSeverity.Error,
                    Description = @"Business Entity Postal address on previous return - Line 1 contains invalid text",
                    LongDescription = @"A text character must be one of the following: A to Z a to z 0 to 9 ! @ $ % & * ( ) - = [ ] ; : ' "" , . ? / or a space character",
                    Location = "/xbrli:xbrl/tns:AddressDetails" + OccurrenceIndex(report.AddressDetailsCollection_POS_P_RPOccurrenceIndex) + "/tns:AddressDetails.Line1.Text",
                    Parameters = new ProcessMessageParameters()
                    {
                        new ProcessMessageParameter()
                        {
                            Name = "RuleIdentifier",
                            Value = "VR.ATO.CTR.500408"
                        }
                    },
                };
                processMessage.Parameters.Add(new ProcessMessageParameter { Name = "CTR24", Value = report.CTR24 });
                response.Add(processMessage);
            }
        }

        #endregion
        #region VR.ATO.CTR.500409
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public virtual void VRATOCTR500409()
        {
            ProcessMessageDocument processMessage;
            bool assertion;
            /*  VR.ATO.CTR.500409
            A text character must be one of the following: A to Z a to z 0 to 9 ! @ $ % & * ( ) - = [ ] ; : ' " , . ? / or a space character
    
            Legacy Rule Format:
            IF ([CTR25] <> NULLORBLANK) AND (ANY CHARACTER OF [CTR25] <> SET(a-z,A-Z,0-9,"!","@","$","%","&","*","(",")","-","=","[","]",";",":","'",""",",",".","?","/"," "))
               RETURN VALIDATION MESSAGE
            ENDIF

            Technical Business Rule Format:
            (^CTR25 <> BLANK) AND (NotCharacterInSet(^CTR25, 'a-z,A-Z,0-9,"!","@","$","%","&","*","(",")","-","=","[","]",";",":","'",""",",",".","?","/"," "'))
    
            Data Elements:
    
            ^CTR25 = RP:AddressDetails:AddressDetails.Line2.Text WHERE [AddressDetails.Usage.Code='POS'].[AddressDetails.Currency.Code='P']
            */
            assertion = (!string.IsNullOrWhiteSpace(report.CTR25) && ! IsMatch(report.CTR25, @"^[a-z,A-Z,0-9,""!@\$%&\*\(\)\-=\[\];:'"",\.\?/ ""]*$", RegexOptions.IgnoreCase)) || IsMatch(report.CTR25, Environment.NewLine) || IsMatch(report.CTR25, "\n") || IsMatch(report.CTR25, "\r");
            if (assertion)
            {
                processMessage = new ProcessMessageDocument()
                {
                    Code = "CMN.ATO.CTR.500409",
                    Severity = ProcessMessageSeverity.Error,
                    Description = @"Business Entity Postal address on previous return - Line 2 contains invalid text",
                    LongDescription = @"A text character must be one of the following: A to Z a to z 0 to 9 ! @ $ % & * ( ) - = [ ] ; : ' "" , . ? / or a space character",
                    Location = "/xbrli:xbrl/tns:AddressDetails" + OccurrenceIndex(report.AddressDetailsCollection_POS_P_RPOccurrenceIndex) + "/tns:AddressDetails.Line2.Text",
                    Parameters = new ProcessMessageParameters()
                    {
                        new ProcessMessageParameter()
                        {
                            Name = "RuleIdentifier",
                            Value = "VR.ATO.CTR.500409"
                        }
                    },
                };
                processMessage.Parameters.Add(new ProcessMessageParameter { Name = "CTR25", Value = GetValueOrEmpty(report.CTR25) });
                response.Add(processMessage);
            }
        }

        #endregion
        #region VR.ATO.CTR.500410
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public virtual void VRATOCTR500410()
        {
            ProcessMessageDocument processMessage;
            bool assertion;
            /*  VR.ATO.CTR.500410
            A text character must be one of the following: A to Z a to z 0 to 9 ! @ $ % & * ( ) - = [ ] ; : ' " , . ? / or a space character
    
            Legacy Rule Format:
            IF ([CTR33] <> NULLORBLANK) AND (ANY CHARACTER OF [CTR33] <> SET(a-z,A-Z,0-9,"!","@","$","%","&","*","(",")","-","=","[","]",";",":","'",""",",",".","?","/"," "))
               RETURN VALIDATION MESSAGE
            ENDIF

            Technical Business Rule Format:
            (^CTR33 <> BLANK) AND (NotCharacterInSet(^CTR33, 'a-z,A-Z,0-9,"!","@","$","%","&","*","(",")","-","=","[","]",";",":","'",""",",",".","?","/"," "'))
    
            Data Elements:
    
            ^CTR33 = RP:AddressDetails:AddressDetails.Line1.Text WHERE [AddressDetails.Usage.Code='BUS'].[AddressDetails.Currency.Code='C']
            */
            assertion = (!string.IsNullOrWhiteSpace(report.CTR33) && !IsMatch(report.CTR33, @"^[a-z,A-Z,0-9,""!@\$%&\*\(\)\-=\[\];:'"",\.\?/ ""]*$", RegexOptions.IgnoreCase)) || IsMatch(report.CTR33, Environment.NewLine) || IsMatch(report.CTR33, "\n") || IsMatch(report.CTR33, "\r");
            if (assertion)
            {
                processMessage = new ProcessMessageDocument()
                {
                    Code = "CMN.ATO.CTR.500410",
                    Severity = ProcessMessageSeverity.Error,
                    Description = @"Business Entity address of main business - Line 1 contains invalid text",
                    LongDescription = @"A text character must be one of the following: A to Z a to z 0 to 9 ! @ $ % & * ( ) - = [ ] ; : ' "" , . ? / or a space character",
                    Location = "/xbrli:xbrl/tns:AddressDetails" + OccurrenceIndex(report.AddressDetailsCollection_BUS_C_RPOccurrenceIndex) + "/tns:AddressDetails.Line1.Text",
                    Parameters = new ProcessMessageParameters()
                    {
                        new ProcessMessageParameter()
                        {
                            Name = "RuleIdentifier",
                            Value = "VR.ATO.CTR.500410"
                        }
                    },
                };
                processMessage.Parameters.Add(new ProcessMessageParameter { Name = "CTR33", Value = report.CTR33 });
                response.Add(processMessage);
            }
        }

        #endregion
        #region VR.ATO.CTR.500411
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public virtual void VRATOCTR500411()
        {
            ProcessMessageDocument processMessage;
            bool assertion;
            /*  VR.ATO.CTR.500411
            A text character must be one of the following: A to Z a to z 0 to 9 ! @ $ % & * ( ) - = [ ] ; : ' " , . ? / or a space character
    
            Legacy Rule Format:
            IF ([CTR34] <> NULLORBLANK) AND (ANY CHARACTER OF [CTR34] <> SET(a-z,A-Z,0-9,"!","@","$","%","&","*","(",")","-","=","[","]",";",":","'",""",",",".","?","/"," "))
               RETURN VALIDATION MESSAGE
            ENDIF

            Technical Business Rule Format:
            (^CTR34 <> BLANK) AND (NotCharacterInSet(^CTR34, 'a-z,A-Z,0-9,"!","@","$","%","&","*","(",")","-","=","[","]",";",":","'",""",",",".","?","/"," "'))
    
            Data Elements:
    
            ^CTR34 = RP:AddressDetails:AddressDetails.Line2.Text WHERE [AddressDetails.Usage.Code='BUS'].[AddressDetails.Currency.Code='C']
            */
            assertion = (!string.IsNullOrWhiteSpace(report.CTR34) && !IsMatch(report.CTR34, @"^[a-z,A-Z,0-9,""!@\$%&\*\(\)\-=\[\];:'"",\.\?/ ""]*$", RegexOptions.IgnoreCase)) || IsMatch(report.CTR34, Environment.NewLine) || IsMatch(report.CTR34, "\n") || IsMatch(report.CTR34, "\r");
            if (assertion)
            {
                processMessage = new ProcessMessageDocument()
                {
                    Code = "CMN.ATO.CTR.500411",
                    Severity = ProcessMessageSeverity.Error,
                    Description = @"Business Entity address of main business - Line 2 contains invalid text",
                    LongDescription = @"A text character must be one of the following: A to Z a to z 0 to 9 ! @ $ % & * ( ) - = [ ] ; : ' "" , . ? / or a space character",
                    Location = "/xbrli:xbrl/tns:AddressDetails" + OccurrenceIndex(report.AddressDetailsCollection_BUS_C_RPOccurrenceIndex) + "/tns:AddressDetails.Line2.Text",
                    Parameters = new ProcessMessageParameters()
                    {
                        new ProcessMessageParameter()
                        {
                            Name = "RuleIdentifier",
                            Value = "VR.ATO.CTR.500411"
                        }
                    },
                };
                processMessage.Parameters.Add(new ProcessMessageParameter { Name = "CTR34", Value = GetValueOrEmpty(report.CTR34) });
                response.Add(processMessage);
            }
        }

        #endregion
        #region VR.ATO.CTR.500412
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public virtual void VRATOCTR500412()
        {
            ProcessMessageDocument processMessage;
            bool assertion;
            /*  VR.ATO.CTR.500412
            A text character must be one of the following: A to Z a to z 0 to 9 ! @ $ % & * ( ) - = [ ] ; : ' " , . ? / or a space character
    
            Legacy Rule Format:
            IF ([CTR19] <> NULLORBLANK) AND (ANY CHARACTER OF [CTR19] <> SET(a-z,A-Z,0-9,"!","@","$","%","&","*","(",")","-","=","[","]",";",":","'",""",",",".","?","/"," "))
               RETURN VALIDATION MESSAGE
            ENDIF

            Technical Business Rule Format:
            (^CTR19 <> BLANK) AND (NotCharacterInSet(^CTR19, 'a-z,A-Z,0-9,"!","@","$","%","&","*","(",")","-","=","[","]",";",":","'",""",",",".","?","/"," "'))
    
            Data Elements:
    
            ^CTR19 = RP:AddressDetails:AddressDetails.LocalityName.Text WHERE [AddressDetails.Usage.Code='POS'].[AddressDetails.Currency.Code='C']
            */
            assertion = (!string.IsNullOrWhiteSpace(report.CTR19) && !IsMatch(report.CTR19, @"^[a-z,A-Z,0-9,""!@\$%&\*\(\)\-=\[\];:'"",\.\?/ ""]*$", RegexOptions.IgnoreCase)) || IsMatch(report.CTR19, Environment.NewLine) || IsMatch(report.CTR19, "\n") || IsMatch(report.CTR19, "\r");
            if (assertion)
            {
                processMessage = new ProcessMessageDocument()
                {
                    Code = "CMN.ATO.CTR.500412",
                    Severity = ProcessMessageSeverity.Error,
                    Description = @"Business Entity Current postal address - Suburb, Town or City contains invalid text",
                    LongDescription = @"A text character must be one of the following: A to Z a to z 0 to 9 ! @ $ % & * ( ) - = [ ] ; : ' "" , . ? / or a space character",
                    Location = "/xbrli:xbrl/tns:AddressDetails" + OccurrenceIndex(report.AddressDetailsCollection_POS_C_RPOccurrenceIndex) + "/tns:AddressDetails.LocalityName.Text",
                    Parameters = new ProcessMessageParameters()
                    {
                        new ProcessMessageParameter()
                        {
                            Name = "RuleIdentifier",
                            Value = "VR.ATO.CTR.500412"
                        }
                    },
                };
                processMessage.Parameters.Add(new ProcessMessageParameter { Name = "CTR19", Value = report.CTR19 });
                response.Add(processMessage);
            }
        }

        #endregion
        #region VR.ATO.CTR.500413
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public virtual void VRATOCTR500413()
        {
            ProcessMessageDocument processMessage;
            bool assertion;
            /*  VR.ATO.CTR.500413
            A text character must be one of the following: A to Z a to z 0 to 9 ! @ $ % & * ( ) - = [ ] ; : ' " , . ? / or a space character
    
            Legacy Rule Format:
            IF ([CTR28] <> NULLORBLANK) AND (ANY CHARACTER OF [CTR28] <> SET(a-z,A-Z,0-9,"!","@","$","%","&","*","(",")","-","=","[","]",";",":","'",""",",",".","?","/"," "))
               RETURN VALIDATION MESSAGE
            ENDIF

            Technical Business Rule Format:
            (^CTR28 <> BLANK) AND (NotCharacterInSet(^CTR28, 'a-z,A-Z,0-9,"!","@","$","%","&","*","(",")","-","=","[","]",";",":","'",""",",",".","?","/"," "'))
    
            Data Elements:
    
            ^CTR28 = RP:AddressDetails:AddressDetails.LocalityName.Text WHERE [AddressDetails.Usage.Code='POS'].[AddressDetails.Currency.Code='P']
            */
            assertion = (!string.IsNullOrWhiteSpace(report.CTR28) && !IsMatch(report.CTR28, @"^[a-z,A-Z,0-9,""!@\$%&\*\(\)\-=\[\];:'"",\.\?/ ""]*$", RegexOptions.IgnoreCase)) || IsMatch(report.CTR28, Environment.NewLine) || IsMatch(report.CTR28, "\n") || IsMatch(report.CTR28, "\r");
            if (assertion)
            {
                processMessage = new ProcessMessageDocument()
                {
                    Code = "CMN.ATO.CTR.500413",
                    Severity = ProcessMessageSeverity.Error,
                    Description = @"Business Entity Postal address on previous return - Suburb, Town or city contains invalid text",
                    LongDescription = @"A text character must be one of the following: A to Z a to z 0 to 9 ! @ $ % & * ( ) - = [ ] ; : ' "" , . ? / or a space character",
                    Location = "/xbrli:xbrl/tns:AddressDetails" + OccurrenceIndex(report.AddressDetailsCollection_POS_P_RPOccurrenceIndex) + "/tns:AddressDetails.LocalityName.Text",
                    Parameters = new ProcessMessageParameters()
                    {
                        new ProcessMessageParameter()
                        {
                            Name = "RuleIdentifier",
                            Value = "VR.ATO.CTR.500413"
                        }
                    },
                };
                processMessage.Parameters.Add(new ProcessMessageParameter { Name = "CTR28", Value = report.CTR28 });
                response.Add(processMessage);
            }
        }

        #endregion
        #region VR.ATO.CTR.500414
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public virtual void VRATOCTR500414()
        {
            ProcessMessageDocument processMessage;
            bool assertion;
            /*  VR.ATO.CTR.500414
            A text character must be one of the following: A to Z a to z 0 to 9 ! @ $ % & * ( ) - = [ ] ; : ' " , . ? / or a space character
    
            Legacy Rule Format:
            IF ([CTR37] <> NULLORBLANK) AND (ANY CHARACTER OF [CTR37] <> SET(a-z,A-Z,0-9,"!","@","$","%","&","*","(",")","-","=","[","]",";",":","'",""",",",".","?","/"," "))
               RETURN VALIDATION MESSAGE
            ENDIF

            Technical Business Rule Format:
            (^CTR37 <> BLANK) AND (NotCharacterInSet(^CTR37, 'a-z,A-Z,0-9,"!","@","$","%","&","*","(",")","-","=","[","]",";",":","'",""",",",".","?","/"," "'))
    
            Data Elements:
    
            ^CTR37 = RP:AddressDetails:AddressDetails.LocalityName.Text WHERE [AddressDetails.Usage.Code='BUS'].[AddressDetails.Currency.Code='C']
            */
            assertion = (!string.IsNullOrWhiteSpace(report.CTR37) && !IsMatch(report.CTR37, @"^[a-z,A-Z,0-9,""!@\$%&\*\(\)\-=\[\];:'"",\.\?/ ""]*$", RegexOptions.IgnoreCase)) || IsMatch(report.CTR37, Environment.NewLine) || IsMatch(report.CTR37, "\n") || IsMatch(report.CTR37, "\r");
            if (assertion)
            {
                processMessage = new ProcessMessageDocument()
                {
                    Code = "CMN.ATO.CTR.500414",
                    Severity = ProcessMessageSeverity.Error,
                    Description = @"Business Entity address of main business - Suburb, Town or city contains invalid text",
                    LongDescription = @"A text character must be one of the following: A to Z a to z 0 to 9 ! @ $ % & * ( ) - = [ ] ; : ' "" , . ? / or a space character",
                    Location = "/xbrli:xbrl/tns:AddressDetails" + OccurrenceIndex(report.AddressDetailsCollection_BUS_C_RPOccurrenceIndex) + "/tns:AddressDetails.LocalityName.Text",
                    Parameters = new ProcessMessageParameters()
                    {
                        new ProcessMessageParameter()
                        {
                            Name = "RuleIdentifier",
                            Value = "VR.ATO.CTR.500414"
                        }
                    },
                };
                processMessage.Parameters.Add(new ProcessMessageParameter { Name = "CTR37", Value = report.CTR37 });
                response.Add(processMessage);
            }
        }

        #endregion
    }
}