// WARNING: Please don't edit this file. It was generated by Python/WinRT v3.2.1

#pragma once

#include "pybase.h"
static_assert(winrt::check_version(PYWINRT_VERSION, "3.2.1"), "Mismatched Py/WinRT headers.");
#include <winrt/Windows.Foundation.h>
#include <winrt/Windows.Foundation.Collections.h>
#include <winrt/Windows.Networking.h>
#include <winrt/Windows.Networking.Sockets.h>
#include <winrt/Windows.Storage.Streams.h>

#include <winrt/Windows.Networking.Proximity.h>

namespace py::proj::Windows::Networking::Proximity
{
}

namespace py
{
    template<>
    inline constexpr const char* buffer_format<winrt::Windows::Networking::Proximity::PeerDiscoveryTypes> = "I";

    template<>
    inline constexpr const char* buffer_format<winrt::Windows::Networking::Proximity::PeerRole> = "i";

    template<>
    inline constexpr const char* buffer_format<winrt::Windows::Networking::Proximity::PeerWatcherStatus> = "i";

    template<>
    inline constexpr const char* buffer_format<winrt::Windows::Networking::Proximity::TriggeredConnectState> = "i";


    template<>
    struct py_type<winrt::Windows::Networking::Proximity::PeerDiscoveryTypes>
    {
        static constexpr std::string_view qualified_name = "winrt.windows.networking.proximity.PeerDiscoveryTypes";
        static constexpr const char* module_name = "winrt.windows.networking.proximity";
        static constexpr const char* type_name = "PeerDiscoveryTypes";
    };

    template<>
    struct py_type<winrt::Windows::Networking::Proximity::PeerRole>
    {
        static constexpr std::string_view qualified_name = "winrt.windows.networking.proximity.PeerRole";
        static constexpr const char* module_name = "winrt.windows.networking.proximity";
        static constexpr const char* type_name = "PeerRole";
    };

    template<>
    struct py_type<winrt::Windows::Networking::Proximity::PeerWatcherStatus>
    {
        static constexpr std::string_view qualified_name = "winrt.windows.networking.proximity.PeerWatcherStatus";
        static constexpr const char* module_name = "winrt.windows.networking.proximity";
        static constexpr const char* type_name = "PeerWatcherStatus";
    };

    template<>
    struct py_type<winrt::Windows::Networking::Proximity::TriggeredConnectState>
    {
        static constexpr std::string_view qualified_name = "winrt.windows.networking.proximity.TriggeredConnectState";
        static constexpr const char* module_name = "winrt.windows.networking.proximity";
        static constexpr const char* type_name = "TriggeredConnectState";
    };

    template<>
    struct py_type<winrt::Windows::Networking::Proximity::ConnectionRequestedEventArgs>
    {
        static constexpr std::string_view qualified_name = "winrt.windows.networking.proximity.ConnectionRequestedEventArgs";
        static constexpr const char* module_name = "winrt.windows.networking.proximity";
        static constexpr const char* type_name = "ConnectionRequestedEventArgs";
    };

    template<>
    struct py_type<winrt::Windows::Networking::Proximity::PeerFinder>
    {
        static constexpr std::string_view qualified_name = "winrt.windows.networking.proximity.PeerFinder";
        static constexpr const char* module_name = "winrt.windows.networking.proximity";
        static constexpr const char* type_name = "PeerFinder";
    };

    template<>
    struct py_type<winrt::Windows::Networking::Proximity::PeerInformation>
    {
        static constexpr std::string_view qualified_name = "winrt.windows.networking.proximity.PeerInformation";
        static constexpr const char* module_name = "winrt.windows.networking.proximity";
        static constexpr const char* type_name = "PeerInformation";
    };

    template<>
    struct py_type<winrt::Windows::Networking::Proximity::PeerWatcher>
    {
        static constexpr std::string_view qualified_name = "winrt.windows.networking.proximity.PeerWatcher";
        static constexpr const char* module_name = "winrt.windows.networking.proximity";
        static constexpr const char* type_name = "PeerWatcher";
    };

    template<>
    struct py_type<winrt::Windows::Networking::Proximity::ProximityDevice>
    {
        static constexpr std::string_view qualified_name = "winrt.windows.networking.proximity.ProximityDevice";
        static constexpr const char* module_name = "winrt.windows.networking.proximity";
        static constexpr const char* type_name = "ProximityDevice";
    };

    template<>
    struct py_type<winrt::Windows::Networking::Proximity::ProximityMessage>
    {
        static constexpr std::string_view qualified_name = "winrt.windows.networking.proximity.ProximityMessage";
        static constexpr const char* module_name = "winrt.windows.networking.proximity";
        static constexpr const char* type_name = "ProximityMessage";
    };

    template<>
    struct py_type<winrt::Windows::Networking::Proximity::TriggeredConnectionStateChangedEventArgs>
    {
        static constexpr std::string_view qualified_name = "winrt.windows.networking.proximity.TriggeredConnectionStateChangedEventArgs";
        static constexpr const char* module_name = "winrt.windows.networking.proximity";
        static constexpr const char* type_name = "TriggeredConnectionStateChangedEventArgs";
    };
}

#if __has_include("py.Windows.Foundation.h")
#include "py.Windows.Foundation.h"
#endif

#if __has_include("py.Windows.Foundation.Collections.h")
#include "py.Windows.Foundation.Collections.h"
#endif

#if __has_include("py.Windows.Networking.h")
#include "py.Windows.Networking.h"
#endif

#if __has_include("py.Windows.Networking.Sockets.h")
#include "py.Windows.Networking.Sockets.h"
#endif

#if __has_include("py.Windows.Storage.Streams.h")
#include "py.Windows.Storage.Streams.h"
#endif

namespace py::impl::Windows::Networking::Proximity
{
    struct DeviceArrivedEventHandler
    {
        static winrt::Windows::Networking::Proximity::DeviceArrivedEventHandler get(PyObject* callable)
        {
            py::delegate_callable _delegate{ callable };

            return [delegate = std::move(_delegate)](winrt::Windows::Networking::Proximity::ProximityDevice const& param0)
            {
                auto gil = py::ensure_gil();

                try
                {
                    py::pyobj_handle py_param0{py::convert(param0)};
                    if (!py_param0)
                    {
                        throw python_exception();
                    }

                    py::pyobj_handle return_value{PyObject_CallOneArg(delegate.callable(), py_param0.get())};
                    if (!return_value)
                    {
                        throw python_exception();
                    }
                }
                catch (python_exception)
                {
                    py::write_unraisable_and_throw();
                }
            };
        };
    };

    struct DeviceDepartedEventHandler
    {
        static winrt::Windows::Networking::Proximity::DeviceDepartedEventHandler get(PyObject* callable)
        {
            py::delegate_callable _delegate{ callable };

            return [delegate = std::move(_delegate)](winrt::Windows::Networking::Proximity::ProximityDevice const& param0)
            {
                auto gil = py::ensure_gil();

                try
                {
                    py::pyobj_handle py_param0{py::convert(param0)};
                    if (!py_param0)
                    {
                        throw python_exception();
                    }

                    py::pyobj_handle return_value{PyObject_CallOneArg(delegate.callable(), py_param0.get())};
                    if (!return_value)
                    {
                        throw python_exception();
                    }
                }
                catch (python_exception)
                {
                    py::write_unraisable_and_throw();
                }
            };
        };
    };

    struct MessageReceivedHandler
    {
        static winrt::Windows::Networking::Proximity::MessageReceivedHandler get(PyObject* callable)
        {
            py::delegate_callable _delegate{ callable };

            return [delegate = std::move(_delegate)](winrt::Windows::Networking::Proximity::ProximityDevice const& param0, winrt::Windows::Networking::Proximity::ProximityMessage const& param1)
            {
                auto gil = py::ensure_gil();

                try
                {
                    py::pyobj_handle py_param0{py::convert(param0)};
                    if (!py_param0)
                    {
                        throw python_exception();
                    }

                    py::pyobj_handle py_param1{py::convert(param1)};
                    if (!py_param1)
                    {
                        throw python_exception();
                    }

                    py::pyobj_handle args{PyTuple_Pack(2, py_param0.get(), py_param1.get())};
                    if (!args)
                    {
                        throw python_exception();
                    }

                    py::pyobj_handle return_value{PyObject_CallObject(delegate.callable(), args.get())};
                    if (!return_value)
                    {
                        throw python_exception();
                    }
                }
                catch (python_exception)
                {
                    py::write_unraisable_and_throw();
                }
            };
        };
    };

    struct MessageTransmittedHandler
    {
        static winrt::Windows::Networking::Proximity::MessageTransmittedHandler get(PyObject* callable)
        {
            py::delegate_callable _delegate{ callable };

            return [delegate = std::move(_delegate)](winrt::Windows::Networking::Proximity::ProximityDevice const& param0, int64_t param1)
            {
                auto gil = py::ensure_gil();

                try
                {
                    py::pyobj_handle py_param0{py::convert(param0)};
                    if (!py_param0)
                    {
                        throw python_exception();
                    }

                    py::pyobj_handle py_param1{py::convert(param1)};
                    if (!py_param1)
                    {
                        throw python_exception();
                    }

                    py::pyobj_handle args{PyTuple_Pack(2, py_param0.get(), py_param1.get())};
                    if (!args)
                    {
                        throw python_exception();
                    }

                    py::pyobj_handle return_value{PyObject_CallObject(delegate.callable(), args.get())};
                    if (!return_value)
                    {
                        throw python_exception();
                    }
                }
                catch (python_exception)
                {
                    py::write_unraisable_and_throw();
                }
            };
        };
    };
}

namespace py::wrapper::Windows::Networking::Proximity
{
    using ConnectionRequestedEventArgs = py::winrt_wrapper<winrt::Windows::Networking::Proximity::ConnectionRequestedEventArgs>;
    using PeerFinder = py::winrt_wrapper<winrt::Windows::Networking::Proximity::PeerFinder>;
    using PeerInformation = py::winrt_wrapper<winrt::Windows::Networking::Proximity::PeerInformation>;
    using PeerWatcher = py::winrt_wrapper<winrt::Windows::Networking::Proximity::PeerWatcher>;
    using ProximityDevice = py::winrt_wrapper<winrt::Windows::Networking::Proximity::ProximityDevice>;
    using ProximityMessage = py::winrt_wrapper<winrt::Windows::Networking::Proximity::ProximityMessage>;
    using TriggeredConnectionStateChangedEventArgs = py::winrt_wrapper<winrt::Windows::Networking::Proximity::TriggeredConnectionStateChangedEventArgs>;
}

namespace py
{
    template <>
    struct delegate_python_type<winrt::Windows::Networking::Proximity::DeviceArrivedEventHandler>
    {
        using type = py::impl::Windows::Networking::Proximity::DeviceArrivedEventHandler;
    };

    template <>
    struct delegate_python_type<winrt::Windows::Networking::Proximity::DeviceDepartedEventHandler>
    {
        using type = py::impl::Windows::Networking::Proximity::DeviceDepartedEventHandler;
    };

    template <>
    struct delegate_python_type<winrt::Windows::Networking::Proximity::MessageReceivedHandler>
    {
        using type = py::impl::Windows::Networking::Proximity::MessageReceivedHandler;
    };

    template <>
    struct delegate_python_type<winrt::Windows::Networking::Proximity::MessageTransmittedHandler>
    {
        using type = py::impl::Windows::Networking::Proximity::MessageTransmittedHandler;
    };

}
