namespace Wayne.FDCPOSLibrary
{
    public static class Define
    {
        public static int HeaderLength = 4;
        public static int EncriptionTypeLength = 2;
        public static int MD5EncriptionLength = 16;

        //public static string DateSep = @"-";
        //public static string TimeSep = @":";
        //public static string DateFormat = @"yyyy" + DateSep + "MM" + DateSep + "dd" + " " + "HH" + TimeSep + "mm" + TimeSep + "ss";
        public static string DateFormatV03 = @"yyyy-MM-dd HH:mm:ss";
        public static string DateFormatV05 = @"yyyy-MM-ddTHH:mm:ss";
    }

    public enum NozzleState
    {
        NozzleDown = 0,
        NozzleUp = 1
    }

    public enum LogicalState
    {
        Unlocked = 0,
        Locked = 1
    }

    public enum LogicalDeviceState
    {
        FDC_UNDEFINED = -1,
        FDC_CONFIGURE =			0,
    	FDC_DISABLED =			1,
    	FDC_ERRORSTATE =		2,
    	FDC_FUELLING =			3,
    	FDC_INVALIDSTATE =		4,
    	FDC_LOCKED =			5,
    	FDC_OFFLINE =			6,
    	FDC_OUTOFORDER =		7,
    	FDC_READY =				8,
    	FDC_REQUESTED =			9,
    	FDC_STARTED =			10,
    	FDC_SUSPENDED =			11,
    	FDC_CALLING =			12,
	    FDC_TEST =				13,
	    FDC_SUSPENDED_STARTED  =	14, // Added in FDC version 00.05
	    FDC_SUSPENDED_FUELLING =	15,
	    FDC_CLOSED =			16,
	    FDC_AUTHORISED =		17, // Added in FDC version 00.07
    };


    public class DeviceType
    {
        public const string DT_FuelDispenser = "DSP";
        public const string DT_FuellingPoint = "FP";
        public const string DT_TankLevelGauge = "TLG";
        public const string DT_TankProbe = "TP";
        public const string DT_PricePole = "PP";
        public const string DT_PricePolePoint = "PPP";
        public const string DT_OutdoorPaymentTerminal = "OPT";
        public const string DT_CarWash = "CW";
        public const string DT_CarWashPoint = "CWP";
        public const string DT_CodeGeneratingDevice = "CGD";
        public const string DT_Vir = "VIR";
    }

    public enum DISPTYPE
    {
        DISPTYPE_UNDEF = 0,
        DISPTYPE_PUMP = 1,
        DISPTYPE_OPT = 2,
        DISPTYPE_TANK = 3,
        DISPTYPE_NOZZLE = 4,
        DISPTYPE_POS = 5,
        DISPTYPE_BOS = 6,
        DISPTYPE_MC = 7,
        DISPTYPE_MCLITE = 8,
        DISPTYPE_CARDSERVER = 9,
        DISPTYPE_TANKLEVELDEVICE = 10,
        DISPTYPE_EFTPOSDEVICE = 11,
        DISPTYPE_XCONCENTRATOR = 12,
        DISPTYPE_TANKGROUP = 13,
        DISPTYPE_SURVEILLANCEDEVICE = 14,
        DISPTYPE_FORECOURTCONTROLLER = 15,
        DISPTYPE_CARWASH = 16,
        DISPTYPE_EFTPOSSERVER = 17,
        DISPTYPE_GHOSTSTATION = 18,
        DISPTYPE_MCLOCAL = 19,
        DISPTYPE_ALARMDISPATCHER = 20
    }

    public enum OverallResult
    {
        Success,
        PartialFailure,
        Failure,
        DeviceUnavailable,
        DeviceDisabled,
        WrongDeviceNo,
        TimeOut,
        FormatError,
        ParsingError,
        ValidationError,
        MissingMandatoryData,
        WrongConfiguration,
        NoData,
        NoLogon,
        AuthentificationError
    }

    public enum FuellingState
    {
        Undefined = 0,
        Payable = 1,
        Locked = 2,
        Paid = 3,
        Cleared = 4
    }

    public enum FDCVersion
    {
        V0003 = 0,
        V0005 = 1,
        V0007 = 2,
        V0100 = 3
    }

    public enum ErrorCode
    {
        ERRCD_OK = 0, // No error while action
        ERRCD_NO = 1, //  No error, no action
        ERRCD_CTRLERR, //  Forcourt controller error
        ERRCD_COMMERR, //  Communication error
        ERRCD_NOTSUP, //  Not supported option
        ERRCD_READERR, //  Cannot read
        ERRCD_WRITEERR, //  Cannot write
        ERRCD_NOTPOSSIBLE, //  Action not possible
        ERRCD_BADDEVID, //  Bad device ID
        ERRCD_BADDEVCLASS, //  Bad device class
        ERRCD_NOTALLOWED, //  Action not allowed
        ERRCD_INOP, //  FDC inoperable
        ERRCD_DEVLOCK, //  Device locked
        ERRCD_DEVOFFL, //  Device offline
        ERRCD_BADVAL, //  Bad property value
        ERRCD_NOPERM, //  Action not allowed
        ERRCD_LIMITERR, //  Some limit
        ERRCD_NOZZLELOCK, //  Referenced nozzle locked
        ERRCD_TANKLOCK, //  Referenced tank locked
        ERRCD_PREPAYERR, //  Prepayment not allowed
        ERRCD_BADCONF, //  Bad forecourt configuration
        ERRCD_NOTRANS, //  No fuel transaction in DSP transaction buffer
        ERRCD_NORESTRANS, //  Fuel transaction not reserved for POS
        ERRCD_TRANSLOCKED, //  Fuel transaction yet locked for another POS
        ERRCD_INVTRANS, // Fuel transaction invalid
        ERRCD_DISPHWERR, //  No fuel transaction handling ok message at hardware
        ERRCD_TIMEOUT, //  Fuel transaction timed out
        ERRCD_UPDFAILED, //  Data update on forecourt hardware failed
        ERRCD_NOMONEYPRES, //  Amount-Prepay not allowed
        ERRCD_NOVOLUMEPRES, //  Volume preset not allowed
        ERRCD_GENAUTHLIMIT, //  Maximum number of possible authorisations exceeded (global)
        ERRCD_POSAUTHLIMIT, //  Maximum number of possible authorisations exceeded (per POS)
        ERRCD_OTHER, //  Unspecified error
        ERRCD_MAXSTACKLIMIT, //  Maximum number of unpaind transactions reached (result of failed authorization due to re ached limit).
        ERRCD_FPLOCK, //  Referenced Fuelling point locked
        ERRCD_RESUMEFUEL //  Error resume Fuelling
    }

    public enum POSType
    {
        Generic = 0,
        IXTerminal = 1,
    }

    public class certificateType
    {
        public const string NONE = "NONE";
        public const string MID = "MID";
        public const string ITALY = "ITALY";
    }
}