protected BookablePairIdTemplate(bool overrideSessionSeriesCheck,
                                         OpportunityIdConfiguration opportunityIdConfiguration,
                                         OpportunityIdConfiguration?parentIdConfiguration,
                                         OpportunityIdConfiguration?grandparentIdConfiguration)
            : base(opportunityIdConfiguration.OpportunityIdTemplate, opportunityIdConfiguration.OfferIdTemplate,
                   parentIdConfiguration?.OpportunityIdTemplate, parentIdConfiguration?.OfferIdTemplate,
                   grandparentIdConfiguration?.OpportunityIdTemplate, grandparentIdConfiguration?.OfferIdTemplate)
        {
            // SH-TODO: Add more code here to validate the combinations of child/parent/grandparent OpportunityType based on the Parent relationship
            // in OpportunityTypes.Configuration. Throw an error if the user attempts to create something invalid.
            // Also check that anything that's set as Bookable = true, at least ahs Bookable = true in OpportunityTypes.Configuration

            this.OpportunityIdConfiguration = opportunityIdConfiguration;
            this.ParentIdConfiguration      = parentIdConfiguration;
            this.GrandparentIdConfiguration = grandparentIdConfiguration;

            // Create list to simplify access
            var list = new List <OpportunityIdConfiguration> {
                this.OpportunityIdConfiguration
            };

            if (this.ParentIdConfiguration.HasValue)
            {
                list.Add(this.ParentIdConfiguration.Value);
            }
            if (this.GrandparentIdConfiguration.HasValue)
            {
                list.Add(this.GrandparentIdConfiguration.Value);
            }
            this.IdConfigurations = list;
        }
 public BookablePairIdTemplateWithOfferInheritance(
     OpportunityIdConfiguration opportunityIdConfiguration,
     OpportunityIdConfiguration?parentIdConfiguration      = null,
     OpportunityIdConfiguration?grandparentIdConfiguration = null)
     : base(false, opportunityIdConfiguration, parentIdConfiguration, grandparentIdConfiguration)
 {
     // ScheduledSession with SessionSeries is the only opportunity type that allows Offer inheritance within Modelling Specification 2.0
     // Therefore the check below ensures that this class is only used in accordance with the spec
     if (opportunityIdConfiguration.OpportunityType != OpportunityType.ScheduledSession)
     {
         throw new NotSupportedException($"{nameof(BookablePairIdTemplateWithOfferInheritance<TBookableIdComponents>)} used with unsupported {nameof(OpportunityType)} pair. ScheduledSession (from SessionSeries) is the only opportunity type that allows Offer inheritance within Modelling Specification 2.0. Please use {nameof(BookablePairIdTemplate<TBookableIdComponents>)}.");
     }
 }