#pragma once

#include "TnTCommon.h"
#include <winerror.h>
#include <errno.h>

namespace TnT
{

    HRESULT ConvertErrnoToHresult(int er);

    const HRESULT E_END_OF_DATA                     = MAKE_HRESULT(0x1, FACILITY_ITF, 0x01);
    const HRESULT E_FILE_OPEN_ERROR                 = MAKE_HRESULT(0x1, FACILITY_ITF, 0x02);
    const HRESULT E_FILE_SIZE_ERROR                 = MAKE_HRESULT(0x1, FACILITY_ITF, 0x03);
    const HRESULT E_FILE_NO_DATA                    = MAKE_HRESULT(0x1, FACILITY_ITF, 0x04);
    const HRESULT E_XNET_STARTUP_FAILED             = MAKE_HRESULT(0x1, FACILITY_ITF, 0x05);
    const HRESULT E_WSA_STARTUP_FAILED              = MAKE_HRESULT(0x1, FACILITY_ITF, 0x06);
    const HRESULT E_ALREADY_INITIALIZED             = MAKE_HRESULT(0x1, FACILITY_ITF, 0x07);
    const HRESULT E_XNET_CLEANUP_FAILED             = MAKE_HRESULT(0x1, FACILITY_ITF, 0x08);
    const HRESULT E_WSA_CLEANUP_FAILED              = MAKE_HRESULT(0x1, FACILITY_ITF, 0x09);
    const HRESULT E_NOT_INITIALIZED                 = MAKE_HRESULT(0x1, FACILITY_ITF, 0x0A);
    const HRESULT E_CREATE_SOCKET_FAILED            = MAKE_HRESULT(0x1, FACILITY_ITF, 0x0B);
    const HRESULT E_CONNECT_SOCKET_FAILED           = MAKE_HRESULT(0x1, FACILITY_ITF, 0x0C);
    const HRESULT E_DESTROY_SOCKET_FAILED           = MAKE_HRESULT(0x1, FACILITY_ITF, 0x0D);
    const HRESULT E_SOCKET_SEND_FAILED              = MAKE_HRESULT(0x1, FACILITY_ITF, 0x0E);
    const HRESULT E_SOCKET_RECEIVE_FAILED           = MAKE_HRESULT(0x1, FACILITY_ITF, 0x0F);
    const HRESULT E_EXPECT_CONTINUE_FAILED          = MAKE_HRESULT(0x1, FACILITY_ITF, 0x10);
    const HRESULT E_BUFFER_TOO_SMALL                = MAKE_HRESULT(0x1, FACILITY_ITF, 0x11);
    const HRESULT E_XNET_DNS_LOOKUP_FAILED          = MAKE_HRESULT(0x1, FACILITY_ITF, 0x12);
    const HRESULT E_UNRESOLVED                      = MAKE_HRESULT(0x1, FACILITY_ITF, 0x13);
    const HRESULT E_GETHOSTBYNAME_FAILED            = MAKE_HRESULT(0x1, FACILITY_ITF, 0x14);
    const HRESULT E_NOT_INET_ADDRESS                = MAKE_HRESULT(0x1, FACILITY_ITF, 0x15);
    const HRESULT E_XNET_UNREGISTER_KEY_FAILED      = MAKE_HRESULT(0x1, FACILITY_ITF, 0x16);
    const HRESULT E_XNET_UNREGISTER_INADDR_FAILED   = MAKE_HRESULT(0x1, FACILITY_ITF, 0x17);
    const HRESULT E_XNET_NO_USERS_SIGNED_IN         = MAKE_HRESULT(0x1, FACILITY_ITF, 0x18);
    const HRESULT E_XNET_INVALID_DATA_TYPE          = MAKE_HRESULT(0x1, FACILITY_ITF, 0x19);
    const HRESULT E_XNET_INVALID_DATA_LENGTH        = MAKE_HRESULT(0x1, FACILITY_ITF, 0x1A);
    const HRESULT E_XNET_UNKNOWN_RESULT             = MAKE_HRESULT(0x1, FACILITY_ITF, 0x1B);
    const HRESULT E_XNET_NO_SERVERS_FOUND           = MAKE_HRESULT(0x1, FACILITY_ITF, 0x1C);
    const HRESULT E_XNET_REGISTER_KEY_FAILED        = MAKE_HRESULT(0x1, FACILITY_ITF, 0x1D);
    const HRESULT E_XNET_TSADDRTOINADDR_FAILED      = MAKE_HRESULT(0x1, FACILITY_ITF, 0x1E);
    const HRESULT E_INDEX_OUT_OF_BOUNDS             = MAKE_HRESULT(0x1, FACILITY_ITF, 0x1F);

};