protected internal DocumentationSettings(JsonObject documentationSettingsObject, AnalyzerConfigOptionsWrapper analyzerConfigOptions)
        {
            bool?  documentExposedElements  = null;
            bool?  documentInternalElements = null;
            bool?  documentPrivateElements  = null;
            bool?  documentInterfaces       = null;
            bool?  documentPrivateFields    = null;
            string companyName      = null;
            string copyrightText    = null;
            string headerDecoration = null;

            ImmutableDictionary <string, string> .Builder variables = null;
            bool?xmlHeader = null;
            FileNamingConvention?fileNamingConvention = null;
            string documentationCulture = null;

            ImmutableArray <string> .Builder excludeFromPunctuationCheck = null;

            foreach (var kvp in documentationSettingsObject)
            {
                switch (kvp.Key)
                {
                case "documentExposedElements":
                    documentExposedElements = kvp.ToBooleanValue();
                    break;

                case "documentInternalElements":
                    documentInternalElements = kvp.ToBooleanValue();
                    break;

                case "documentPrivateElements":
                    documentPrivateElements = kvp.ToBooleanValue();
                    break;

                case "documentInterfaces":
                    documentInterfaces = kvp.ToBooleanValue();
                    break;

                case "documentPrivateFields":
                    documentPrivateFields = kvp.ToBooleanValue();
                    break;

                case "companyName":
                    companyName = kvp.ToStringValue();
                    break;

                case "copyrightText":
                    copyrightText = kvp.ToStringValue();
                    break;

                case "headerDecoration":
                    headerDecoration = kvp.ToStringValue();
                    break;

                case "variables":
                    kvp.AssertIsObject();
                    variables = ImmutableDictionary.CreateBuilder <string, string>();
                    foreach (var child in kvp.Value.AsJsonObject)
                    {
                        string name = child.Key;

                        if (!Regex.IsMatch(name, "^[a-zA-Z0-9]+$"))
                        {
                            continue;
                        }

                        string value = child.ToStringValue();

                        variables.Add(name, value);
                    }

                    break;

                case "xmlHeader":
                    xmlHeader = kvp.ToBooleanValue();
                    break;

                case "fileNamingConvention":
                    fileNamingConvention = kvp.ToEnumValue <FileNamingConvention>();
                    break;

                case "documentationCulture":
                    documentationCulture = kvp.ToStringValue();
                    break;

                case "excludeFromPunctuationCheck":
                    kvp.AssertIsArray();
                    excludeFromPunctuationCheck = ImmutableArray.CreateBuilder <string>();
                    foreach (var value in kvp.Value.AsJsonArray)
                    {
                        excludeFromPunctuationCheck.Add(value.AsString);
                    }

                    break;

                default:
                    break;
                }
            }

            documentExposedElements ??= AnalyzerConfigHelper.TryGetBooleanValue(analyzerConfigOptions, "stylecop.documentation.documentExposedElements");
            documentInternalElements ??= AnalyzerConfigHelper.TryGetBooleanValue(analyzerConfigOptions, "stylecop.documentation.documentInternalElements");
            documentPrivateElements ??= AnalyzerConfigHelper.TryGetBooleanValue(analyzerConfigOptions, "stylecop.documentation.documentPrivateElements");
            documentInterfaces ??= AnalyzerConfigHelper.TryGetBooleanValue(analyzerConfigOptions, "stylecop.documentation.documentInterfaces");
            documentPrivateFields ??= AnalyzerConfigHelper.TryGetBooleanValue(analyzerConfigOptions, "stylecop.documentation.documentPrivateFields");

            companyName ??= AnalyzerConfigHelper.TryGetStringValue(analyzerConfigOptions, "stylecop.documentation.companyName");
            copyrightText ??= AnalyzerConfigHelper.TryGetStringValue(analyzerConfigOptions, "stylecop.documentation.copyrightText")
            ?? AnalyzerConfigHelper.TryGetStringValue(analyzerConfigOptions, "file_header_template");
            headerDecoration ??= AnalyzerConfigHelper.TryGetStringValue(analyzerConfigOptions, "stylecop.documentation.headerDecoration");

            xmlHeader ??= AnalyzerConfigHelper.TryGetBooleanValue(analyzerConfigOptions, "stylecop.documentation.xmlHeader");
            fileNamingConvention ??= AnalyzerConfigHelper.TryGetStringValue(analyzerConfigOptions, "stylecop.documentation.fileNamingConvention") switch
            {
                "stylecop" => FileNamingConvention.StyleCop,
                "metadata" => FileNamingConvention.Metadata,
                _ => null,
            };

            documentationCulture ??= AnalyzerConfigHelper.TryGetStringValue(analyzerConfigOptions, "stylecop.documentation.documentationCulture");
            excludeFromPunctuationCheck ??= AnalyzerConfigHelper.TryGetStringListValue(analyzerConfigOptions, "stylecop.documentation.excludeFromPunctuationCheck")?.ToBuilder();

            this.documentExposedElements  = documentExposedElements.GetValueOrDefault(true);
            this.documentInternalElements = documentInternalElements.GetValueOrDefault(true);
            this.documentPrivateElements  = documentPrivateElements.GetValueOrDefault(false);
            this.documentInterfaces       = documentInterfaces.GetValueOrDefault(true);
            this.documentPrivateFields    = documentPrivateFields.GetValueOrDefault(false);
            this.companyName                 = companyName ?? DefaultCompanyName;
            this.copyrightText               = copyrightText ?? DefaultCopyrightText;
            this.headerDecoration            = headerDecoration;
            this.variables                   = variables?.ToImmutable() ?? ImmutableDictionary <string, string> .Empty;
            this.xmlHeader                   = xmlHeader.GetValueOrDefault(true);
            this.fileNamingConvention        = fileNamingConvention.GetValueOrDefault(FileNamingConvention.StyleCop);
            this.documentationCulture        = documentationCulture ?? DefaultDocumentationCulture;
            this.documentationCultureInfo    = this.documentationCulture == DefaultDocumentationCulture ? CultureInfo.InvariantCulture : new CultureInfo(this.documentationCulture);
            this.excludeFromPunctuationCheck = excludeFromPunctuationCheck?.ToImmutable() ?? DefaultExcludeFromPunctuationCheck;
        }
        protected internal NamingSettings(JsonObject namingSettingsObject, AnalyzerConfigOptionsWrapper analyzerConfigOptions)
        {
            bool?allowCommonHungarianPrefixes = null;

            ImmutableArray <string> .Builder allowedHungarianPrefixes   = null;
            ImmutableArray <string> .Builder allowedNamespaceComponents = null;
            bool?includeInferredTupleElementNames       = null;
            TupleElementNameCase?tupleElementNameCasing = null;

            foreach (var kvp in namingSettingsObject)
            {
                switch (kvp.Key)
                {
                case "allowCommonHungarianPrefixes":
                    allowCommonHungarianPrefixes = kvp.ToBooleanValue();
                    break;

                case "allowedHungarianPrefixes":
                    kvp.AssertIsArray();
                    allowedHungarianPrefixes = ImmutableArray.CreateBuilder <string>();
                    foreach (var prefixJsonValue in kvp.Value.AsJsonArray)
                    {
                        var prefix = prefixJsonValue.ToStringValue(kvp.Key);

                        if (!Regex.IsMatch(prefix, "^[a-z]{1,2}$"))
                        {
                            continue;
                        }

                        allowedHungarianPrefixes.Add(prefix);
                    }

                    break;

                case "allowedNamespaceComponents":
                    kvp.AssertIsArray();
                    allowedNamespaceComponents = ImmutableArray.CreateBuilder <string>();
                    allowedNamespaceComponents.AddRange(kvp.Value.AsJsonArray.Select(x => x.ToStringValue(kvp.Key)));
                    break;

                case "includeInferredTupleElementNames":
                    includeInferredTupleElementNames = kvp.ToBooleanValue();
                    break;

                case "tupleElementNameCasing":
                    tupleElementNameCasing = kvp.ToEnumValue <TupleElementNameCase>();
                    break;

                default:
                    break;
                }
            }

            allowCommonHungarianPrefixes ??= AnalyzerConfigHelper.TryGetBooleanValue(analyzerConfigOptions, "stylecop.naming.allowCommonHungarianPrefixes");
            allowedHungarianPrefixes ??= AnalyzerConfigHelper.TryGetStringListValue(analyzerConfigOptions, "stylecop.naming.allowedHungarianPrefixes")
            ?.Where(value => Regex.IsMatch(value, "^[a-z]{1,2}$"))
            .ToImmutableArray()
            .ToBuilder();
            allowedNamespaceComponents ??= AnalyzerConfigHelper.TryGetStringListValue(analyzerConfigOptions, "stylecop.naming.allowedNamespaceComponents")?.ToBuilder();
            includeInferredTupleElementNames ??= AnalyzerConfigHelper.TryGetBooleanValue(analyzerConfigOptions, "stylecop.naming.includeInferredTupleElementNames");
            tupleElementNameCasing ??= AnalyzerConfigHelper.TryGetStringValue(analyzerConfigOptions, "stylecop.naming.tupleElementNameCasing") switch
            {
                "camelCase" => TupleElementNameCase.CamelCase,
                "pascalCase" => TupleElementNameCase.PascalCase,
                _ => null,
            };

            this.AllowCommonHungarianPrefixes = allowCommonHungarianPrefixes.GetValueOrDefault(true);
            this.AllowedHungarianPrefixes     = allowedHungarianPrefixes?.ToImmutable() ?? ImmutableArray <string> .Empty;
            this.AllowedNamespaceComponents   = allowedNamespaceComponents?.ToImmutable() ?? ImmutableArray <string> .Empty;

            this.IncludeInferredTupleElementNames = includeInferredTupleElementNames.GetValueOrDefault(false);
            this.TupleElementNameCasing           = tupleElementNameCasing.GetValueOrDefault(TupleElementNameCase.PascalCase);
        }