using System.Text;

namespace EpsonReceiptPrinter;

public static class EncodingHelper
{
    static EncodingHelper()
    {
        Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
    }

    public static Encoding GetEncodingForCodePage(PrinterCodePage codePage) =>
        codePage switch
        {
            PrinterCodePage.PC865_Nordic => Encoding.GetEncoding(865),
            PrinterCodePage.PC850_Multilingual => Encoding.GetEncoding(850),
            PrinterCodePage.PC858_Euro => Encoding.GetEncoding(858),
            PrinterCodePage.WPC1252 => Encoding.GetEncoding(1252),
            _ => Encoding.GetEncoding(865)
        };
}
