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

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

        //
        // Events
        //

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

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

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

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

        [OperationContract(Action = "http://www.nrf-arts.org/UnifiedPOS/BiometricsEvents/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/BiometricsEvents/")]
    public class DirectIOData
    {
        [DataMember]
        public int Data { get; set; }
        [DataMember]
        public object Obj { get; set; }
    }

    [DataContract(Namespace = "http://www.nrf-arts.org/UnifiedPOS/BiometricsEvents/")]
    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/BiometricsEvents/", ItemName = "Parameter")]
    public class ParameterList : Dictionary<string, object>
    {
    }

    //
    // Common Enumerations
    //

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

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

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

    //
    // Specific Data Types
    //

    //
    // Specific Enumerations
    //

    //
    // Constants
    //

    public class ExtendedError
    {
        public const int EFIRMWARE_BAD_FILE = 281;
        public const int ESTATS_ERROR = 280;
        public const int ESTATS_DEPENDENCY = 282;
    }

    public class Status
    {
        public const int BIO_SUE_RAW_DATA = 1;
        public const int BIO_SUE_MOVE_LEFT = 2;
        public const int BIO_SUE_MOVE_RIGHT = 3;
        public const int BIO_SUE_MOVE_DOWN = 4;
        public const int BIO_SUE_MOVE_UP = 5;
        public const int BIO_SUE_MOVE_CLOSER = 6;
        public const int BIO_SUE_MOVE_AWAY = 7;
        public const int BIO_SUE_MOVE_BACKWARD = 8;
        public const int BIO_SUE_MOVE_FORWARD = 9;
        public const int BIO_SUE_MOVE_SLOWER = 10;
        public const int BIO_SUE_MOVE_FASTER = 11;
        public const int BIO_SUE_SENSOR_DIRTY = 12;
        public const int BIO_SUE_FAILED_READ = 1000;
        public const int BIO_SUE_SENSOR_READY = 1001;
        public const int BIO_SUE_SENSOR_COMPLETE = 1002;
        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;
    }

    public class DataEventStatus
    {
        public const int Enroll = 1;
        public const int Verify = 2;
    }
}
