/// <summary>
        /// Create EtsNoticeContract from NoticeContract
        /// </summary>
        /// <param name="dto">Notice data contract</param>
        public EtsNoticeContract(NoticeContract dto)
        {
            Id = dto.Id;
            CommunicationInformation     = dto.CommunicationInformation;
            ComplementaryInformation     = dto.ComplementaryInformation;
            ConditionsInformation        = dto.ConditionsInformation;
            ConditionsInformationDefence = dto.ConditionsInformationDefence;
            ContactPerson           = dto.ContactPerson;
            EstimatedValue          = dto.ProcurementObject.EstimatedValue;
            TotalValue              = dto.ProcurementObject.TotalValue;
            LotsInfo                = dto.LotsInfo;
            MainCpvCode             = dto.ProcurementObject.MainCpvCode;
            ObjectDescriptions      = dto.ObjectDescriptions;
            NoticeOjsNumber         = dto.NoticeOjsNumber;
            PreviousNoticeOjsNumber = dto.PreviousNoticeOjsNumber;

            Project = new EtsProjectContract
            {
                Id                = dto.Project.Id,
                ContractType      = dto.Project.ContractType,
                ReferenceNumber   = dto.Project.ReferenceNumber,
                Title             = dto.Project.Title,
                CentralPurchasing = dto.Project.CentralPurchasing,
                DefenceCategory   = dto.Project.DefenceCategory,
                DisagreeToPublishNoticeBasedOnDefenceServiceCategory4 = dto.Project.DisagreeToPublishNoticeBasedOnDefenceServiceCategory4,
                DefenceSupplies     = dto.Project.DefenceSupplies,
                DefenceWorks        = dto.Project.DefenceWorks,
                JointProcurement    = dto.Project.JointProcurement,
                ProcurementCategory = dto.Project.ProcurementCategory,
                ProcurementLaw      = dto.Project.ProcurementLaw,
                AgricultureWorks    = dto.Project.AgricultureWorks
            };
            Organisation = new EtsOrganisationContract
            {
                Information = dto.Project.Organisation.Information,
                ContractingAuthorityType      = dto.Project.Organisation.ContractingAuthorityType,
                ContractingType               = dto.Project.Organisation.ContractingType,
                MainActivity                  = dto.Project.Organisation.MainActivity,
                OtherContractingAuthorityType = dto.Project.Organisation.OtherContractingAuthorityType,
                OtherMainActivity             = dto.Project.Organisation.OtherMainActivity
            };
            ShortDescription     = dto.ProcurementObject.ShortDescription;
            TenderingInformation = dto.TenderingInformation;
            RewardsAndJury       = dto.RewardsAndJury;
            ResultsOfContest     = dto.ResultsOfContest;
            ProcedureInformation = dto.ProcedureInformation;
            ProceduresForReview  = dto.ProceduresForReview;
            Modifications        = dto.Modifications;
            Type          = dto.Type;
            LegalBasis    = dto.LegalBasis;
            Language      = dto.Language;
            Links         = dto.AttachmentInformation.Links;
            Defence       = dto.ProcurementObject.Defence;
            IsCorrigendum = dto.IsCorrigendum;
            Changes       = dto.Changes;
            CorrigendumAdditionalInformation = dto.CorrigendumAdditionalInformation;
            ContractAwardsDefence            = dto.ContractAwardsDefence;
            IsPrivateSmallValueProcurement   = dto.IsPrivateSmallValueProcurement;
            Annexes = dto.Annexes;
        }
 public void Trim()
 {
     if (!CanBeRenewed)
     {
         Amount             = new ValueRangeContract();
         SubsequentContract = new TimeFrame();
     }
 }
        /// <summary>
        /// Adds changes for Value range contracts, ignores currency if value is not set
        /// </summary>
        /// <param name="changes"></param>
        /// <param name="originalValue"></param>
        /// <param name="newValue"></param>
        /// <param name="type"></param>
        /// <param name="propertyName"></param>
        /// <param name="lotNumber">Override for lot number</param>
        /// <param name="section">Override for section number</param>
        /// <param name="translationKey">Override for translation key</param>
        /// <param name="alternativeMinTranslationKey">Alternative key for min value translation</param>
        /// <param name="alternativeMaxTranslationKey">Alternative key for max value translation</param>

        public static void Add(this List <Change> changes, ValueRangeContract originalValue, ValueRangeContract newValue, Type type,
                               string propertyName, string lotNumber = null, string section = null, string translationKey = null, string alternativeMinTranslationKey = null, string alternativeMaxTranslationKey = null)
        {
            var originalIsRange = originalValue?.Type == ContractValueType.Range;
            var newIsRange      = newValue?.Type == ContractValueType.Range;

            changes.Add(originalValue?.Value, newValue?.Value, type, propertyName, lotNumber, section, translationKey);
            changes.Add(originalValue?.MinValue, newValue?.MinValue, type, propertyName, lotNumber, section, alternativeMinTranslationKey);
            changes.Add(originalValue?.MaxValue, newValue?.MaxValue, type, propertyName, lotNumber, section, alternativeMaxTranslationKey);

            var originalHasValue = originalIsRange ? originalValue?.MinValue != null || originalValue?.MaxValue != null : originalValue?.Value != null;
            var newHasValue      = newIsRange ? newValue?.MinValue != null || newValue?.MaxValue != null : newValue?.Value != null;

            var originalCurrency = originalHasValue ? originalValue?.Currency : null;
            var newCurrency      = newHasValue ? newValue?.Currency : null;

            changes.Add(originalCurrency, newCurrency, type, propertyName, lotNumber, section, translationKey);
            changes.Add(originalValue?.DoesNotExceedNationalThreshold, newValue?.DoesNotExceedNationalThreshold, type, nameof(ValueRangeContract.DoesNotExceedNationalThreshold), lotNumber, section, translationKey);
        }
        /// <summary>
        /// Create EtsNoticeContract from NoticeContract
        /// </summary>
        /// <param name="dto">Notice data contract</param>
        public EtsNoticeContract(NoticeContract dto)
        {
            Id = dto.Id;
            CommunicationInformation     = dto.CommunicationInformation;
            ComplementaryInformation     = dto.ComplementaryInformation;
            ConditionsInformation        = dto.ConditionsInformation;
            ConditionsInformationDefence = dto.ConditionsInformationDefence;
            ContactPerson           = dto.ContactPerson;
            EstimatedValue          = dto.ProcurementObject.EstimatedValue;
            TotalValue              = dto.ProcurementObject.TotalValue;
            LotsInfo                = dto.LotsInfo;
            MainCpvCode             = dto.ProcurementObject.MainCpvCode;
            ObjectDescriptions      = dto.ObjectDescriptions;
            NoticeOjsNumber         = dto.NoticeOjsNumber;
            PreviousNoticeOjsNumber = dto.PreviousNoticeOjsNumber;

            Project = new EtsProjectContract
            {
                Id                = dto.Project.Id,
                ContractType      = dto.Project.ContractType,
                ReferenceNumber   = dto.Project.ReferenceNumber,
                Title             = dto.Project.Title,
                CentralPurchasing = dto.Project.CentralPurchasing,
                DefenceCategory   = dto.Project.DefenceCategory,
                DisagreeToPublishNoticeBasedOnDefenceServiceCategory4 = dto.Project.DisagreeToPublishNoticeBasedOnDefenceServiceCategory4,
                DefenceSupplies     = dto.Project.DefenceSupplies,
                DefenceWorks        = dto.Project.DefenceWorks,
                JointProcurement    = dto.Project.JointProcurement,
                ProcurementCategory = dto.Project.ProcurementCategory,
                ProcurementLaw      = dto.Project.ProcurementLaw,
                AgricultureWorks    = dto.Project.AgricultureWorks,
                CoPurchasers        = dto.Project.CoPurchasers
            };
            Organisation = new EtsOrganisationContract
            {
                Information = dto.Project.Organisation.Information,
                ContractingAuthorityType      = dto.Project.Organisation.ContractingAuthorityType,
                ContractingType               = dto.Project.Organisation.ContractingType,
                MainActivity                  = dto.Project.Organisation.MainActivity,
                OtherContractingAuthorityType = dto.Project.Organisation.OtherContractingAuthorityType,
                OtherMainActivity             = dto.Project.Organisation.OtherMainActivity,
                MainActivityUtilities         = dto.Project.Organisation.MainActivityUtilities
            };
            ShortDescription     = dto.ProcurementObject.ShortDescription;
            TenderingInformation = dto.TenderingInformation;
            RewardsAndJury       = dto.RewardsAndJury;
            ResultsOfContest     = dto.ResultsOfContest;
            ProcedureInformation = dto.ProcedureInformation;
            ProceduresForReview  = dto.ProceduresForReview;
            Modifications        = dto.Modifications;
            Type            = dto.Type;
            LegalBasis      = dto.LegalBasis;
            Language        = dto.Language;
            Links           = dto.AttachmentInformation.Links;
            Defence         = dto.ProcurementObject.Defence;
            IsCorrigendum   = dto.IsCorrigendum;
            IsCancelled     = dto.IsCancelled;
            CancelledReason = dto.CancelledReason;
            Changes         = dto.Changes;
            CorrigendumAdditionalInformation = dto.CorrigendumAdditionalInformation;
            ContractAwardsDefence            = dto.ContractAwardsDefence;
            IsPrivateSmallValueProcurement   = dto.IsPrivateSmallValueProcurement;
            Annexes = dto.Annexes;

            if (dto.HilmaStatistics != null)
            {
                HilmaStatistics = new HilmaStatistics
                {
                    EnergyEfficiencyConsidered = dto.HilmaStatistics.EnergyEfficiencyConsidered,
                    InnovationConsidered       = dto.HilmaStatistics.InnovationConsidered,
                    SMEParticipationConsidered = dto.HilmaStatistics.SMEParticipationConsidered,
                    LowCarbon                       = dto.HilmaStatistics.LowCarbon,
                    CircularEconomy                 = dto.HilmaStatistics.CircularEconomy,
                    Biodiversity                    = dto.HilmaStatistics.Biodiversity,
                    SustainableFoodProduction       = dto.HilmaStatistics.SustainableFoodProduction,
                    ListedGreenCriteriaUsed         = dto.HilmaStatistics.ListedGreenCriteriaUsed,
                    JustWorkingConditions           = dto.HilmaStatistics.JustWorkingConditions,
                    EmploymentCondition             = dto.HilmaStatistics.EmploymentCondition,
                    HowManyOpportunitiesIsEstimated = dto.HilmaStatistics.HowManyOpportunitiesIsEstimated,
                    CodeOfConduct                   = dto.HilmaStatistics.CodeOfConduct,
                    SolutionNewToBuyer              = dto.HilmaStatistics.SolutionNewToBuyer,
                    SolutionNewToMarketOrIndustry   = dto.HilmaStatistics.SolutionNewToMarketOrIndustry,
                    EndUserInvolved                 = dto.HilmaStatistics.EndUserInvolved
                }
            }
            ;
        }