/*********************************************************************************
** Copyright (c) 1992-2026 MAK Technologies, Inc
** All rights reserved.
*********************************************************************************/

#pragma once

#include "managedInterface/messages/iffState.h"
#include "managedInterface/message.h"

#include <string>
#include <matrix/vlVector.h>

#ifndef IFF_MODE_CODE_SIZE
#define IFF_MODE_CODE_SIZE 3
#endif

class MANAGEDINTERFACE_DLL CustomIffStateMessage : public IffStateMessage
{
public:
   enum DtModeOrParameterKind { Enabled = 0, IsDamaged = 1, IsMalfunctioning = 2, IsOn = 3 };

  CustomIffStateMessage();
  virtual ~CustomIffStateMessage();

   virtual void setModeOrParameterVal(char type, int status, bool onOff);
   virtual void setModeOrParameterVal(int type, int status, bool onOff);
   virtual bool getModeOrParameterVal(char type, int status) const;
   virtual bool getModeOrParameterVal(int type, int status) const;

   virtual void setModeEnabled(int modeType, bool onOff);
   virtual bool modeEnabled(int modeType) const;
   virtual void setModeEnabled(char modeType, bool onOff);
   virtual bool modeEnabled(char modeType) const;

   virtual void setModeIsMalfunctioning(int modeType, bool onOff);
   virtual bool modeIsMalfunctioning(int modeType) const;
   virtual void setModeIsMalfunctioning(char modeType, bool onOff);
   virtual bool modeIsMalfunctioning(char modeType) const;

   virtual void setModeIsDamaged(int modeType, bool onOff);
   virtual bool modeIsDamaged(int modeType) const;
   virtual void setModeIsDamaged(char modeType, bool onOff);
   virtual bool modeIsDamaged(char modeType) const;

   virtual void setModeIsOn(int modeType, bool onOff);
   virtual bool modeIsOn(int modeType) const;
   virtual void setModeIsOn(char modeType, bool onOff);
   virtual bool modeIsOn(char modeType) const;

   virtual unsigned short modeCode(int modeCodeNum);
   virtual void setModeCode(int modeCodeNum, unsigned short val);

  virtual int messageSize();
  
   static DtMessage* decode(unsigned char* buffer, int length);
   static std::string theMessageName();

protected:
   static std::string theFullName;

   //! Used for NatoIFF and SovietIFF mode and parameter values
   bool myModeParameterStatusValues[7][4];

   unsigned short myModeCode[IFF_MODE_CODE_SIZE];

   virtual void serialize(DtStreamWriter& writer);
   virtual void deserialize(DtStreamReader& reader);
};
