using System;

namespace WinRT.BxlComponent.Plugin.BxlMpXamarinSDK.Abstractions
{
    /*
     * Device ID used for mPOS (b-Gate)
     * Command : 0
     * Label Printer : 1 to 9 
     * Local Pos Printer : 10
     * Pos Printer : 11 to 19
     * Unregistered HID Input Device : 20 to 29
     * MSR : 30 to 39
     * Barcode Scanner : 40 to 49
     * Reserved : 50 to 59
     * RFID : 60 to 69
     * Dallas Reader : 70 to 79
     * NFC : 80 to 89
     * Reserved : 90 to 99
     * Unregistered USB Serial Device : 100 to 109
     * Customer Display : 110 to 119
     * USB to Serial : 120 to 129
     * Scale : 130 to 139
     * Reserved : 140 to 254
     * PnP Command : 255
     */
    internal enum MPosDeviceType
    {
        MPOS_DEVICE_CONFIG = 0,
        MPOS_DEVICE_LABEL_PRINTER = 1,
        MPOS_DEVICE_PRINTER = 10,
        MPOS_DEVICE_HID = 20,
        MPOS_DEVICE_MSR = 30,
        MPOS_DEVICE_SCANNER = 40,
        MPOS_DEVICE_RESERVED1 = 50,   //내부용
        MPOS_DEVICE_RFID = 60,
        MPOS_DEVICE_DALLAS_KEY = 70,
        MPOS_DEVICE_NFC = 80,
        MPOS_DEVICE_RESERVED2 = 90,    //내부용
        MPOS_DEVICE_UN_USBSERIAL = 100,   //내부용
        MPOS_DEVICE_KNOWN = 101,
        MPOS_DEVICE_DISPLAY = 110,
        MPOS_DEVICE_USB_TO_SERIAL = 120,
        MPOS_DEVICE_SCALE = 130,
        MPOS_DEVICE_RESERVED3 = 140,	//내부용
        MPOS_DEVICE_CONFIG_LOOKUP = 255
    }

    internal enum MPosInterfaceType
    {
        MPOS_INTERFACE_WIFI = 1,
        MPOS_INTERFACE_ETHERNET = 2,
        MPOS_INTERFACE_BLUETOOTH = 4,
        //MPOS_INTERFACE_BLE          = 8,
        //MPOS_INTERFACE_USB          = 16
    }

    internal enum MPosCommandMode
    {
        MPOS_COMMAND_MODE_BGATE = 0,
        MPOS_COMMAND_MODE_DIRECT = 1
    }

    internal enum MPosPrinterStatus
    {
        /*
         * Print Status Priority
         * 1. Cover Open
         * 2. Paper Empty
         * 3. Error (All errors not defined in this enumeration)
         * 4. Paper Near-End
         */
        MPOS_STATUS_NORMAL = 0,
        //MPOS_STATUS_PRINTER_PAPEREMPTY      = 0x00008000,
        //MPOS_STATUS_PRINTER_COVEROPEN       = 0x00004000,
        //MPOS_STATUS_PRINTER_PAPER_NEAREND   = 0x00002000,
        //MPOS_STATUS_PRINTER_ERROR           = 0x00001000,
        MPOS_STATUS_PRINTER_COVEROPEN = 1,
        MPOS_STATUS_PRINTER_PAPEREMPTY = 2,
        MPOS_STATUS_PRINTER_PAPER_NEAREND = 4,
        MPOS_STATUS_PRINTER_ERROR = 8,

        //MPOS_STATUS_BATT_FULL             = 0,  // same as the "MPOS_STATUS_NORMAL", Use "MPOS_STATUS_NORMAL" instead of "MPOS_STATUS_NORMAL.
        MPOS_STATUS_BATT_HIGH               = 16,
        MPOS_STATUS_BATT_MID                = 32,
        MPOS_STATUS_BATT_LOW                = 64,
        MPOS_STATUS_DRAWER_LOW              = 128,
        MPOS_STATUS_DRAWER_HIGH             = 256,
    }
    internal enum MPosLabelPrinterStatus
    {
        MPOS_LABEL_STATUS_IDLE = 0,
        MPOS_LABEL_STATUS_PRINTER_PAPEREMPTY = 1,
        MPOS_LABEL_STATUS_PRINTER_COVEROPEN = 2,
        MPOS_LABEL_STATUS_PRINTER_CUTTER_JAMMED = 4,
        MPOS_LABEL_STATUS_PRINTER_TPH_OVERHEAT = 8,
        MPOS_LABEL_STATUS_PRINTER_GAP_ERROR = 16,
        MPOS_LABEL_STATUS_PRINTER_RIBBON_END = 32,
        MPOS_LABEL_STATUS_PRINTER_ON_BUILDING_LABEL_TO_BE_PRINTED = 64,
        MPOS_LABEL_STATUS_PRINTER_ON_PRINTING_LABEL = 128,
        MPOS_LABEL_STATUS_PRINTER_ISSUED_LABEL_ISPAUSED = 256
    }
    internal enum MPosAlignment
    {
        MPOS_ALIGNMENT_DEFAULT = -1,
        MPOS_ALIGNMENT_LEFT = 0x00,
        MPOS_ALIGNMENT_CENTER = 0x01,
        MPOS_ALIGNMENT_RIGHT = 0x02
    }
    internal enum MPosPageModeDirection
    {
        MPOS_PRINTER_PD_0 = 0,
        MPOS_PRINTER_PD_LEFT90 = 1,
        MPOS_PRINTER_PD_180 = 2,
        MPOS_PRINTER_PD_RIGHT90 = 3,
    }
    internal enum MPosPageMode
    {
        MPOS_PRINTER_PAGEMODE_OUT = 0,
        MPOS_PRINTER_PAGEMODE_IN = 1,
    }
    internal enum MPosTransactionMode
    {
        MPOS_PRINTER_TRANSACTION_OUT = 0,
        MPOS_PRINTER_TRANSACTION_IN = 1,
    }

    public enum MPosCompressType
    {
        MPOS_IMAGE_COMPRESS_NONE = 0,
        MPOS_IMAGE_COMPRESS_RLE = 1,
        MPOS_IMAGE_COMPRESS_LZMA = 2
    }

    internal enum MPosResult
    {
        MPOS_SUCCESS = 0,      // 성공
        MPOS_ALREADY_OPEN = 1,      // openService를 중복 호출하는 경우(처음 openService가 성공한 경우)
        MPOS_FAIL = 1000,
        MPOS_FAIL_INVALID_INTERFACE = 1001,   // selectInterface에서 interfacetype을 잘못 지정한 경우
        MPOS_FAIL_NO_OPEN = 1002,   // open되지 않은 장치를 사용시도 하는 경우
        MPOS_FAIL_NOT_SUPPORT = 1003,   // 장치에서 지원되지 않은 함수를 호출하는 경우.
        MPOS_FAIL_INVALID_PARAMETER = 1004,   // 파라미터가 범위를 벗어나거나 유효하지 않은 경우.
        MPOS_FAIL_NO_RESPONSE = 1005,   // 장치의 응답이 없는 경우, timeout
        MPOS_FAIL_NOT_CONNECT = 1006,   // openService호출시 B-Gate가 연결되지 않는 경우(port open이 실패한경우)
        MPOS_FAIL_NO_DEVICE = 1007,   // openService호출시 B-Gate에 장치가 연결되지 않은 경우
        MPOS_FAIL_NO_FILE = 1008,   // 이미지 파일 경로에 파일이 없는 경우
        MPOS_FAIL_BUSY = 1009,   // ??? 
        MPOS_FAIL_OPENED = 1010,   // openService함수 호출 이전에 call해야 하는 함수를 openService 이후에 호출하는 경우
        MPOS_FAIL_TIMEOUT = 1011,
        MPOS_FAIL_NOT_SUPPORT_CODEPAGE = 1012,
        MPOS_FAIL_NOT_SUPPORT_ICS = 1013,
        MPOS_PAGEMODE_ALREADY_IN = 1014,
        MPOS_TRANSACTION_ALREADY_IN = 1015,
        MPOS_FAIL_2D_BARCODE = 1016,
        MPOS_FAIL_NOT_SUPPORT_ESCSEQ = 1017,
        MPOS_FAIL_USB_NOT_CONNECTED = 1100,  // SDK 내부용

        // Added by JCLEE for Xamarin SDK, START
        MPOS_FAIL_NO_DEVICE_FOUND = 5000,  // MPosLookup를 이용하여 어떠한 장치도 못찾았을 때
        MPOS_FAIL_NOT_PERMISSION_ALLOWD = 5001,  // Bluetooth 장치에 대한 사용권한이 없을 경우 
        MPOS_FAIL_NOT_SUPPORTED_IMAGE_TYPE = 5002,  // 지원하지 않는 그래픽 이미지 확장자를 가진 경우 
        // END
        MPOS_FAIL_IMAGE_DECODE = 5003,  // base64로 인코딩된 문자열 데이터를 이미지로 변경 실패 시.
    }
}
