//
// LDASTools frameCPP - A library implementing the LIGO/Virgo frame
// specification
//
// Copyright (C) 2018 California Institute of Technology
//
// LDASTools frameCPP is free software; you may redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 (GPLv2) of the
// License or at your discretion, any later version.
//
// LDASTools frameCPP is distributed in the hope that it will be useful, but
// without any warranty or even the implied warranty of merchantability
// or fitness for a particular purpose. See the GNU General Public
// License (GPLv2) for more details.
//
// Neither the names of the California Institute of Technology (Caltech),
// The Massachusetts Institute of Technology (M.I.T), The Laser
// Interferometer Gravitational-Wave Observatory (LIGO), nor the names
// of its contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// You should have received a copy of the licensing terms for this
// software included in the file LICENSE located in the top-level
// directory of this package. If you did not, you can view a copy at
// http://dcc.ligo.org/M1500244/LICENSE
//

#ifndef FrameCPP_UNIVERSAL_FrStatData_HH
#define FrameCPP_UNIVERSAL_FrStatData_HH

#include "framecpp/Universal/impl/FrStatDataClassicIO.hh"
#include "framecpp/Universal/impl/FrStatDataSerialIO.hh"

namespace FrameCPP
{
    namespace Universal
    {
        //===================================================================
        /// \brief Static Data Structure Definition
        //===================================================================
        class FrStatData : public FrStatDataImpl::ClassicIO< FrStatData >,
                           public FrStatDataImpl::SerialIO< FrStatData >
        {
        public:
            //-----------------------------------------------------------------
            /// \brief Default constructor
            ///
            /// \return
            ///    A new instance of this object.
            //-----------------------------------------------------------------
            FrStatData( ) = default;

            //-----------------------------------------------------------------
            /// \brief Copy Constructor
            ///
            /// \param[in] Source
            ///     The object from which to copy the information.
            ///
            /// \return
            ///    A new instance of this object.
            //-----------------------------------------------------------------
            FrStatData( const FrStatData& Source );

            //-----------------------------------------------------------------
            /// \brief Constructor
            ///
            /// \param[in] name
            ///     Static data name
            /// \param[in] comment
            ///     Comemnt
            /// \param[in] representation
            ///     Type of static data being represented
            /// \param[in] timeStart
            ///     Start time of static data validity.
            /// \param[in] timeEnd
            ///     End time of static data validity.
            /// \param[in] version
            ///     Version number of this static structure.
            ///
            /// \return
            ///     A new instance of the object.
            //-----------------------------------------------------------------
            FrStatData( const name_type&           Name,
                        const comment_type&        Comment,
                        const representation_type& Representation,
                        timeStart_type             TimeStart,
                        timeEnd_type               TimeEnd,
                        version_type               Version );

            //-----------------------------------------------------------
            /// @brief Creates a deep copy of this FrStatData object.
            ///
            /// This method allocates a new `FrStatData` object on the heap
            /// by invoking the copy constructor with the current instance
            /// (`*this`).
            ///
            /// @return A pointer to a newly allocated `FrStatData` object that
            /// is a clone of this instance.
            ///
            /// @note The caller is responsible for managing (and eventually
            /// deleting) the returned pointer to avoid memory leaks.
            //-----------------------------------------------------------
            FrStatData* Clone( ) const;

            //-----------------------------------------------------------------
            /// \brief Merge with another FrAdcData
            ///
            /// \param[in] RHS
            ///     The source of the information to append to this FrAdcData
            ///     structure.
            ///
            /// \return
            ///     A reference to this object
            //-----------------------------------------------------------------
            FrStatData& Merge( const FrStatData& RHS );

            //-----------------------------------------------------------------
            /// \brief equality operator
            ///
            /// \param[in] RHS
            ///     The FrAdcData object to be compared.
            ///
            /// \return
            ///     The value true is returned if this object is equivelent
            ///     to the RHS instance; false otherwise.
            //-----------------------------------------------------------------
            /// Typed equality declared as a hidden friend, not a member, so
            /// it does not pair with the virtual operator==(Object&) override
            /// below under C++20's reversed-candidate rule.
            friend bool
            operator==( const FrStatData& LHS, const FrStatData& RHS )
            {
                return ( LHS.FrStatDataImpl::Data::operator==( RHS ) );
            }

            //-----------------------------------------------------------------
            /// \brief equality operator for abstract data type
            ///
            /// \param[in] RHS
            ///     The object to be compared.
            ///
            /// \return
            ///     The value true is returned if this object is equivelent
            ///     to the RHS instance; false otherwise.
            //-----------------------------------------------------------------
            virtual bool
            operator==( const Common::FrameSpec::Object& RHS ) const;

        private:
            using Common::FrameSpec::Object::Create;
        };
    } // namespace Universal
} // namespace FrameCPP
#endif /* FrameCPP_UNIVERSAL_FrStatData_HH */
