namespace Lactose;

public enum Settings {
    UserRegistrationEnabled, //Enable or disable self user registration
    FolderScanEnabled, // Used to enable/disable folder scanning
    FolderScanInterval, //Interval in minutes for folder scanning
    FileUploadEnabled, //Enable or disable file upload
    FileUploadMaxSize, //Maximum file size for uploads in bytes
}

public static class SettingsExtensions {
    public static string AsString(this Settings setting) {
        return setting switch {
            Settings.UserRegistrationEnabled => "UserRegistrationEnabled",
            Settings.FolderScanEnabled       => "FolderScanEnabled",
            Settings.FolderScanInterval      => "FolderScanInterval",
            Settings.FileUploadEnabled       => "FileUploadEnabled",
            Settings.FileUploadMaxSize       => "FileUploadMaxSize",
            _                                => throw new ArgumentOutOfRangeException(nameof(setting), setting, null)
        };
    }

    public static Type AsValueType(this Settings setting) {
        return setting switch {
            Settings.UserRegistrationEnabled => typeof(bool),
            Settings.FolderScanEnabled       => typeof(bool),
            Settings.FolderScanInterval      => typeof(int),
            Settings.FileUploadEnabled       => typeof(bool),
            Settings.FileUploadMaxSize       => typeof(int),
            _                                => throw new ArgumentOutOfRangeException(nameof(setting), setting, null)
        };
    }
}
