#pragma once

#include <memory>
#include <string>
#include <vector>
#include <openenclave/host.h>

#include "server_init_config.hpp"
#include "tls_server_u.h"  // edger8r 生成的头

// 负责启动 TLS 服务、触发 ECALL/OCALL
class ServerHost
{
public:
    ServerHost() = default;
    ~ServerHost();

    bool Start(const char* enclave_path,
                const char* listen_port,
                const ServerInitConfig& cfg);

    void Stop();

    // bool AcceptAndReceiveDek(std::vector<uint8_t>& out_dek);
    bool AcceptAndReceiveDek(std::vector<uint8_t>& out_sealed_dek);

private:
    oe_enclave_t* enclave_{nullptr};
    oe_result_t result_{OE_OK};
};
