///
/// HybridKeyObjectHandleSpec.hpp
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
/// https://github.com/mrousavy/nitro
/// Copyright © Marc Rousavy @ Margelo
///

#pragma once

#if __has_include(<NitroModules/HybridObject.hpp>)
#include <NitroModules/HybridObject.hpp>
#else
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
#endif

// Forward declaration of `KFormatType` to properly resolve imports.
namespace margelo::nitro::crypto { enum class KFormatType; }
// Forward declaration of `KeyEncoding` to properly resolve imports.
namespace margelo::nitro::crypto { enum class KeyEncoding; }
// Forward declaration of `JWK` to properly resolve imports.
namespace margelo::nitro::crypto { struct JWK; }
// Forward declaration of `AsymmetricKeyType` to properly resolve imports.
namespace margelo::nitro::crypto { enum class AsymmetricKeyType; }
// Forward declaration of `KeyType` to properly resolve imports.
namespace margelo::nitro::crypto { enum class KeyType; }
// Forward declaration of `NamedCurve` to properly resolve imports.
namespace margelo::nitro::crypto { enum class NamedCurve; }
// Forward declaration of `KeyDetail` to properly resolve imports.
namespace margelo::nitro::crypto { struct KeyDetail; }
// Forward declaration of `HybridKeyObjectHandleSpec` to properly resolve imports.
namespace margelo::nitro::crypto { class HybridKeyObjectHandleSpec; }

#include <NitroModules/ArrayBuffer.hpp>
#include "KFormatType.hpp"
#include <optional>
#include "KeyEncoding.hpp"
#include <string>
#include "JWK.hpp"
#include "AsymmetricKeyType.hpp"
#include "KeyType.hpp"
#include <variant>
#include "NamedCurve.hpp"
#include "KeyDetail.hpp"
#include <memory>
#include "HybridKeyObjectHandleSpec.hpp"

namespace margelo::nitro::crypto {

  using namespace margelo::nitro;

  /**
   * An abstract base class for `KeyObjectHandle`
   * Inherit this class to create instances of `HybridKeyObjectHandleSpec` in C++.
   * You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
   * @example
   * ```cpp
   * class HybridKeyObjectHandle: public HybridKeyObjectHandleSpec {
   * public:
   *   HybridKeyObjectHandle(...): HybridObject(TAG) { ... }
   *   // ...
   * };
   * ```
   */
  class HybridKeyObjectHandleSpec: public virtual HybridObject {
    public:
      // Constructor
      explicit HybridKeyObjectHandleSpec(): HybridObject(TAG) { }

      // Destructor
      ~HybridKeyObjectHandleSpec() override = default;

    public:
      // Properties
      

    public:
      // Methods
      virtual std::shared_ptr<ArrayBuffer> exportKey(std::optional<KFormatType> format, std::optional<KeyEncoding> type, const std::optional<std::string>& cipher, const std::optional<std::shared_ptr<ArrayBuffer>>& passphrase) = 0;
      virtual JWK exportJwk(const JWK& key, bool handleRsaPss) = 0;
      virtual std::shared_ptr<ArrayBuffer> exportRawPublic() = 0;
      virtual std::shared_ptr<ArrayBuffer> exportRawPrivate() = 0;
      virtual std::shared_ptr<ArrayBuffer> exportRawSeed() = 0;
      virtual std::shared_ptr<ArrayBuffer> exportECPublicRaw(bool compressed) = 0;
      virtual std::shared_ptr<ArrayBuffer> exportECPrivateRaw() = 0;
      virtual AsymmetricKeyType getAsymmetricKeyType() = 0;
      virtual bool init(KeyType keyType, const std::variant<std::shared_ptr<ArrayBuffer>, std::string>& key, std::optional<KFormatType> format, std::optional<KeyEncoding> type, const std::optional<std::shared_ptr<ArrayBuffer>>& passphrase) = 0;
      virtual bool initECRaw(const std::string& namedCurve, const std::shared_ptr<ArrayBuffer>& keyData) = 0;
      virtual bool initPqcRaw(const std::string& algorithmName, const std::shared_ptr<ArrayBuffer>& keyData, bool isPublic) = 0;
      virtual bool initRawPublic(const std::string& asymmetricKeyType, const std::shared_ptr<ArrayBuffer>& keyData, const std::optional<std::string>& namedCurve) = 0;
      virtual bool initRawPrivate(const std::string& asymmetricKeyType, const std::shared_ptr<ArrayBuffer>& keyData, const std::optional<std::string>& namedCurve) = 0;
      virtual bool initRawSeed(const std::string& asymmetricKeyType, const std::shared_ptr<ArrayBuffer>& keyData) = 0;
      virtual std::optional<KeyType> initJwk(const JWK& keyData, std::optional<NamedCurve> namedCurve) = 0;
      virtual KeyDetail keyDetail() = 0;
      virtual bool keyEquals(const std::shared_ptr<HybridKeyObjectHandleSpec>& other) = 0;
      virtual double getSymmetricKeySize() = 0;
      virtual bool checkEcKeyData() = 0;

    protected:
      // Hybrid Setup
      void loadHybridMethods() override;

    protected:
      // Tag for logging
      static constexpr auto TAG = "KeyObjectHandle";
  };

} // namespace margelo::nitro::crypto
