/*
 * SPDX-FileCopyrightText: 2004 Copyright contributors to the cppTango project
 *
 * SPDX-License-Identifier: LGPL-3.0-or-later
 */

#ifndef TANGO_SERVER_MULTIATTRPROP_H
#define TANGO_SERVER_MULTIATTRPROP_H

#include <tango/common/defines.h>
#include <tango/common/tango_const.h>
#include <tango/common/tango_type_traits.h>
#include <tango/server/AttrProp.h>
#include <tango/server/DoubleAttrProp.h>
#include <tango/server/Except.h>

#include <memory>
#include <sstream>
#include <string>
#include <vector>

namespace Tango
{

//==================================================================================================================
//
//            The MultiAttrProp class
//
// description :    This is a template class which holds values of modifiable attribute properties.
//
//=================================================================================================================

/**
 * This class represents Tango modifiable attribute properties grouped in
 * one object to facilitate setting and getting attribute properties in one go.
 *
 *
 *
 *
 * @headerfile tango.h
 * @ingroup Server
 */

template <typename T>
class MultiAttrProp
{
  public:
    /**@name Constructors
     * Miscellaneous constructors */
    //@{
    /**
     * Default constructor.
     */
    MultiAttrProp()
    {
#ifdef __clang__
  #pragma clang diagnostic push
  #pragma clang diagnostic ignored "-Wundefined-var-template"
#endif

        CmdArgType type =
            Tango::tango_type_traits<T>::type_value(); // restricts template initialisation to supported types
        if(type != 0u)
        {
        } // prevents compiler warning about unused variable type

#ifdef __clang__
  #pragma clang diagnostic pop
#endif
    }

    //@}
    /**@name Class data members */
    //@{
    /**
     * Attribute label
     */
    std::string label;
    /**
     * Attribute description
     */
    std::string description;
    /**
     * Attribute unit
     */
    std::string unit;
    /**
     * Attribute standard_unit
     */
    std::string standard_unit;
    /**
     * Attribute display_unit
     */
    std::string display_unit;
    /**
     * Attribute format
     */
    std::string format;
    /**
     * Attribute min_value
     */
    AttrProp<T> min_value;
    /**
     * Attribute max_value
     */
    AttrProp<T> max_value;
    /**
     * Attribute min_alarm
     */
    AttrProp<T> min_alarm;
    /**
     * Attribute max_alarm
     */
    AttrProp<T> max_alarm;
    /**
     * Attribute min_warning
     */
    AttrProp<T> min_warning;
    /**
     * Attribute max_warning
     */
    AttrProp<T> max_warning;
    /**
     * Attribute delta_t
     */
    AttrProp<DevLong> delta_t;
    /**
     * Attribute delta_val
     */
    AttrProp<T> delta_val;
    /**
     * Attribute event_period
     */
    AttrProp<DevLong> event_period;
    /**
     * Attribute archive_period
     */
    AttrProp<DevLong> archive_period;
    /**
     * Attribute rel_change
     */
    DoubleAttrProp<DevDouble> rel_change;
    /**
     * Attribute abs_change
     */
    DoubleAttrProp<DevDouble> abs_change;
    /**
     * Attribute archive_rel_change
     */
    DoubleAttrProp<DevDouble> archive_rel_change;
    /**
     * Attribute archive_abs_change
     */
    DoubleAttrProp<DevDouble> archive_abs_change;
    /**
     * Enumeration labels (For DevEnum data type)
     */
    std::vector<std::string> enum_labels;
    //@}
  private:
    //
    // The extension class
    //

    class MultiAttrPropExt
    {
    };

    std::unique_ptr<MultiAttrPropExt> ext; // Class extension
};

template <>
class MultiAttrProp<DevEncoded>
{
  public:
    MultiAttrProp() { }

    std::string label;
    std::string description;
    std::string unit;
    std::string standard_unit;
    std::string display_unit;
    std::string format;
    AttrProp<DevUChar> min_value;
    AttrProp<DevUChar> max_value;
    AttrProp<DevUChar> min_alarm;
    AttrProp<DevUChar> max_alarm;
    AttrProp<DevUChar> min_warning;
    AttrProp<DevUChar> max_warning;
    AttrProp<DevLong> delta_t;
    AttrProp<DevUChar> delta_val;
    AttrProp<DevLong> event_period;
    AttrProp<DevLong> archive_period;
    DoubleAttrProp<DevDouble> rel_change;
    DoubleAttrProp<DevDouble> abs_change;
    DoubleAttrProp<DevDouble> archive_rel_change;
    DoubleAttrProp<DevDouble> archive_abs_change;
    std::vector<std::string> enum_labels;

  private:
    //
    // The extension class
    //

    class MultiAttrPropExt
    {
    };

    std::unique_ptr<MultiAttrPropExt> ext; // Class extension
};

} // namespace Tango

#endif // TANGO_SERVER_MULTIATTRPROP_H
