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

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

namespace Tango
{
class DeviceProxy;

/********************************************************************************
 *                                                                                 *
 *                         DevIntrChangeEventData class                            *
 *                                                                                 *
 *******************************************************************************/

/**
 * Device interface change event callback execution data
 *
 * This class is used to pass data to the callback method when a device interface change event is sent to the client.
 *
 *
 * @headerfile tango.h
 * @ingroup Client
 */

class DevIntrChangeEventData
{
  public:
    ///@privatesection
    DevIntrChangeEventData(DeviceProxy *,
                           const std::string &,
                           const std::string &,
                           DevCmdInfoList_2 *,
                           AttributeConfigList_5 *,
                           bool,
                           EventReason,
                           const DevErrorList &);
    DevIntrChangeEventData(DeviceProxy *,
                           const std::string &,
                           const std::string &,
                           CommandInfoList *,
                           AttributeInfoListEx *,
                           bool,
                           EventReason,
                           const DevErrorList &);

    ~DevIntrChangeEventData() { }

    DevIntrChangeEventData(const DevIntrChangeEventData &);
    DevIntrChangeEventData &operator=(const DevIntrChangeEventData &);
    /**
     * 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 event;            ///< The event name
    std::string device_name;      ///< The device name
    CommandInfoList cmd_list;     ///< Device command list info
    AttributeInfoListEx att_list; ///< Device attribute list info
    bool dev_started{false};      ///< Device started flag (true when event sent due to device being (re)started
                                  ///< and with only a possible but not sure interface change)

    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_DEVINTRCHANGEEVENTDATA_H
