/*
 * SPDX-FileCopyrightText: 2025 Copyright contributors to the cppTango project
 *
 * SPDX-License-Identifier: LGPL-3.0-or-later
 */
#ifndef TANGO_CLIENT_ATTRCONFEVENTDATA_H
#define TANGO_CLIENT_ATTRCONFEVENTDATA_H

#include <tango/client/AttributeInfoEx.h>
#include <tango/common/tango_const.h>

#include <string>

namespace Tango
{
class DeviceProxy;

/********************************************************************************
 *                                                                                 *
 *                         AttrConfEventData class                                    *
 *                                                                                 *
 *******************************************************************************/

/**
 * Attribute configuration change event callback execution data
 *
 * This class is used to pass data to the callback method when an attribute configuration event is sent to the
 * client
 *
 *
 * @headerfile tango.h
 * @ingroup Client
 */

class AttrConfEventData
{
  public:
    ///@privatesection
    AttrConfEventData(DeviceProxy *dev,
                      const std::string &nam,
                      const std::string &evt,
                      Tango::AttributeInfoEx *attr_conf_in,
                      Tango::EventReason event_reason_in,
                      const DevErrorList &errors_in);
    virtual ~AttrConfEventData();
    AttrConfEventData(const AttrConfEventData &);
    AttrConfEventData &operator=(const AttrConfEventData &);
    /**
     * The date when the event arrived
     */
    Tango::TimeVal reception_date;

    Tango::TimeVal &get_date()
    {
        return reception_date;
    }

    ///@publicsection
    DeviceProxy *device{nullptr};        ///< The DeviceProxy object on which the call was executed
    std::string attr_name;               ///< The attribute name
    std::string event;                   ///< The event name
    AttributeInfoEx *attr_conf{nullptr}; ///< The attribute configuration
    bool err{false};                     ///< A boolean flag set to true if the request failed. False otherwise
    EventReason event_reason{EventReason::Unknown}; ///< Reason for the event, see @ref EventReason
    DevErrorList errors;                            ///< The error stack

  private:
    void set_time();
};

} // namespace Tango

#endif // TANGO_CLIENT_ATTRCONFEVENTDATA_H
