// Copyright 2021 Google LLC
//
// 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 <blobs-ipmid/blobs.hpp>

#include <atomic>
#include <cstdint>
#include <string>
#include <string_view>
#include <unordered_map>
#include <vector>

namespace metric_blob
{

class BmcHealthSnapshot
{
  public:
    BmcHealthSnapshot();

    /**
     * Reads data from this metric
     * @param offset: offset into the data to read
     * @param requestedSize: how many bytes to read
     * @returns Bytes able to read. Returns empty if nothing can be read.
     */
    std::string_view read(uint32_t offset, uint32_t requestedSize);

    /**
     * Returns information about the amount of readable data and whether the
     * metric has finished populating.
     * @param meta: Struct to fill with the metadata info
     */
    bool stat(blobs::BlobMeta& meta);

    /**
     * Start the metric collection process
     */
    void doWork();

    /**
     * The size of the content string.
     */
    uint32_t size();

    /**
     * Returns the ID of the provided string
     */
    int getStringID(const std::string_view s);

  private:
    std::atomic<bool> done;
    std::vector<char> pbDump;
    std::unordered_map<std::string, int> stringTable;
    int stringId;
    long ticksPerSec;
};

} // namespace metric_blob
