using System.ComponentModel;
using System.Net.Mime;
namespace MediaBrowser.Model.Drawing;
///
/// Extension class for the enum.
///
public static class ImageFormatExtensions
{
///
/// Returns the correct mime type for this .
///
/// This .
/// The is an invalid enumeration value.
/// The correct mime type for this .
public static string GetMimeType(this ImageFormat format)
=> format switch
{
ImageFormat.Bmp => "image/bmp",
ImageFormat.Gif => MediaTypeNames.Image.Gif,
ImageFormat.Jpg => MediaTypeNames.Image.Jpeg,
ImageFormat.Png => "image/png",
ImageFormat.Webp => "image/webp",
_ => throw new InvalidEnumArgumentException(nameof(format), (int)format, typeof(ImageFormat))
};
}