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

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

        //
        // Events
        //

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

        [OperationContract(Action = "http://www.nrf-arts.org/UnifiedPOS/CoinAcceptorEvents/DirectIOEvent", ReplyAction = "http://www.nrf-arts.org/UnifiedPOS/CoinAcceptorEvents/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/CoinAcceptorEvents/ErrorEvent", ReplyAction = "http://www.nrf-arts.org/UnifiedPOS/CoinAcceptorEvents/ErrorEventResponse")]
//        ErrorResponse ErrorEvent(string ConsumerID, string ConsumerID, string Source, int EventID, DateTime TimeStamp, ErrorCode ErrorCode, int ErrorCodeExtended, ErrorLocus ErrorLocus, ErrorResponse ErrorResponse);

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

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

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

    //
    // Common Data Types
    //

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

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

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

    //
    // Common Enumerations
    //

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

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

    //
    // Specific Data Types
    //

    //
    // Specific Enumerations
    //

    //
    // Constants
    //

    public class Status
    {
        public const int CACC_STATUS_FULL = 21;
        public const int CACC_STATUS_NEARFULL = 22;
        public const int CACC_STATUS_FULLOK = 23;
        public const int CACC_STATUS_JAM = 31;
        public const int CACC_STATUS_JAMOK = 32;
        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;
    }
}
