/// <summary>Updates the bed configuration.</summary>
        /// <param name="bed"> [in,out] The bed.</param>
        /// <param name="next">The next.</param>
        public static void UpdateBedConfiguration(
            ref Location bed,
            BedConfiguration next)
        {
            if (bed == null)
            {
                throw new ArgumentNullException(nameof(bed));
            }

            if (next == null)
            {
                throw new ArgumentNullException(nameof(next));
            }

            bed.Status            = GetLocationStatus(next.Availability);
            bed.OperationalStatus = FhirTriplet.OperationalStatus(next.Status).GetCoding();
        }
        /// <summary>Generates a group.</summary>
        /// <exception cref="ArgumentNullException">Thrown when one or more required arguments are null.</exception>
        /// <param name="org">           The managing organization.</param>
        /// <param name="parentLocation">The parent location.</param>
        /// <param name="name">          The name.</param>
        /// <param name="bedConfig">     The bed configuration this group represents.</param>
        /// <param name="bedCount">      Number of beds.</param>
        /// <param name="period">        The period.</param>
        /// <returns>The group.</returns>
        public static Group GenerateGroup(
            Organization org,
            Location parentLocation,
            string name,
            BedConfiguration bedConfig,
            int bedCount,
            Period period)
        {
            if (org == null)
            {
                throw new ArgumentNullException(nameof(org));
            }

            if (parentLocation == null)
            {
                throw new ArgumentNullException(nameof(parentLocation));
            }

            if (bedConfig == null)
            {
                throw new ArgumentNullException(nameof(bedConfig));
            }

            List <Group.CharacteristicComponent> characteristics = new List <Group.CharacteristicComponent>()
            {
                new Group.CharacteristicComponent()
                {
                    Code    = FhirTriplet.SanerAvailabilityStatus.GetConcept(),
                    Value   = FhirTriplet.AvailabilityStatus(bedConfig.Availability).GetConcept(),
                    Exclude = false,
                },
                new Group.CharacteristicComponent()
                {
                    Code    = FhirTriplet.SanerOperationalStatus.GetConcept(),
                    Value   = FhirTriplet.OperationalStatus(bedConfig.Status).GetConcept(),
                    Exclude = false,
                },
                new Group.CharacteristicComponent()
                {
                    Code    = FhirTriplet.SanerType.GetConcept(),
                    Value   = FhirTriplet.BedType(bedConfig.Type).GetConcept(),
                    Exclude = false,
                },
                new Group.CharacteristicComponent()
                {
                    Code    = FhirTriplet.SanerFeature.GetConcept(),
                    Value   = FhirTriplet.BedFeature(bedConfig.Feature).GetConcept(),
                    Exclude = false,
                },
                new Group.CharacteristicComponent()
                {
                    Code    = FhirTriplet.SanerLocation.GetConcept(),
                    Value   = new ResourceReference($"{parentLocation.ResourceType}/{parentLocation.Id}"),
                    Exclude = false,
                },
                new Group.CharacteristicComponent()
                {
                    // Code = FhirTriplet.SanerPeriod.GetConcept(),
                    Code    = FhirTriplet.MeasureReportPeriod.GetConcept(),
                    Value   = FhirTriplet.EmptyRequired.GetConcept(),
                    Period  = period,
                    Exclude = false,
                },
            };

            return(new Group()
            {
                Id = NextId,
                Type = Group.GroupType.Device,
                Actual = true,
                Code = FhirTriplet.PhysicalTypeBed.GetConcept(),
                Name = name,
                Quantity = bedCount,
                ManagingEntity = new ResourceReference($"{org.ResourceType}/{org.Id}"),
                Characteristic = characteristics,
                Text = new Narrative()
                {
                    Div = $"<div xmlns=\"http://www.w3.org/1999/xhtml\">" +
                          $" {org.Name} Beds of type: {bedConfig.Type} ({bedConfig.Feature})" +
                          $" Flagged {bedConfig.Availability} and {bedConfig.Status}</div>",
                },
            });
        }