#pragma once

#include "xyz/openbmc_project/Certs/Entry/server.hpp"
#include "xyz/openbmc_project/Object/Delete/server.hpp"
#include "xyz/openbmc_project/PLDM/Provider/Certs/Authority/CSR/server.hpp"

#include <sdbusplus/bus.hpp>
#include <sdbusplus/server/object.hpp>

namespace ca
{
namespace cert
{

using Delete = sdbusplus::xyz::openbmc_project::Object::server::Delete;

using CertEntry = sdbusplus::xyz::openbmc_project::Certs::server::Entry;
using CSREntry = sdbusplus::xyz::openbmc_project::PLDM::Provider::Certs::
    Authority::server::CSR;
using Ifaces = sdbusplus::server::object::object<CSREntry, CertEntry, Delete>;

class CACertMgr;

/** @class Entry
 *  @brief CA authority certificate Entry implementation.
 *  @details A concrete implementation for the
 *           xyz.openbmc_project.Certs.Entry DBus API
 */
class Entry : public Ifaces
{
  public:
    Entry() = delete;
    Entry(const Entry&) = delete;
    Entry& operator=(const Entry&) = delete;
    Entry(Entry&&) = delete;
    Entry& operator=(Entry&&) = delete;
    ~Entry() = default;

    /** @brief Constructor to put object onto bus at a D-Bus path.
     *  @param[in] bus - Bus to attach to.
     *  @param[in] objPath - The D-Bus object path to attach at.
     *  @param[in] entryId - Entry id
     *  @param[in] csr     - csr string
     *  @param[in] cert    - client certificate
     */
    Entry(sdbusplus::bus::bus& bus, const std::string& objPath,
          uint32_t entryId, std::string& csr, std::string& cert,
          CACertMgr& manager) :
        Ifaces(bus, objPath.c_str(), true),
        bus(bus), id(entryId), manager(manager)

    {
#ifdef SDBUSPP_NEW_CAMELCASE
        this->csr(csr);
#else
        cSR(csr);
#endif
        clientCertificate(cert);

        // Emit deferred signal.
        this->emit_object_added();
    };

    void delete_() override;

  protected:
    /** @brief sdbusplus handler */
    sdbusplus::bus::bus& bus;
    uint32_t id;
    /** @brief object path */
    std::string objectPath;
    /** @brief Reference to Certificate Manager */
    CACertMgr& manager;
};
} // namespace cert
} // namespace ca
