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

#include <tango/common/tango_const.h>

#include <string>

namespace Tango
{
class DeviceProxy;
struct AttDataReady;

/********************************************************************************
 *                                                                                 *
 *                         DataReadyEventData class                                *
 *                                                                                 *
 *******************************************************************************/

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

class DataReadyEventData
{
  public:
    ///@privatesection
    DataReadyEventData(DeviceProxy *, AttDataReady *, const std::string &evt, EventReason, const DevErrorList &);

    ~DataReadyEventData() { }

    DataReadyEventData(const DataReadyEventData &);
    DataReadyEventData &operator=(const DataReadyEventData &);
    /**
     * 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
    int attr_data_type;           ///< The attribute data type
    int ctr;                      ///< The user counter. Set to 0 if not defined when sent by the server

    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_DATAREADYEVENTDATA_H
