// WARNING: Please don't edit this file. It was generated by Python/WinRT v1.0.0-beta.2

#include "pybase.h"
#include "py.Windows.Devices.Pwm.Provider.h"

PyTypeObject* py::winrt_type<winrt::Windows::Devices::Pwm::Provider::IPwmControllerProvider>::python_type;
PyTypeObject* py::winrt_type<winrt::Windows::Devices::Pwm::Provider::IPwmProvider>::python_type;

namespace py::cpp::Windows::Devices::Pwm::Provider
{
    // ----- IPwmControllerProvider interface --------------------
    constexpr const char* const _type_name_IPwmControllerProvider = "IPwmControllerProvider";

    static PyObject* _new_IPwmControllerProvider(PyTypeObject* /* unused */, PyObject* /* unused */, PyObject* /* unused */)
    {
        py::set_invalid_activation_error(_type_name_IPwmControllerProvider);
        return nullptr;
    }

    static void _dealloc_IPwmControllerProvider(py::wrapper::Windows::Devices::Pwm::Provider::IPwmControllerProvider* self)
    {
        auto hash_value = std::hash<winrt::Windows::Foundation::IInspectable>{}(self->obj);
        py::wrapped_instance(hash_value, nullptr);
        self->obj = nullptr;
    }

    static PyObject* IPwmControllerProvider_AcquirePin(py::wrapper::Windows::Devices::Pwm::Provider::IPwmControllerProvider* self, PyObject* args) noexcept
    {
        Py_ssize_t arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            try
            {
                auto param0 = py::convert_to<int32_t>(args, 0);

                self->obj.AcquirePin(param0);
                Py_RETURN_NONE;
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* IPwmControllerProvider_DisablePin(py::wrapper::Windows::Devices::Pwm::Provider::IPwmControllerProvider* self, PyObject* args) noexcept
    {
        Py_ssize_t arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            try
            {
                auto param0 = py::convert_to<int32_t>(args, 0);

                self->obj.DisablePin(param0);
                Py_RETURN_NONE;
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* IPwmControllerProvider_EnablePin(py::wrapper::Windows::Devices::Pwm::Provider::IPwmControllerProvider* self, PyObject* args) noexcept
    {
        Py_ssize_t arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            try
            {
                auto param0 = py::convert_to<int32_t>(args, 0);

                self->obj.EnablePin(param0);
                Py_RETURN_NONE;
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* IPwmControllerProvider_ReleasePin(py::wrapper::Windows::Devices::Pwm::Provider::IPwmControllerProvider* self, PyObject* args) noexcept
    {
        Py_ssize_t arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            try
            {
                auto param0 = py::convert_to<int32_t>(args, 0);

                self->obj.ReleasePin(param0);
                Py_RETURN_NONE;
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* IPwmControllerProvider_SetDesiredFrequency(py::wrapper::Windows::Devices::Pwm::Provider::IPwmControllerProvider* self, PyObject* args) noexcept
    {
        Py_ssize_t arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            try
            {
                auto param0 = py::convert_to<double>(args, 0);

                return py::convert(self->obj.SetDesiredFrequency(param0));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* IPwmControllerProvider_SetPulseParameters(py::wrapper::Windows::Devices::Pwm::Provider::IPwmControllerProvider* self, PyObject* args) noexcept
    {
        Py_ssize_t arg_count = PyTuple_Size(args);

        if (arg_count == 3)
        {
            try
            {
                auto param0 = py::convert_to<int32_t>(args, 0);
                auto param1 = py::convert_to<double>(args, 1);
                auto param2 = py::convert_to<bool>(args, 2);

                self->obj.SetPulseParameters(param0, param1, param2);
                Py_RETURN_NONE;
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* IPwmControllerProvider_get_ActualFrequency(py::wrapper::Windows::Devices::Pwm::Provider::IPwmControllerProvider* self, void* /*unused*/) noexcept
    {
        try
        {
            return py::convert(self->obj.ActualFrequency());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* IPwmControllerProvider_get_MaxFrequency(py::wrapper::Windows::Devices::Pwm::Provider::IPwmControllerProvider* self, void* /*unused*/) noexcept
    {
        try
        {
            return py::convert(self->obj.MaxFrequency());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* IPwmControllerProvider_get_MinFrequency(py::wrapper::Windows::Devices::Pwm::Provider::IPwmControllerProvider* self, void* /*unused*/) noexcept
    {
        try
        {
            return py::convert(self->obj.MinFrequency());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* IPwmControllerProvider_get_PinCount(py::wrapper::Windows::Devices::Pwm::Provider::IPwmControllerProvider* self, void* /*unused*/) noexcept
    {
        try
        {
            return py::convert(self->obj.PinCount());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _from_IPwmControllerProvider(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Windows::Devices::Pwm::Provider::IPwmControllerProvider>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_IPwmControllerProvider[] = {
        { "acquire_pin", reinterpret_cast<PyCFunction>(IPwmControllerProvider_AcquirePin), METH_VARARGS, nullptr },
        { "disable_pin", reinterpret_cast<PyCFunction>(IPwmControllerProvider_DisablePin), METH_VARARGS, nullptr },
        { "enable_pin", reinterpret_cast<PyCFunction>(IPwmControllerProvider_EnablePin), METH_VARARGS, nullptr },
        { "release_pin", reinterpret_cast<PyCFunction>(IPwmControllerProvider_ReleasePin), METH_VARARGS, nullptr },
        { "set_desired_frequency", reinterpret_cast<PyCFunction>(IPwmControllerProvider_SetDesiredFrequency), METH_VARARGS, nullptr },
        { "set_pulse_parameters", reinterpret_cast<PyCFunction>(IPwmControllerProvider_SetPulseParameters), METH_VARARGS, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_IPwmControllerProvider), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_IPwmControllerProvider[] = {
        { "actual_frequency", reinterpret_cast<getter>(IPwmControllerProvider_get_ActualFrequency), nullptr, nullptr, nullptr },
        { "max_frequency", reinterpret_cast<getter>(IPwmControllerProvider_get_MaxFrequency), nullptr, nullptr, nullptr },
        { "min_frequency", reinterpret_cast<getter>(IPwmControllerProvider_get_MinFrequency), nullptr, nullptr, nullptr },
        { "pin_count", reinterpret_cast<getter>(IPwmControllerProvider_get_PinCount), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_IPwmControllerProvider[] = 
    {
        { Py_tp_new, _new_IPwmControllerProvider },
        { Py_tp_dealloc, _dealloc_IPwmControllerProvider },
        { Py_tp_methods, _methods_IPwmControllerProvider },
        { Py_tp_getset, _getset_IPwmControllerProvider },
        { },
    };

    static PyType_Spec _type_spec_IPwmControllerProvider =
    {
        "_winsdk_Windows_Devices_Pwm_Provider.IPwmControllerProvider",
        sizeof(py::wrapper::Windows::Devices::Pwm::Provider::IPwmControllerProvider),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_IPwmControllerProvider
    };

    // ----- IPwmProvider interface --------------------
    constexpr const char* const _type_name_IPwmProvider = "IPwmProvider";

    static PyObject* _new_IPwmProvider(PyTypeObject* /* unused */, PyObject* /* unused */, PyObject* /* unused */)
    {
        py::set_invalid_activation_error(_type_name_IPwmProvider);
        return nullptr;
    }

    static void _dealloc_IPwmProvider(py::wrapper::Windows::Devices::Pwm::Provider::IPwmProvider* self)
    {
        auto hash_value = std::hash<winrt::Windows::Foundation::IInspectable>{}(self->obj);
        py::wrapped_instance(hash_value, nullptr);
        self->obj = nullptr;
    }

    static PyObject* IPwmProvider_GetControllers(py::wrapper::Windows::Devices::Pwm::Provider::IPwmProvider* self, PyObject* args) noexcept
    {
        Py_ssize_t arg_count = PyTuple_Size(args);

        if (arg_count == 0)
        {
            try
            {
                return py::convert(self->obj.GetControllers());
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static PyObject* _from_IPwmProvider(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        try
        {
            auto return_value = py::convert_to<winrt::Windows::Foundation::IInspectable>(arg);
            return py::convert(return_value.as<winrt::Windows::Devices::Pwm::Provider::IPwmProvider>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_IPwmProvider[] = {
        { "get_controllers", reinterpret_cast<PyCFunction>(IPwmProvider_GetControllers), METH_VARARGS, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_IPwmProvider), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_IPwmProvider[] = {
        { }
    };

    static PyType_Slot _type_slots_IPwmProvider[] = 
    {
        { Py_tp_new, _new_IPwmProvider },
        { Py_tp_dealloc, _dealloc_IPwmProvider },
        { Py_tp_methods, _methods_IPwmProvider },
        { Py_tp_getset, _getset_IPwmProvider },
        { },
    };

    static PyType_Spec _type_spec_IPwmProvider =
    {
        "_winsdk_Windows_Devices_Pwm_Provider.IPwmProvider",
        sizeof(py::wrapper::Windows::Devices::Pwm::Provider::IPwmProvider),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_IPwmProvider
    };

    // ----- Windows.Devices.Pwm.Provider Initialization --------------------
    static int module_exec(PyObject* module) noexcept
    {
        try
        {
            py::pyobj_handle bases { PyTuple_Pack(1, py::winrt_type<py::Object>::python_type) };

            py::winrt_type<winrt::Windows::Devices::Pwm::Provider::IPwmControllerProvider>::python_type = py::register_python_type(module, _type_name_IPwmControllerProvider, &_type_spec_IPwmControllerProvider, bases.get());
            py::winrt_type<winrt::Windows::Devices::Pwm::Provider::IPwmProvider>::python_type = py::register_python_type(module, _type_name_IPwmProvider, &_type_spec_IPwmProvider, bases.get());

            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyModuleDef_Slot module_slots[] = {{Py_mod_exec, module_exec}, {}};

    PyDoc_STRVAR(module_doc, "Windows.Devices.Pwm.Provider");

    static PyModuleDef module_def
        = {PyModuleDef_HEAD_INIT,
           "_winsdk_Windows_Devices_Pwm_Provider",
           module_doc,
           0,
           nullptr,
           module_slots,
           nullptr,
           nullptr,
           nullptr};
} // py::cpp::Windows::Devices::Pwm::Provider

PyMODINIT_FUNC
PyInit__winsdk_Windows_Devices_Pwm_Provider (void) noexcept
{
    return PyModuleDef_Init(&py::cpp::Windows::Devices::Pwm::Provider::module_def);
}
