namespace ZB.MOM.WW.OtOpcUa.Cluster;

/// <summary>Loads embedded HOCON configuration resources.</summary>
public static class HoconLoader
{
    private const string ResourceName = "ZB.MOM.WW.OtOpcUa.Cluster.Resources.akka.conf";

    /// <summary>Loads the base Akka configuration from embedded resources.</summary>
    /// <returns>The loaded HOCON configuration as a string.</returns>
    public static string LoadBaseConfig()
    {
        using var reader = new StreamReader(
            typeof(HoconLoader).Assembly.GetManifestResourceStream(ResourceName)
                ?? throw new InvalidOperationException(
                    $"Embedded resource '{ResourceName}' not found. Verify EmbeddedResource glob in csproj."));
        return reader.ReadToEnd();
    }
}
