using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System;

namespace IOB_UT_NEXT
{
    /// <summary>
    /// Modalità verifica condizioni booleane
    /// </summary>
    public enum boolCheckMode
    {
        /// <summary>
        /// AND: tutte vere -&gt; true
        /// </summary>
        AND = 0,

        /// <summary>
        /// OR: almeno una vera
        /// </summary>
        OR
    }

    /// <summary>
    /// Modalità di calcolo tra serie di valori
    /// </summary>
    public enum calcMode
    {
        /// <summary>
        /// NEssun processing
        /// </summary>
        None = 0,

        /// <summary>
        /// somma dei valori
        /// </summary>
        sum,

        /// <summary>
        /// produttoria
        /// </summary>
        prod
    }

    /// <summary>
    /// Elenco MODI CNC
    /// </summary>
    public enum CNC_MODE
    {
        /// <summary>
        /// Non definito
        /// </summary>
        ND = 0,

        /// <summary>
        /// AUTOMATICO
        /// </summary>
        AUTO,

        /// <summary>
        /// EDIT (MEMORY EDIT)
        /// </summary>
        EDIT,

        /// <summary>
        /// MEN (MEMORY OPERATION)
        /// </summary>
        MEN,

        /// <summary>
        /// MDI (MANUAL DATA INPUT)
        /// </summary>
        MDI,

        /// <summary>
        /// HANDLE/INC (MANUAL HANDLE / INCREMENTAL FEED)
        /// </summary>
        HANDLE_INC,

        /// <summary>
        /// HOME
        /// </summary>
        HOME,

        /// <summary>
        /// JOG (MANUAL CONTINUOUS FEED)
        /// </summary>
        JOG,

        /// <summary>
        /// JOG MAN
        /// </summary>
        JOG_MAN,

        /// <summary>
        /// JOG_INC
        /// </summary>
        JOG_INC,

        /// <summary>
        /// PROFILE
        /// </summary>
        PROFILE,

        /// <summary>
        /// SEMI
        /// </summary>
        SEMI,

        /// <summary>
        /// THND (TEACH IN HANDLE)
        /// </summary>
        THND,

        /// <summary>
        /// TJOG (TEACH IN JOG)
        /// </summary>
        TJOG,

        /// <summary>
        /// RMT (DNC OPERATION)
        /// </summary>
        RMT,

        /// <summary>
        /// REF (MANUAL REFERENCE POSITION RETURN)
        /// </summary>
        REF
    }

    /// <summary>
    /// Elenco STATI CNC OSAI
    /// </summary>
    public enum CNC_STATUS_OSAI
    {
        IDLE = 1,
        CYCLE,
        HODA,
        RUNH,
        HRUN,
        ERRO,
        WAIT,
        RESET,
        EMERG,
        INPUT
    }

    /// <summary>
    /// Tipologie di DUMP memoria
    /// </summary>
    public enum dumpType
    {
        /// <summary>
        /// Salvataggio all'avvio aree memoria (con sovrascrittura)
        /// </summary>
        STARTUP,

        /// <summary>
        /// Campionamento periodico
        /// </summary>
        SAMPLE
    }

    /// <summary>
    /// Tipo di ciclo da processare
    /// </summary>
    public enum gatherCycle
    {
        /// <summary>
        /// Very High Frequency (solo x invii...)
        /// </summary>
        VHF,

        /// <summary>
        /// lettura dati ad alta frequenza
        /// </summary>
        HF,

        /// <summary>
        /// lettura dati standard
        /// </summary>
        MF,

        /// <summary>
        /// lettura dati bassa freq
        /// </summary>
        LF,

        /// <summary>
        /// lettura dati bassissima priorità (re-sync stato allarmi)
        /// </summary>
        VLF
    }

    /// <summary>
    /// Tipologia file da importare
    /// </summary>
    [JsonConverter(typeof(StringEnumConverter))]
    public enum ImportType
    {
        ND = 0,
        CSV,
        Excel
    }

    /// <summary>
    /// Tipo di IOB (SW)
    /// </summary>
    public enum IobSwType
    {
        /// <summary>
        /// Non definito
        /// </summary>
        ND,

        /// <summary>
        /// IOB rPI
        /// </summary>
        rPi,

        /// <summary>
        /// IOB Windows
        /// </summary>
        WIN
    }

    /// <summary>
    /// Modalità gestione setup macchina
    /// </summary>
    public enum MachineSetupMode
    {
        ND = 0,

        /// <summary>
        /// Modalità Mecolpress (3 parametri IN, se variati --&gt; porto a 1 la variabile di controllo)
        /// </summary>
        MECOLPRESS = 1
    }

    /// <summary>
    /// Tipo di memoria Modbus
    /// </summary>
    public enum modbusMemType
    {
        Coil = 0,
        DiscreteInput = 1,
        NotDefined = 2,
        InputRegister = 3,
        HoldingRegister = 4
    }

    [JsonConverter(typeof(StringEnumConverter))]
    public enum OutDataType
    {
        ParamTaglioUstd,
        RegGiacenze
    }

    /// <summary>
    /// Modalità ritorno risultati
    /// </summary>
    [JsonConverter(typeof(StringEnumConverter))]
    public enum ReturnMode
    {
        ND = 0,
        Console,
        File,
        Redis
    }

    /// <summary>
    /// Modalità avvio APP IOB-WIN
    /// </summary>
    public enum StartMode
    {
        /// <summary>
        /// modalità standard (standalone, multi IOB)
        /// </summary>
        STD = 0,

        /// <summary>
        /// Modalità managed (da IOB-MAN)
        /// </summary>
        MAN = 1,

        /// <summary>
        /// Modalità update (per aggiornare IOB-WIN) senza IOB
        /// </summary>
        UPD = 2
    }

    /// <summary>
    /// StFlag32: set di 32 bit (4 word) contente semaforo di variabili
    /// </summary>
    [Flags]
    public enum StFlag32 : int
    {
        NONE = 0,
        B00 = 1 << 0,
        B01 = 1 << 1,
        B02 = 1 << 2,
        B03 = 1 << 3,
        B04 = 1 << 4,
        B05 = 1 << 5,
        B06 = 1 << 6,
        B07 = 1 << 7,
        B08 = 1 << 8,
        B09 = 1 << 9,
        B10 = 1 << 10,
        B11 = 1 << 11,
        B12 = 1 << 12,
        B13 = 1 << 13,
        B14 = 1 << 14,
        B15 = 1 << 15,
        B16 = 1 << 16,
        B17 = 1 << 17,
        B18 = 1 << 18,
        B19 = 1 << 19,
        B20 = 1 << 20,
        B21 = 1 << 21,
        B22 = 1 << 22,
        B23 = 1 << 23,
        B24 = 1 << 24,
        B25 = 1 << 25,
        B26 = 1 << 26,
        B27 = 1 << 27,
        B28 = 1 << 28,
        B29 = 1 << 29,
        B30 = 1 << 30,
        B31 = 1 << 31
    }

    /// <summary>
    /// StFlag8: set di 8 bit (1 word) contente semaforo di variabili
    /// </summary>
    [Flags]
    public enum StFlag8 : int
    {
        NONE = 0,
        B0 = 1 << 0,
        B1 = 1 << 1,
        B2 = 1 << 2,
        B3 = 1 << 3,
        B4 = 1 << 4,
        B5 = 1 << 5,
        B6 = 1 << 6,
        B7 = 1 << 7
    }

    /// <summary>
    /// Tipologia di adapters ammessi
    /// </summary>
    public enum tipoAdapter
    {
        /// <summary>
        /// Adapter SIMULAZIONE
        /// </summary>
        SIMULA,

        /// <summary>
        /// Adapter Beckhoff
        /// </summary>
        BECKHOFF,

        /// <summary>
        /// Adapter Beckhoff x CPA (selezionatrici ex Jetco)
        /// </summary>
        BECKHOFF_CPA,

        /// <summary>
        /// adapter FANUC
        /// </summary>
        FANUC,

        /// <summary>
        /// File Based exchange generic adapter
        /// </summary>
        FILE_GEN,

        /// <summary>
        /// File Based exchange Euromap63
        /// </summary>
        FILE_EUROM63,

        ///// <summary>
        ///// File Based exchange SCM Xylog
        ///// </summary>
        //FILE_XYLOG,

        /// <summary>
        /// File Based Log file analisys per Soitaab
        /// </summary>
        FILE_SOITAAB,

        /// <summary>
        /// Gestione sync FTP
        /// </summary>
        FTP,

        /// <summary>
        /// Adapter KAWASAKI e-controller
        /// </summary>
        KAWASAKI,

        /// <summary>
        /// Adapter Icoel per DB (barcode, tracciatura, produzione,...)
        /// </summary>
        IcoelDb,

        /// <summary>
        /// Adapter Icoel per WS SOAP (sizer)
        /// </summary>
        IcoelSoap,

        /// <summary>
        /// Adapter non specificato
        /// </summary>
        ND,

        /// <summary>
        /// Adapter MITSUBISHI con EZCnc lib
        /// </summary>
        MITSUBISHI,

        /// <summary>
        /// Adapter ModBus TCP generico
        /// </summary>
        MODBUS_TCP,

        /// <summary>
        /// Adapter ModBus TCP versione Cedax (Giacovelli)
        /// </summary>
        MODBUS_TCP_CEDAX,

        /// <summary>
        /// Adapter ModBus TCP versione Centerfrigo (Giacovelli)
        /// </summary>
        MODBUS_TCP_CENTERFRIGO,

        /// <summary>
        /// Adapter modbus (+ file) x FIMAT (Tenditalia)
        /// </summary>
        MODBUS_TCP_FIMAT,

        /// <summary>
        /// Adapter modbus x lettori potenza FRER (Jetco ...)
        /// </summary>
        MODBUS_TCP_FRER,

        /// <summary>
        /// Adapter ModBus TCP versione HAM (Pizzaferri)
        /// </summary>
        MODBUS_TCP_HAM,

        /// <summary>
        /// Adapter ModBus TCP versione HELPI (Cererie Finassi)
        /// </summary>
        MODBUS_TCP_HELPI,

        /// <summary>
        /// Adapter Modubus TCP versione IMAX Aeromacchine (Jetco)
        /// </summary>
        MODBUS_TCP_IMAS_AEROMEC,

        /// <summary>
        /// Adapter Modubus TCP versione Rimor (IMI Remosa)
        /// </summary>
        MODBUS_TCP_RIMOR,

        /// <summary>
        /// Adapter Modubus TCP versione Saim (Giacovelli)
        /// </summary>
        MODBUS_TCP_SAIM,

        /// <summary>
        /// Adapter Modubus TCP versione Zetapack (Giacovelli)
        /// </summary>
        MODBUS_TCP_ZETAPACK,

        /// <summary>
        /// Adapter MTConnect
        /// </summary>
        MTConnect,

        /// <summary>
        /// Adapter OMRON
        /// </summary>
        OMRON,

        /// <summary>
        /// Adapter OPC-UA
        /// </summary>
        OpcUa,

        /// <summary>
        /// Adapter OPC-UA CMS
        /// </summary>
        OpcUaCMS,

        /// <summary>
        /// Adapter OPC-UA per Ewon
        /// </summary>
        OpcUaEwon,

        /// <summary>
        /// Adapter OPC-UA per Ewon x Adige (BLM) / STIL
        /// </summary>
        OpcUaEwonAdige,

        /// <summary>
        /// Adapter OPC-UA per Ewon x BLM / Mecart
        /// </summary>
        OpcUaEwonBLM,

        /// <summary>
        /// Adapter OPC-UA per Ewon x Monti / Tenditalia
        /// </summary>
        OpcUaEwonMonti,

        /// <summary>
        /// Adapter OPC-UA per Ewon x Mecolpress (BLM) / STIL
        /// </summary>
        OpcUaEwonMecolpress,

        /// <summary>
        /// Adapter OPC-UA per KeepWare
        /// </summary>
        OpcUaKwp,

        /// <summary>
        /// Adapter OPC-UA per KeepWare, UnitechRama
        /// </summary>
        OpcUaKwpRama,

        /// <summary>
        /// Adapter OPC-UA per IMAS Aeromec / Jetco
        /// </summary>
        OpcUaImasAeromec,

        /// <summary>
        /// Adapter MBH (es Cimolai)
        /// </summary>
        OpcUaMBH,

        /// <summary>
        /// Adapter MBH implementazione Cimolai x travel lift
        /// </summary>
        OpcUaMBHCimolai,

        /// <summary>
        /// Adapter OMRON (es ICOEL)
        /// </summary>
        OpcUaOmron,

        /// <summary>
        /// Implementaizone OMRON specifica x GHIDINI
        /// </summary>
        OpcUaOmronGhidini,

        /// <summary>
        /// Implementaizone OMRON specifica x ICOEL
        /// </summary>
        OpcUaOmronIcoel,

        /// <summary>
        /// Adapter OPC-UA SCM
        /// </summary>
        OpcUaSCM,

        /// <summary>
        /// Adapter OPC-UA Siemens generico
        /// </summary>
        OpcUaSiemens,

        /// <summary>
        /// Adapter OPC-UA Siemens OMP
        /// </summary>
        OpcUaSiemensOMP,

        /// <summary>
        /// Adapter OPC-UA Siemens Rama
        /// </summary>
        OpcUaSiemensRama,

        /// <summary>
        /// Adapter OPC-UA macchne SW
        /// </summary>
        OpcUaSiemensSW,

        /// <summary>
        /// Adapter OPC-UA Ulma (packaging, Giacovelli)
        /// </summary>
        OpcUaUlma,

        /// <summary>
        /// Adapter OSAI CNDEX (Cndex)
        /// </summary>
        OSAI_CNDEX,

        /// <summary>
        /// Adapter OSAI OPEN (ws)
        /// </summary>
        OSAI_OPEN,

        /// <summary>
        /// Adapter OSAI VB6
        /// </summary>
        OSAI_VB6,

        /// <summary>
        /// Adapter tipo watchdog via ping (per impianti spenti e non rilevati)
        /// </summary>
        PingWatchdog,

        /// <summary>
        /// Adapter REST (base)
        /// </summary>
        REST,

        /// <summary>
        /// Adapter REST Citizen
        /// </summary>
        REST_CITIZEN,

        /// <summary>
        /// Adapter REST/XML Emmegi FPWorkshop
        /// </summary>
        REST_EMMEGI_FPW,

        /// <summary>
        /// Shelly's Device (tipicamente PM series)
        /// </summary>
        Shelly,

        /// <summary>
        /// Shelly's Device PM1 series (Gen1)
        /// </summary>
        ShellyPm1,
        /// <summary>
        /// Shelly's Device Pro3Em series (Gen2)
        /// </summary>
        ShellyPro3Em,

        /// <summary>
        /// Adapter SIEMENS
        /// </summary>
        SIEMENS,

        /// <summary>
        /// Adapter SIEMENS, interfaccia versione APROCHIM (filtro liquidi rettifiche)
        /// </summary>
        SIEMENS_APROCHIM,

        /// <summary>
        /// Adapter SIEMENS, interfaccia versione VIPA @2001
        /// </summary>
        SIEMENS_AT2001,

        /// <summary>
        /// Adapter SIEMENS, interfaccia versione FAPE (punzonatrici) vers 2018
        /// </summary>
        SIEMENS_FAPE,

        /// <summary>
        /// Adapter SIEMENS, interfaccia versione FAPE (punzonatrici) vers 2024
        /// </summary>
        SIEMENS_FAPE_2,

        /// <summary>
        /// Adapter SIEMENS, interfaccia versione COMECA (impianti gestione GNL)
        /// </summary>
        SIEMENS_COMECA,

        /// <summary>
        /// Adapter SIEMENS, interfaccia versione COMUR (dentatrice)
        /// </summary>
        SIEMENS_COMUR,

        /// <summary>
        /// Adapter SIEMENS, interfaccia versione COSMAP (transfer smerigliatrice donati)
        /// </summary>
        SIEMENS_COSMAP,

        /// <summary>
        /// Adapter SIEMENS, interfaccia versione INGENIA (Valvital, Automazione)
        /// </summary>
        SIEMENS_INGENIA,

        /// <summary>
        /// Adapter SIEMENS, interfaccia versione LASCO (Valvital, Pressa Bilancere)
        /// </summary>
        SIEMENS_LASCO,

        /// <summary>
        /// Adapter SIEMENS, interfaccia versione NWSE (Giacovelli, impianto filtrazione NWS)
        /// </summary>
        SIEMENS_NWSE,

        /// <summary>
        /// Adapter SIEMENS, interfaccia versione PRESSOIL + CEI (Valvital, Pressa Idraulica)
        /// </summary>
        SIEMENS_PRESSOIL_CEI,

        /// <summary>
        /// Adapter SIEMENS, interfaccia verisone RobotService (Donati, smerigliatrici)
        /// </summary>
        SIEMENS_ROBOTSERVICE,

        /// <summary>
        /// Adapter SIEMENS, interfaccia versione SAET (Valvital, forni / tempra)
        /// </summary>
        SIEMENS_SAET,

        /// <summary>
        /// Adapter SIEMENS, interfaccia versione SIMEC (Valvital, taglio)
        /// </summary>
        SIEMENS_SIMEC,

        /// <summary>
        /// Adapter SIEMENS, interfaccia versione Torri
        /// </summary>
        SIEMENS_TORRI,

        /// <summary>
        /// Adapter SOAP x bilance Gomba
        /// </summary>
        SOAP_GOMBA,

        /// <summary>
        /// Adapter basato su DB scambio Microsoft SqlServer, macchine LANTEK
        /// </summary>
        SQLSERVER_LANTEK,

        /// <summary>
        /// Adapter basato su DB scambio Microsoft SqlServer, macchine PAMA
        /// </summary>
        SQLSERVER_PAMA,

        /// <summary>
        /// Metodi di WPS WebPageScraping (es x compressori Atlas Copco)
        /// </summary>
        WPS
    }

    /// <summary>
    /// Enumerazione tipi di tipi di URL x invio
    /// </summary>
    public enum urlType
    {
        /// <summary>
        /// Salvataggio FluxLog (valori estesi che non provocano calcoli di macchine a stati, eventi...)
        /// </summary>
        FLog,

        /// <summary>
        /// INPUT segnali in ingresso (standard base MAPO)
        /// </summary>
        SignIN,

        /// <summary>
        /// Salvataggio RawTransf (valori raw da decodificare a valle)
        /// </summary>
        RawTransf,

        /// <summary>
        /// Salvataggio UserLog (valori log attività utente)
        /// </summary>
        ULog
    }
}