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

#include <tango/client/NamedDevFailed.h>
#include <tango/common/idl_wrapper.h>

#include <string>
#include <vector>

namespace Tango
{
/**
 * An exception class
 *
 * This class is used as exception for the DeviceProxy::write_attribute call()
 *
 *
 * @headerfile tango.h
 * @ingroup Client
 */

class NamedDevFailedList : public Tango::DevFailed
{
  public:
    /**
     * Get faulty attribute number
     *
     * Returns the number of attributes which failed during the write_attribute call.
     *
     * @return The number of attribute(s) which fail during the write_attribute call
     */
    size_t get_faulty_attr_nb()
    {
        return err_list.size();
    }

    /**
     * Check if the call failed
     *
     * This method returns true if at least one attribute failed during the call
     *
     * @return A boolean set to true if the call failed for at least one attribute
     */
    bool call_failed() const
    {
        return (!err_list.empty()) || (errors.length() != 0);
    }

    std::vector<NamedDevFailed>
        err_list; ///< There is one element in this vector for each attribute which failed during its writing.

    /// @privatesection

    NamedDevFailedList(const Tango::MultiDevFailed &, std::string, const char *, const char *);

    NamedDevFailedList() { }
};
} // namespace Tango
#endif
