#pragma once
#include "callback.hpp"

namespace phosphor
{
namespace dbus
{
namespace monitoring
{
/** @class Trap
 *  @brief Raises SNMP trap
 */
class Trap
{
  public:
    Trap() = default;
    Trap(const Trap&) = delete;
    Trap(Trap&&) = default;
    Trap& operator=(const Trap&) = delete;
    Trap& operator=(Trap&&) = default;
    virtual ~Trap() = default;
    /** @brief Raise SNMP trap by parsing the sdbus message.
     *  @param[in] msg - sdbus message.
     */
    virtual void trap(sdbusplus::message_t& msg) const = 0;
};

/** @class ErrorTrap
 *  @brief Sends SNMP trap for the elog error
 */
class ErrorTrap : public Trap
{
  public:
    ErrorTrap() = default;
    ErrorTrap(const ErrorTrap&) = delete;
    ErrorTrap(ErrorTrap&&) = default;
    ErrorTrap& operator=(const ErrorTrap&) = delete;
    ErrorTrap& operator=(ErrorTrap&&) = default;
    ~ErrorTrap() = default;

    /** @brief Raise SNMP trap by parsing the sdbus message.
     *  @param[in] msg - sdbus message.
     */
    void trap(sdbusplus::message_t& msg) const override;
};

/** @class SNMPTrap
 *  @brief SNMP trap callback implementation.
 */
template <typename T>
class SNMPTrap : public Callback
{
  public:
    SNMPTrap(const SNMPTrap&) = delete;
    SNMPTrap(SNMPTrap&&) = default;
    SNMPTrap& operator=(const SNMPTrap&) = delete;
    SNMPTrap& operator=(SNMPTrap&&) = default;
    virtual ~SNMPTrap() = default;
    SNMPTrap() : Callback() {}

    /** @brief Callback interface implementation.
     *  @param[in] ctc - context.
     */
    void operator()(Context /* ctx */) override {}

    /** @brief Callback interface implementation.
     *  @param[in] ctc - context.
     *  @param[in] msg - sdbus message.
     */
    void operator()(Context /* ctx */, sdbusplus::message_t& msg) override
    {
        event.trap(msg);
    }

  private:
    T event;
};

} // namespace monitoring
} // namespace dbus
} // namespace phosphor
