internal List <IFieldSymbol> GetFieldSymbols(NamedTypeSymbolData namedTypeSymbolData)
        {
            var fields = namedTypeSymbolData.NamedTypeSymbol.GetMembers()
                         .Where(s => s is IFieldSymbol)
                         .Cast <IFieldSymbol>()
                         .ToList();

            return(fields);
        }
        internal void GenerateStringEnum(
            NamedTypeSymbolData namedTypeSymbolData,
            INamedTypeSymbol flagsAttributeSymbol,
            INamedTypeSymbol enumLabelAttributeSymbol,
            string enumTargetPath)
        {
            var flagsAttributeData = namedTypeSymbolData.NamedTypeSymbol.GetAttributes().FirstOrDefault(a =>
                                                                                                        a.AttributeClass?.Equals(flagsAttributeSymbol, SymbolEqualityComparer.Default) == true);

            if (flagsAttributeData != null)
            {
                throw new StringEnumsCantBeUsedWithFlagsAttributeException();
            }

            var typeName = namedTypeSymbolData.Name;

            var targetFile = GetTargetFile(enumTargetPath, typeName);
            var fields     = GetFieldSymbols(namedTypeSymbolData);

            var sb = new StringBuilder();

            sb.AppendLine(CodeGenerator.Header).AppendLine();
            sb.AppendLine("import { EnumHelper } from './_enum-helper';").AppendLine();
            sb.AppendLine($"export enum {typeName} {{");
            foreach (var fieldSymbol in fields)
            {
                sb.AppendLine($"  {fieldSymbol.Name} = '{fieldSymbol.Name}',");
            }

            sb.AppendLine("}").AppendLine();

            sb.AppendLine($"export namespace {typeName} {{").AppendLine();

            GenerateGetLabel(
                sb,
                enumLabelAttributeSymbol,
                typeName,
                fields);

            sb.AppendLine(
                $@"  export function getKeys(): string[] {{
    return EnumHelper.getKeys({typeName});
  }}").AppendLine();

            sb.AppendLine(
                $@"  export function getValues(): string[] {{
    return EnumHelper.getValues({typeName}) as string[];
  }}").AppendLine();

            sb.AppendLine().AppendLine("}").AppendLine();

#pragma warning disable SCS0018 // Path traversal: injection possible in {1} argument passed to '{0}'
            File.WriteAllText(targetFile, sb.ToString(), CodeGenerator.Uft8WithoutBomEncoding);
#pragma warning restore SCS0018 // Path traversal: injection possible in {1} argument passed to '{0}'
        }
        internal void GenerateHasFlag(NamedTypeSymbolData namedTypeSymbolData, INamedTypeSymbol flagsAttributeSymbol, StringBuilder sb)
        {
            if (!namedTypeSymbolData.NamedTypeSymbol.GetAttributes().Any(ad => ad.AttributeClass?.Equals(
                                                                             flagsAttributeSymbol,
                                                                             SymbolEqualityComparer.Default) == true))
            {
                return;
            }

            var typeName = namedTypeSymbolData.Name;

            sb.AppendLine(
                @$ "  export function hasFlag(value: {typeName}, expected: {typeName}) {{
    return (value && expected) === expected;
  }}").AppendLine();
        internal void GenerateNormalEnum(
            NamedTypeSymbolData namedTypeSymbolData,
            INamedTypeSymbol flagsAttributeSymbol,
            INamedTypeSymbol enumLabelAttributeSymbol,
            string enumTargetPath)
        {
            var typeName   = namedTypeSymbolData.Name;
            var targetFile = GetTargetFile(enumTargetPath, typeName);
            var fields     = GetFieldSymbols(namedTypeSymbolData);

            var sb = new StringBuilder();

            sb.AppendLine(CodeGenerator.Header).AppendLine();
            sb.AppendLine("import { EnumHelper } from './_enum-helper';").AppendLine();
            sb.AppendLine($"export enum {typeName} {{");
            foreach (var fieldSymbol in fields)
            {
                sb.AppendLine($"  {fieldSymbol.Name} = {fieldSymbol.ConstantValue},");
            }

            sb.AppendLine("}").AppendLine();

            sb.AppendLine($"export namespace {typeName} {{").AppendLine();

            GenerateGetLabel(
                sb,
                enumLabelAttributeSymbol,
                typeName,
                fields);

            sb.AppendLine(
                $@"  export function getKeys(): string[] {{
    return EnumHelper.getKeys({typeName});  
  }}").AppendLine();

            sb.AppendLine(
                $@"  export function getValues(): {typeName}[] {{
    return EnumHelper.getValues({typeName});
  }}").AppendLine();

            GenerateHasFlag(namedTypeSymbolData, flagsAttributeSymbol, sb);

            sb.AppendLine().AppendLine("}").AppendLine();

#pragma warning disable SCS0018 // Path traversal: injection possible in {1} argument passed to '{0}'
            File.WriteAllText(targetFile, sb.ToString(), CodeGenerator.Uft8WithoutBomEncoding);
#pragma warning restore SCS0018 // Path traversal: injection possible in {1} argument passed to '{0}'
        }