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

#include <tango/client/DeviceAttribute.h>

#include <memory>
#include <vector>

namespace Tango
{
class DeviceProxy;

/**
 * Asynchronous read attribute execution callback data
 *
 * This class is used to pass data to the callback method in asynchronous callback model for read_attribute(s)
 * execution
 *
 *
 * @headerfile tango.h
 * @ingroup Client
 */

class AttrReadEvent
{
  public:
    ///@privatesection
    AttrReadEvent(DeviceProxy *dev,
                  std::vector<std::string> &att_names,
                  std::vector<DeviceAttribute> *arg,
                  DevErrorList &err_in) :
        device(dev),
        attr_names(att_names),
        argout(arg),
        errors(err_in)
    {
        err = errors.length() != 0;
    }

    ///@publicsection
    Tango::DeviceProxy *device{nullptr};           ///< The DeviceProxy object on which the call was executed
    std::vector<std::string> &attr_names;          ///< The attribute name list
    std::vector<DeviceAttribute> *argout{nullptr}; ///< The attribute data (callback function owns the memory)
    bool err{false};      ///< A boolean flag set to true if the request failed. False otherwise
    DevErrorList &errors; ///< The error stack

  private:
    class AttrReadEventExt
    {
      public:
        AttrReadEventExt() { }
    };

    std::unique_ptr<AttrReadEventExt> ext;
};
} // namespace Tango
#endif
