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

#include <tango/client/DeviceData.h>

#include <memory>
#include <string>

namespace Tango
{
class DeviceProxy;

/**
 * Asynchronous command execution callback data
 *
 * This class is used to pass data to the callback method in asynchronous callback model for command execution.
 *
 *
 * @headerfile tango.h
 * @ingroup Client
 */

class CmdDoneEvent
{
  public:
    ///@privatesection
    CmdDoneEvent(DeviceProxy *dev, std::string &cmd, DeviceData &arg, DevErrorList &err_in) :
        device(dev),
        cmd_name(cmd),
        argout(arg),
        errors(err_in)
    {
        err = errors.length() != 0;
    }

    ///@publicsection
    Tango::DeviceProxy *device; ///< The DeviceProxy object on which the call was executed
    std::string &cmd_name;      ///< The command name
    DeviceData &argout;         ///< The command argout
    bool err;                   ///< A boolean flag set to true if the command failed. False otherwise
    DevErrorList &errors;       ///< The error stack

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

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