namespace VoiceCat.App.Notifications;

/// <summary>
/// The set of audible event cues. Each maps to a WAV in the app's <c>sounds\</c> folder
/// (copied from <c>assets/sounds/</c> at build time). The same logical set is mirrored in the
/// macOS/iOS clients so feedback stays consistent across platforms.
/// </summary>
public enum SoundEvent
{
    ChannelJoin,    // another user joined my channel
    ChannelLeave,   // another user left my channel
    ChannelRecv,    // channel text message from someone else
    ChannelSent,    // channel text message I sent
    PmRecv,         // private message received
    PmSent,         // private message I sent
    Login,          // connected / authenticated
    Logout,         // clean disconnect
    ConnectionLost, // unexpected disconnect
    VoiceOn,        // my microphone stream started
    VoiceOff,       // my microphone stream stopped
    VaStart,        // my voice-activity began (off by default)
    VaStop,         // my voice-activity ended (off by default)
    Ptt,            // push-to-talk engaged (off by default)
}

internal static class SoundEventExtensions
{
    /// <summary>WAV file name (without directory) for each event, matching assets/sounds/.</summary>
    public static string FileName(this SoundEvent ev) => ev switch
    {
        SoundEvent.ChannelJoin => "channel_join.wav",
        SoundEvent.ChannelLeave => "channel_leave.wav",
        SoundEvent.ChannelRecv => "channel_recv.wav",
        SoundEvent.ChannelSent => "channel_sent.wav",
        SoundEvent.PmRecv => "pm_recv.wav",
        SoundEvent.PmSent => "pm_sent.wav",
        SoundEvent.Login => "login.wav",
        SoundEvent.Logout => "logout.wav",
        SoundEvent.ConnectionLost => "connection_lost.wav",
        SoundEvent.VoiceOn => "voice_on.wav",
        SoundEvent.VoiceOff => "voice_off.wav",
        SoundEvent.VaStart => "va_start.wav",
        SoundEvent.VaStop => "va_stop.wav",
        SoundEvent.Ptt => "ptt.wav",
        _ => throw new ArgumentOutOfRangeException(nameof(ev), ev, null),
    };
}
