using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;

namespace UnifiedPOS.POSPrinterEvents.V1_4
{
    [ServiceContract(Namespace = "http://www.nrf-arts.org/UnifiedPOS/POSPrinterEvents/")]
    public interface POSPrinterEvent
    {

        //
        // Events
        //

        // [OperationContract(Action = "http://www.nrf-arts.org/UnifiedPOS/POSPrinterEvents/DataEvent", ReplyAction = "http://www.nrf-arts.org/UnifiedPOS/POSPrinterEvents/DataEventResponse")]
        // void DataEvent(string ConsumerID, string Source, int EventID, DateTime TimeStamp, int Status);

        [OperationContract(Action = "http://www.nrf-arts.org/UnifiedPOS/POSPrinterEvents/DirectIOEvent", ReplyAction = "http://www.nrf-arts.org/UnifiedPOS/POSPrinterEvents/DirectIOEventResponse")]
        DirectIOData DirectIOEvent(string ConsumerID, string Source, int EventID, DateTime TimeStamp, int EventNumber, int Data, object Obj);

        [OperationContract(Action = "http://www.nrf-arts.org/UnifiedPOS/POSPrinterEvents/ErrorEvent", ReplyAction = "http://www.nrf-arts.org/UnifiedPOS/POSPrinterEvents/ErrorEventResponse")]
        ErrorResponse ErrorEvent(string ConsumerID, string Source, int EventID, DateTime TimeStamp, ErrorCode ErrorCode, int ErrorCodeExtended, ErrorLocus ErrorLocus, ErrorResponse ErrorResponse);

        [OperationContract(Action = "http://www.nrf-arts.org/UnifiedPOS/POSPrinterEvents/OutputCompleteEvent", ReplyAction = "http://www.nrf-arts.org/UnifiedPOS/POSPrinterEvents/OutputCompleteEventResponse")]
        void OutputCompleteEvent(string ConsumerID, string Source, int EventID, DateTime TimeStamp, int OutputID);

        [OperationContract(Action = "http://www.nrf-arts.org/UnifiedPOS/POSPrinterEvents/StatusUpdateEvent", ReplyAction = "http://www.nrf-arts.org/UnifiedPOS/POSPrinterEvents/StatusUpdateEventResponse")]
        void StatusUpdateEvent(string ConsumerID, string Source, int EventID, DateTime TimeStamp, int Status);
    }

    //
    // Common Data Types
    //

    [DataContract(Namespace = "http://www.nrf-arts.org/UnifiedPOS/POSPrinterEvents/")]
    public class DirectIOData
    {
        [DataMember]
        public int Data { get; set; }
        [DataMember]
        public object Obj { get; set; }
    }

    //
    // Common Enumerations
    //

    [DataContract(Namespace = "http://www.nrf-arts.org/UnifiedPOS/POSPrinterEvents/")]
    public enum ErrorCode
    {
        [EnumMember]
        E_CLOSED,
        [EnumMember]
        E_CLAIMED,
        [EnumMember]
        E_NOTCLAIMED,
        [EnumMember]
        E_NOSERVICE,
        [EnumMember]
        E_DISABLED,
        [EnumMember]
        E_ILLEGAL,
        [EnumMember]
        E_NOHARDWARE,
        [EnumMember]
        E_OFFLINE,
        [EnumMember]
        E_NOEXIST,
        [EnumMember]
        E_EXISTS,
        [EnumMember]
        E_FAILURE,
        [EnumMember]
        E_TIMEOUT,
        [EnumMember]
        E_BUSY,
        [EnumMember]
        E_EXTENDED,
        [EnumMember]
        E_DEPRECATED,
    }

    [DataContract(Namespace = "http://www.nrf-arts.org/UnifiedPOS/POSPrinterEvents/")]
    public enum ErrorLocus
    {
        [EnumMember]
        EL_INPUT,
        [EnumMember]
        EL_INPUT_DATA,
        [EnumMember]
        EL_OUTPUT,
    }

    [DataContract(Namespace = "http://www.nrf-arts.org/UnifiedPOS/POSPrinterEvents/")]
    public enum ErrorResponse
    {
        [EnumMember]
        ER_CLEAR,
        [EnumMember]
        ER_CONTINUEINPUT,
        [EnumMember]
        ER_RETRY,
    }

    //
    // Specific Data Types
    //

    //
    // Specific Enumerations
    //

    //
    // Constants
    //

    /*
    public class Constants
    {
        public const int ExtendedErrorBadFormat = 207;
        public const int ExtendedErrorCoverOpen = 201;
        public const int ExtendedErrorFirmwareBadFile = 281;
        public const int ExtendedErrorJournalCartridgeEmpty = 209;
        public const int ExtendedErrorJournalCartridgeRemoved = 208;
        public const int ExtendedErrorJournalEmpty = 202;
        public const int ExtendedErrorJournalHeadCleaning = 210;
        public const int ExtendedErrorReceiptCartridgeEmpty = 212;
        public const int ExtendedErrorReceiptCartridgeRemoved = 211;
        public const int ExtendedErrorReceiptEmpty = 203;
        public const int ExtendedErrorReceiptHeadCleaning = 213;
        public const int ExtendedErrorSlipCartridgeEmpty = 215;
        public const int ExtendedErrorSlipCartridgeRemoved = 214;
        public const int ExtendedErrorSlipEmpty = 204;
        public const int ExtendedErrorSlipForm = 205;
        public const int ExtendedErrorSlipHeadCleaning = 216;
        public const int ExtendedErrorStatistics = 280;
        public const int ExtendedErrorStatisticsDependency = 282;
        public const int ExtendedErrorTooBig = 206;
        public const int StatusCoverOK = 12;
        public const int StatusCoverOpen = 11;
        public const int StatusIdle = 1001;
        public const int StatusJournalCartridgeEmpty = 41;
        public const int StatusJournalCartridgeNearEmpty = 42;
        public const int StatusJournalCartridgeOK = 44;
        public const int StatusJournalCoverOK = 61;
        public const int StatusJournalCoverOpen = 60;
        public const int StatusJournalEmpty = 21;
        public const int StatusJournalHeadCleaning = 43;
        public const int StatusJournalNearEmpty = 22;
        public const int StatusJournalPaperOK = 23;
        public const int StatusPowerOff = 2002;
        public const int StatusPowerOffline = 2003;
        public const int StatusPowerOffOffline = 2004;
        public const int StatusPowerOnline = 2001;
        public const int StatusReceiptCartridgeEmpty = 45;
        public const int StatusReceiptCartridgeNearEmpty = 46;
        public const int StatusReceiptCartridgeOK = 48;
        public const int StatusReceiptCoverOK = 63;
        public const int StatusReceiptCoverOpen = 62;
        public const int StatusReceiptEmpty = 24;
        public const int StatusReceiptHeadCleaning = 47;
        public const int StatusReceiptNearEmpty = 25;
        public const int StatusReceiptPaperOK = 26;
        public const int StatusSlipCartridgeEmpty = 49;
        public const int StatusSlipCartridgeNearEmpty = 50;
        public const int StatusSlipCartridgeOK = 52;
        public const int StatusSlipCoverOK = 65;
        public const int StatusSlipCoverOpen = 64;
        public const int StatusSlipEmpty = 27;
        public const int StatusSlipHeadCleaning = 51;
        public const int StatusSlipNearEmpty = 28;
        public const int StatusSlipPaperOK = 29;
        public const int StatusUpdateFirmwareComplete = 2200;
        public const int StatusUpdateFirmwareCompleteDeviceNotRestored = 2205;
        public const int StatusUpdateFirmwareFailedDeviceNeedsFirmware = 2203;
        public const int StatusUpdateFirmwareFailedDeviceOk = 2201;
        public const int StatusUpdateFirmwareFailedDeviceUnknown = 2204;
        public const int StatusUpdateFirmwareFailedDeviceUnrecoverable = 2202;
        public const int StatusUpdateFirmwareProgress = 2100;
    }
    */

    public class ExtendedError
    {
        public const int EPTR_COVER_OPEN = 201;
        public const int EPTR_JRN_EMPTY = 202;
        public const int EPTR_REC_EMPTY = 203;
        public const int EPTR_SLP_EMPTY = 204;
        public const int EPTR_SLP_FORM = 205;
        public const int EPTR_TOOBIG = 206;
        public const int EPTR_BADFORMAT = 207;
        public const int EPTR_JRN_CARTRIDGE_REMOVED = 208;
        public const int EPTR_JRN_CARTRIDGE_EMPTY = 209;
        public const int EPTR_JRN_HEAD_CLEANING = 210;
        public const int EPTR_REC_CARTRIDGE_REMOVED = 211;
        public const int EPTR_REC_CARTRIDGE_EMPTY = 212;
        public const int EPTR_REC_HEAD_CLEANING = 213;
        public const int EPTR_SLP_CARTRIDGE_REMOVED = 214;
        public const int EPTR_SLP_CARTRIDGE_EMPTY = 215;
        public const int EPTR_SLP_HEAD_CLEANING = 216;
        public const int ESTATS_ERROR = 280;
        public const int EFIRMWARE_BAD_FILE = 281;
        public const int ESTATS_DEPENDENCY = 282;
    }

    public class Status
    {
        public const int PTR_SUE_COVER_OPEN = 11;
        public const int PTR_SUE_COVER_OK = 12;
        public const int PTR_SUE_JRN_EMPTY = 21;
        public const int PTR_SUE_JRN_NEAREMPTY = 22;
        public const int PTR_SUE_JRN_PAPEROK = 23;
        public const int PTR_SUE_REC_EMPTY = 24;
        public const int PTR_SUE_REC_NEAREMPTY = 25;
        public const int PTR_SUE_REC_PAPEROK = 26;
        public const int PTR_SUE_SLP_EMPTY = 27;
        public const int PTR_SUE_SLP_NEAREMPTY = 28;
        public const int PTR_SUE_SLP_PAPEROK = 29;
        public const int PTR_SUE_JRN_CARTRIDGE_EMPTY = 41;
        public const int PTR_SUE_JRN_CARTRIDGE_NEAREMPTY = 42;
        public const int PTR_SUE_JRN_HEAD_CLEANING = 43;
        public const int PTR_SUE_JRN_CARTRIDGE_OK = 44;
        public const int PTR_SUE_REC_CARTRIDGE_EMPTY = 45;
        public const int PTR_SUE_REC_CARTRIDGE_NEAREMPTY = 46;
        public const int PTR_SUE_REC_HEAD_CLEANING = 47;
        public const int PTR_SUE_REC_CARTRIDGE_OK = 48;
        public const int PTR_SUE_SLP_CARTRIDGE_EMPTY = 49;
        public const int PTR_SUE_SLP_CARTRIDGE_NEAREMPTY = 50;
        public const int PTR_SUE_SLP_HEAD_CLEANING = 51;
        public const int PTR_SUE_SLP_CARTRIDGE_OK = 52;
        public const int PTR_SUE_JRN_COVER_OPEN = 60;
        public const int PTR_SUE_JRN_COVER_OK = 61;
        public const int PTR_SUE_REC_COVER_OPEN = 62;
        public const int PTR_SUE_REC_COVER_OK = 63;
        public const int PTR_SUE_SLP_COVER_OPEN = 64;
        public const int PTR_SUE_SLP_COVER_OK = 65;
        public const int PTR_SUE_IDLE = 1001;
        public const int SUE_POWER_ONLINE = 2001;
        public const int SUE_POWER_OFF = 2002;
        public const int SUE_POWER_OFFLINE = 2003;
        public const int SUE_POWER_OFF_OFFLINE = 2004;
        public const int SUE_UF_COMPLETE = 2200;
        public const int SUE_UF_PROGRESS = 2100;
        public const int SUE_UF_FAILED_DEV_OK = 2201;
        public const int SUE_UF_FAILED_DEV_UNRECOVERABLE = 2202;
        public const int SUE_UF_FAILED_DEV_UNKNOWN = 2204;
        public const int SUE_UF_COMPLETE_DEV_NOT_RESTORED = 2205;
        public const int SUE_UF_FAILED_DEV_NEEDS_FIRMWARE = 2203;
    }
}
