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

#include <tango/common/tango_const.h>

#include <string>

namespace Tango
{
class DeviceProxy;
class DevicePipe;

/********************************************************************************
 *                                                                                 *
 *                         PipeEventData class                                        *
 *                                                                                 *
 *******************************************************************************/

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

class PipeEventData
{
  public:
    ///@privatesection
    PipeEventData(DeviceProxy *dev,
                  const std::string &nam,
                  const std::string &evt,
                  Tango::DevicePipe *pipe_value_in,
                  Tango::EventReason event_reason_in,
                  const DevErrorList &errors_in);

    ~PipeEventData();
    PipeEventData(const PipeEventData &);
    PipeEventData &operator=(const PipeEventData &);
    /**
     * 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 pipe_name;           ///< The pipe name
    std::string event;               ///< The event name
    DevicePipe *pipe_value{nullptr}; ///< The pipe data
    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_PIPEEVENTDATA_H
