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

//! \file entityMapperKey.h
//! \brief Contains DtEntityMapperKey class.

#pragma once

#ifndef DtUSE_UTILITIES_NAMESPACE


#include <omtReader/omtReader.h>
#include <vlutil/vlString.h>

class DT_DLL_OMTREADER DtEntityMapperKey
{

public:

   static const int DtAnyMatch;

   DtEntityMapperKey
   (
      int kind,
      int domain,
      int country,
      int category,
      int subcategory,
      int specific,
      int extra
   );


   DtEntityMapperKey();

   DtEntityMapperKey(const char* p);

   //! Copy constructor
   DtEntityMapperKey(const DtEntityMapperKey& orig);

   //! Destructor
   ~DtEntityMapperKey();

   //! Assignment operator
   DtEntityMapperKey& operator=(const DtEntityMapperKey& rhs);

   //! Assignment operator
   DtEntityMapperKey& operator=(const char* rhs);

   const DtString& string() const;

   int kind() const {return myKind;}
   void setKind(int kind){myKind = kind;}

   int domain() const {return myDomain;}
   void setDomain(int domain){myDomain = domain;}

   int country() const {return myCountry;}
   void setCountry(int country){myCountry = country;}

   int category() const {return myCategory;}
   void setCategory(int category){myCategory = category;}

   int subcategory() const {return mySubcategory;}
   void setSubCategory(int subcategory){mySubcategory = subcategory;}

   int specific() const {return mySpecific;}
   void setSpecific(int specific){mySpecific = specific;}

   int extra() const {return myExtra;}
   void setExtra(int extra){myExtra = extra;}

   //! == returns 1 if they are equal, 0 if they are not equal 

   bool operator==(const DtEntityMapperKey& rhs) const;
   virtual bool matchPattern(const DtEntityMapperKey &pat) const;

   //! != returns 0 if they are equal, nonzero if they are not equal 

   bool operator!=(const DtEntityMapperKey& rhs) const;

   //! == returns 1 if rhs is < this else it returns 0 

   bool operator<(const DtEntityMapperKey& rhs) const;

   //! == returns 1 if rhs is > this else it returns 0 

   bool operator>(const DtEntityMapperKey& rhs) const;

   int& operator[](int);
   const int operator[](int) const;

   //! Returns true only on an exact match (no wildcarding)
   virtual bool exactMatch(const DtEntityMapperKey&) const;

protected:

   mutable DtString myStringRep;
   int myKind;
   int myDomain;
   int myCountry;
   int myCategory;
   int mySubcategory;
   int mySpecific;
   int myExtra;
};

inline int& DtEntityMapperKey::operator[](int i)
{
   switch (i)
   {
      case 0:
         return myKind;
      case 1:
         return myDomain;
      case 2:
         return myCountry;
      case 3:
         return myCategory;
      case 4:
         return mySubcategory;
      case 5:
         return mySpecific;
      case 6:
         return myExtra;
   }
   return myKind;
}

inline const int DtEntityMapperKey::operator[](int i) const
{
   switch (i)
   {
      case 0:
         return myKind;
      case 1:
         return myDomain;
      case 2:
         return myCountry;
      case 3:
         return myCategory;
      case 4:
         return mySubcategory;
      case 5:
         return mySpecific;
      case 6:
         return myExtra;
   }

   return myKind;
}

#endif
