using Mediator;
using Musify.Application.Configuration.Responses;
namespace Musify.Application.Configuration
{
/// Reads the parts of that are safe to expose to an
/// unauthenticated client, so it can decide whether to gate the app behind sign-in at all.
public record GetPlaybackPublicConfigQuery : IQuery;
public class GetPlaybackPublicConfigQueryHandler(PlaybackConfiguration playbackConfiguration)
: IQueryHandler
{
public ValueTask Handle(GetPlaybackPublicConfigQuery query, CancellationToken cancellationToken) =>
ValueTask.FromResult(new PlaybackPublicConfigResponse(
playbackConfiguration.AllowAnonymousListening,
playbackConfiguration.AnonymousFragmentSeconds));
}
}