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

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

        //
        // Events
        //

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

        [OperationContract(Action = "http://www.nrf-arts.org/UnifiedPOS/FiscalPrinterEvents/DirectIOEvent", ReplyAction = "http://www.nrf-arts.org/UnifiedPOS/FiscalPrinterEvents/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/FiscalPrinterEvents/ErrorEvent", ReplyAction = "http://www.nrf-arts.org/UnifiedPOS/FiscalPrinterEvents/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/FiscalPrinterEvents/OutputCompleteEvent", ReplyAction = "http://www.nrf-arts.org/UnifiedPOS/FiscalPrinterEvents/OutputCompleteEventResponse")]
        void OutputCompleteEvent(string ConsumerID, string Source, int EventID, DateTime TimeStamp, int OutputID);

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

    //
    // Common Data Types
    //

    [DataContract(Namespace = "http://www.nrf-arts.org/UnifiedPOS/FiscalPrinterEvents/")]
    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/FiscalPrinterEvents/")]
    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/FiscalPrinterEvents/")]
    public enum ErrorLocus
    {
        [EnumMember]
        EL_INPUT,
        [EnumMember]
        EL_INPUT_DATA,
        [EnumMember]
        EL_OUTPUT,
    }

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

    //
    // Specific Data Types
    //

    //
    // Specific Enumerations
    //

    //
    // Constants
    //

    public class ExtendedError
    {
        public const int EFPTR_COVER_OPEN = 201;
        public const int EFPTR_JRN_EMPTY = 202;
        public const int EFPTR_REC_EMPTY = 203;
        public const int EFPTR_SLP_EMPTY = 204;
        public const int EFPTR_SLP_FORM = 205;
        public const int EFPTR_MISSING_DEVICES = 206;
        public const int EFPTR_WRONG_STATE = 207;
        public const int EFPTR_TECHNICAL_ASSISTANCE = 208;
        public const int EFPTR_CLOCK_ERROR = 209;
        public const int EFPTR_FISCAL_MEMORY_FULL = 210;
        public const int EFPTR_FISCAL_MEMORY_DISCONNECTED = 211;
        public const int EFPTR_FISCAL_TOTALS_ERROR = 212;
        public const int EFPTR_BAD_ITEM_QUANTITY = 215;
        public const int EFPTR_BAD_ITEM_AMOUNT = 214;
        public const int EFPTR_BAD_ITEM_DESCRIPTION = 213;
        public const int EFPTR_RECEIPT_TOTAL_OVERFLOW = 216;
        public const int EFPTR_BAD_VAT = 217;
        public const int EFPTR_BAD_PRICE = 218;
        public const int EFPTR_BAD_DATE = 219;
        public const int EFPTR_NEGATIVE_TOTAL = 220;
        public const int EFPTR_WORD_NOT_ALLOWED = 221;
        public const int EFPTR_BAD_LENGTH = 222;
        public const int EFPTR_MISSING_SET_CURRENCY = 223;
        public const int EFPTR_DAY_END_REQUIRED = 224;
        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 FPTR_SUE_COVER_OK = 12;
        public const int FPTR_SUE_COVER_OPEN = 11;
        public const int FPTR_SUE_REC_COVER_OK = 63;
        public const int FPTR_SUE_REC_COVER_OPEN = 62;
        public const int FPTR_SUE_REC_EMPTY = 24;
        public const int FPTR_SUE_REC_NEAREMPTY = 25;
        public const int FPTR_SUE_REC_PAPEROK = 26;
        public const int FPTR_SUE_SLP_COVER_OK = 65;
        public const int FPTR_SUE_SLP_COVER_OPEN = 64;
        public const int FPTR_SUE_SLP_EMPTY = 27;
        public const int FPTR_SUE_SLP_NEAREMPTY = 28;
        public const int FPTR_SUE_SLP_PAPEROK = 29;
        public const int FPTR_SUE_JRN_COVER_OK = 61;
        public const int FPTR_SUE_JRN_COVER_OPEN = 60;
        public const int FPTR_SUE_JRN_EMPTY = 21;
        public const int FPTR_SUE_JRN_NEAREMPTY = 22;
        public const int FPTR_SUE_JRN_PAPEROK = 23;
        public const int FPTR_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;
    }
}
