/*
    This file is part of TON Blockchain Library.
    TON Blockchain Library is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation, either version 2 of the License, or
    (at your option) any later version.
    TON Blockchain Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.
    You should have received a copy of the GNU Lesser General Public License
    along with TON Blockchain Library.  If not, see .
    Copyright 2017-2020 Telegram Systems LLP
*/
#pragma once
#include "vm/cells.h"
#include "td/db/utils/BlobView.h"
#include "td/utils/Status.h"
namespace vm {
class StaticBagOfCellsDb : public std::enable_shared_from_this {
 public:
  virtual ~StaticBagOfCellsDb() = default;
  // TODO: handle errors
  virtual td::Result get_root_count() = 0;
  virtual td::Result[> get_root_cell(size_t idx) = 0;
 protected:
  virtual td::Result][> load_by_idx(int idx) = 0;
  friend class StaticBocLoader;
  friend class StaticBocRootLoader;
  td::Result][> create_ext_cell(Cell::LevelMask level_mask, td::Slice hash, td::Slice depth, int idx);
  td::Result][> create_root_ext_cell(Cell::LevelMask level_mask, td::Slice hash, td::Slice depth, int idx);
};
class StaticBagOfCellsDbBaseline {
 public:
  static td::Result> create(td::BlobView data);
  static td::Result> create(td::Slice data);
};
class StaticBagOfCellsDbLazy {
 public:
  struct Options {
    Options() {
    }
    bool check_crc32c{false};
  };
  static td::Result> create(td::BlobView data, Options options = {});
  static td::Result> create(td::BufferSlice data, Options options = {});
  static td::Result> create(std::string data, Options options = {});
};
}  // namespace vm
]