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

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

        //
        // Events
        //

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

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

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

        [OperationContract(Action = "http://www.nrf-arts.org/UnifiedPOS/ElectronicValueRWEvents/DataContainedEvent", ReplyAction = "http://www.nrf-arts.org/UnifiedPOS/BillAcceptorEvents/DataContainedEventResponse")]
        DataContainedEventData DataContainedEvent(string ConsumerID, string Source, int EventID, DateTime TimeStamp, int Status, ParameterList Parameters);

        [OperationContract(Action = "http://www.nrf-arts.org/UnifiedPOS/ElectronicValueRWEvents/TransitionEvent", ReplyAction = "http://www.nrf-arts.org/UnifiedPOS/BillAcceptorEvents/TransitionEventResponse")]
        TransitionData TransitionEvent(string ConsumerID, string Source, int EventID, DateTime TimeStamp, int EventNumber, int Data, string Str);
    }

    //
    // Common Data Types
    //

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

    [DataContract(Namespace = "http://www.nrf-arts.org/UnifiedPOS/ElectronicValueRWEvents/")]
    public class DataContainedEventData
    {
        [DataMember]
        public int EventID { get; set; }
        [DataMember]
        public bool SetDataEventEnabled { get; set; }
        [DataMember]
        public bool CallClearInputProperties { get; set; }
    }

    [DataContract(Namespace = "http://www.nrf-arts.org/UnifiedPOS/ElectronicValueRWEvents/")]
    public class TransitionData
    {
        [DataMember]
        public int Data { get; set; }
        [DataMember]
        public string Str { get; set; }
    }

    [CollectionDataContract(Namespace = "http://www.nrf-arts.org/UnifiedPOS/ElectronicValueRWEvents/", ItemName = "Parameter")]
    public class ParameterList : Dictionary<string, object>
    {
    }

    //
    // Common Enumerations
    //

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

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

    //
    // Specific Data Types
    //

    //
    // Specific Enumerations
    //

    //
    // Constants
    //

    /*
    public class Constants
    {
        public const int ExtendedErrorCenterError = 203;
        public const int ExtendedErrorCommandError = 204;
        public const int ExtendedErrorCommunicationError = 206;
        public const int ExtendedErrorDailyLogOverflow = 208;
        public const int ExtendedErrorDeficient = 209;
        public const int ExtendedErrorFirmwareBadFile = 281;
        public const int ExtendedErrorLogOverflow = 207;
        public const int ExtendedErrorNoCard = 201;
        public const int ExtendedErrorOverdeposit = 210;
        public const int ExtendedErrorRelease = 202;
        public const int ExtendedErrorReset = 205;
        public const int ExtendedErrorStatistics = 280;
        public const int ExtendedErrorStatisticsDependency = 282;
        public const int StatusCardCaptured = 24;
        public const int StatusCardDetected = 22;
        public const int StatusCardEntered = 23;
        public const int StatusLogFull = 13;
        public const int StatusLogNearFull = 12;
        public const int StatusLogOk = 11;
        public const int StatusNoCard = 21;
        public const int StatusPowerOff = 2002;
        public const int StatusPowerOffline = 2003;
        public const int StatusPowerOffOffline = 2004;
        public const int StatusPowerOnline = 2001;
        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 EEVRW_NOCARD = 201;
        public const int EEVRW_RELEASE = 202;
        public const int EEVRW_CENTERERROR = 203;
        public const int EEVRW_COMMANDERROR = 204;
        public const int EEVRW_RESET = 205;
        public const int EEVRW_COMMUNICATIONERROR = 206;
        public const int EEVRW_LOGOVERFLOW = 207;
        public const int EEVRW_DAILYLOGOVERFLOW = 208;
        public const int EEVRW_DEFICIENT = 209;
        public const int EEVRW_OVERDEPOSIT = 210;
        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 EVRW_SUE_LS_OK = 11;
        public const int EVRW_SUE_LS_NEARFULL = 12;
        public const int EVRW_SUE_LS_FULL = 13;
        public const int EVRW_SUE_DS_NOCARD = 21;
        public const int EVRW_SUE_DS_DETECTED = 22;
        public const int EVRW_SUE_DS_ENTERED = 23;
        public const int EVRW_SUE_DS_CAPTURED = 24;
        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;
    }
}
