/*
// Copyright (c) 2019 Intel Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
*/

#pragma once

#include "pfr.hpp"

#include <boost/asio.hpp>
#include <phosphor-logging/log.hpp>
#include <sdbusplus/asio/object_server.hpp>

#include <string>

namespace pfr
{

static constexpr const char* versionPurposeBMC =
    "xyz.openbmc_project.Software.Version.VersionPurpose.BMC";
static constexpr const char* versionPurposeHost =
    "xyz.openbmc_project.Software.Version.VersionPurpose.Host";
static constexpr const char* versionPurposeOther =
    "xyz.openbmc_project.Software.Version.VersionPurpose.Other";

static constexpr const char* versionStr = "Version";
static constexpr const char* ufmProvisionedStr = "UfmProvisioned";
static constexpr const char* ufmLockedStr = "UfmLocked";
static constexpr const char* ufmSupportStr = "UfmSupport";

class PfrVersion
{
  public:
    PfrVersion(sdbusplus::asio::object_server& srv_,
               std::shared_ptr<sdbusplus::asio::connection>& conn_,
               const std::string& path_, const ImageType& imgType_,
               const std::string& purpose_);
    ~PfrVersion() = default;

    std::shared_ptr<sdbusplus::asio::connection> conn;

    void updateVersion();

  private:
    sdbusplus::asio::object_server& server;
    std::shared_ptr<sdbusplus::asio::dbus_interface> versionIface;
    bool internalSet = false;

    std::string path;
    std::string version;
    std::string purpose;
    ImageType imgType;
};

class PfrConfig
{
  public:
    PfrConfig(sdbusplus::asio::object_server& srv_,
              std::shared_ptr<sdbusplus::asio::connection>& conn_);
    ~PfrConfig() = default;

    std::shared_ptr<sdbusplus::asio::connection> conn;

    void updateProvisioningStatus();

  private:
    sdbusplus::asio::object_server& server;
    std::shared_ptr<sdbusplus::asio::dbus_interface> pfrCfgIface;
    bool internalSet = false;

    bool ufmProvisioned;
    bool ufmLocked;
    bool ufmSupport;
};

} // namespace pfr
