//                           UNCLASSIFIED
/*-------------------------------------------------------------------------
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
COMPANY.

THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
GOVERNMENT.

UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
-------------------------------------------------------------------------*/

using Raytheon.Common;
using System;
using System.Collections.Generic;

namespace BitMeasurementManagerLib
{
   /// <summary>
   /// This class creates BitConfigurableMessage objects
   /// </summary>
   internal abstract class BitConfigurableMessageFactory
   {
      internal enum FactoryType
      {
         EXCEL,
         EXCEL_ZIP
      };

      private static BitConfigurableMessageFactory _bitFactoryInstance;

      #region PublicFuctions

      public static BitConfigurableMessageFactory Instance(string inputFileName = "", FactoryType type = FactoryType.EXCEL_ZIP)
      {
         if (_bitFactoryInstance == null)
         {
            if (type == FactoryType.EXCEL)
            {
               _bitFactoryInstance = new BitConfigurableMessageExcelFactory(inputFileName);
            }
            else if (type == FactoryType.EXCEL_ZIP)
            {
               _bitFactoryInstance = new BitConfigurableMessageExcelZipFactory(inputFileName);
            }
            else
            {
               throw new Exception("BitConfigurableMessageFactory::Instance() - unsupport input type: " + type.ToString());
            }

         }

         return _bitFactoryInstance;
      }

      protected abstract Dictionary<uint, BitConfigurableMessage> GetAllMessages();

      protected abstract BitConfigurableMessage CreateMessage(uint messageId);

      public Dictionary<uint, BitConfigurableMessage> RetreiveAllMessages()
      {
         return _bitFactoryInstance.GetAllMessages();
      }

      public BitConfigurableMessage RetreiveMessage(uint messageId)
      {
         return _bitFactoryInstance.CreateMessage(messageId);
      }

      #endregion
   }
}