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

#include "pybase.h"
#include "py.Windows.Globalization.DateTimeFormatting.h"


namespace py::cpp::Windows::Globalization::DateTimeFormatting
{
    struct module_state
    {
        PyObject* type_DayFormat;
        PyObject* type_DayOfWeekFormat;
        PyObject* type_HourFormat;
        PyObject* type_MinuteFormat;
        PyObject* type_MonthFormat;
        PyObject* type_SecondFormat;
        PyObject* type_YearFormat;
        PyTypeObject* type_DateTimeFormatter;
    };

    static PyObject* register_DayFormat(PyObject* module, PyObject* type) noexcept
    {
        auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));
        assert(state);

        if (state->type_DayFormat)
        {
            PyErr_SetString(PyExc_RuntimeError, "type has already been registered");
            return nullptr;
        }

        if (!PyType_Check(type))
        {
            PyErr_SetString(PyExc_TypeError, "argument is not a type");
            return nullptr;
        }

        state->type_DayFormat = type;
        Py_INCREF(state->type_DayFormat);


        Py_RETURN_NONE;
    }

    static PyObject* register_DayOfWeekFormat(PyObject* module, PyObject* type) noexcept
    {
        auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));
        assert(state);

        if (state->type_DayOfWeekFormat)
        {
            PyErr_SetString(PyExc_RuntimeError, "type has already been registered");
            return nullptr;
        }

        if (!PyType_Check(type))
        {
            PyErr_SetString(PyExc_TypeError, "argument is not a type");
            return nullptr;
        }

        state->type_DayOfWeekFormat = type;
        Py_INCREF(state->type_DayOfWeekFormat);


        Py_RETURN_NONE;
    }

    static PyObject* register_HourFormat(PyObject* module, PyObject* type) noexcept
    {
        auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));
        assert(state);

        if (state->type_HourFormat)
        {
            PyErr_SetString(PyExc_RuntimeError, "type has already been registered");
            return nullptr;
        }

        if (!PyType_Check(type))
        {
            PyErr_SetString(PyExc_TypeError, "argument is not a type");
            return nullptr;
        }

        state->type_HourFormat = type;
        Py_INCREF(state->type_HourFormat);


        Py_RETURN_NONE;
    }

    static PyObject* register_MinuteFormat(PyObject* module, PyObject* type) noexcept
    {
        auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));
        assert(state);

        if (state->type_MinuteFormat)
        {
            PyErr_SetString(PyExc_RuntimeError, "type has already been registered");
            return nullptr;
        }

        if (!PyType_Check(type))
        {
            PyErr_SetString(PyExc_TypeError, "argument is not a type");
            return nullptr;
        }

        state->type_MinuteFormat = type;
        Py_INCREF(state->type_MinuteFormat);


        Py_RETURN_NONE;
    }

    static PyObject* register_MonthFormat(PyObject* module, PyObject* type) noexcept
    {
        auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));
        assert(state);

        if (state->type_MonthFormat)
        {
            PyErr_SetString(PyExc_RuntimeError, "type has already been registered");
            return nullptr;
        }

        if (!PyType_Check(type))
        {
            PyErr_SetString(PyExc_TypeError, "argument is not a type");
            return nullptr;
        }

        state->type_MonthFormat = type;
        Py_INCREF(state->type_MonthFormat);


        Py_RETURN_NONE;
    }

    static PyObject* register_SecondFormat(PyObject* module, PyObject* type) noexcept
    {
        auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));
        assert(state);

        if (state->type_SecondFormat)
        {
            PyErr_SetString(PyExc_RuntimeError, "type has already been registered");
            return nullptr;
        }

        if (!PyType_Check(type))
        {
            PyErr_SetString(PyExc_TypeError, "argument is not a type");
            return nullptr;
        }

        state->type_SecondFormat = type;
        Py_INCREF(state->type_SecondFormat);


        Py_RETURN_NONE;
    }

    static PyObject* register_YearFormat(PyObject* module, PyObject* type) noexcept
    {
        auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));
        assert(state);

        if (state->type_YearFormat)
        {
            PyErr_SetString(PyExc_RuntimeError, "type has already been registered");
            return nullptr;
        }

        if (!PyType_Check(type))
        {
            PyErr_SetString(PyExc_TypeError, "argument is not a type");
            return nullptr;
        }

        state->type_YearFormat = type;
        Py_INCREF(state->type_YearFormat);


        Py_RETURN_NONE;
    }

    // ----- DateTimeFormatter class --------------------
    static constexpr const char* const type_name_DateTimeFormatter = "DateTimeFormatter";

    static PyObject* _new_DateTimeFormatter(PyTypeObject* type, PyObject* args, PyObject* kwds) noexcept
    {
        if (kwds != nullptr)
        {
            py::set_invalid_kwd_args_error();
            return nullptr;
        }

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

                winrt::Windows::Globalization::DateTimeFormatting::DateTimeFormatter instance{ param0 };
                return py::wrap(instance, type);
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else if (arg_count == 2)
        {
            try
            {
                auto param0 = py::convert_to<winrt::hstring>(args, 0);
                auto param1 = py::convert_to<winrt::Windows::Foundation::Collections::IIterable<winrt::hstring>>(args, 1);

                winrt::Windows::Globalization::DateTimeFormatting::DateTimeFormatter instance{ param0, param1 };
                return py::wrap(instance, type);
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else if (arg_count == 5)
        {
            try
            {
                auto param0 = py::convert_to<winrt::hstring>(args, 0);
                auto param1 = py::convert_to<winrt::Windows::Foundation::Collections::IIterable<winrt::hstring>>(args, 1);
                auto param2 = py::convert_to<winrt::hstring>(args, 2);
                auto param3 = py::convert_to<winrt::hstring>(args, 3);
                auto param4 = py::convert_to<winrt::hstring>(args, 4);

                winrt::Windows::Globalization::DateTimeFormatting::DateTimeFormatter instance{ param0, param1, param2, param3, param4 };
                return py::wrap(instance, type);
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else if (arg_count == 4)
        {
            try
            {
                auto param0 = py::convert_to<winrt::Windows::Globalization::DateTimeFormatting::YearFormat>(args, 0);
                auto param1 = py::convert_to<winrt::Windows::Globalization::DateTimeFormatting::MonthFormat>(args, 1);
                auto param2 = py::convert_to<winrt::Windows::Globalization::DateTimeFormatting::DayFormat>(args, 2);
                auto param3 = py::convert_to<winrt::Windows::Globalization::DateTimeFormatting::DayOfWeekFormat>(args, 3);

                winrt::Windows::Globalization::DateTimeFormatting::DateTimeFormatter instance{ param0, param1, param2, param3 };
                return py::wrap(instance, type);
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else if (arg_count == 3)
        {
            try
            {
                auto param0 = py::convert_to<winrt::Windows::Globalization::DateTimeFormatting::HourFormat>(args, 0);
                auto param1 = py::convert_to<winrt::Windows::Globalization::DateTimeFormatting::MinuteFormat>(args, 1);
                auto param2 = py::convert_to<winrt::Windows::Globalization::DateTimeFormatting::SecondFormat>(args, 2);

                winrt::Windows::Globalization::DateTimeFormatting::DateTimeFormatter instance{ param0, param1, param2 };
                return py::wrap(instance, type);
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else if (arg_count == 8)
        {
            try
            {
                auto param0 = py::convert_to<winrt::Windows::Globalization::DateTimeFormatting::YearFormat>(args, 0);
                auto param1 = py::convert_to<winrt::Windows::Globalization::DateTimeFormatting::MonthFormat>(args, 1);
                auto param2 = py::convert_to<winrt::Windows::Globalization::DateTimeFormatting::DayFormat>(args, 2);
                auto param3 = py::convert_to<winrt::Windows::Globalization::DateTimeFormatting::DayOfWeekFormat>(args, 3);
                auto param4 = py::convert_to<winrt::Windows::Globalization::DateTimeFormatting::HourFormat>(args, 4);
                auto param5 = py::convert_to<winrt::Windows::Globalization::DateTimeFormatting::MinuteFormat>(args, 5);
                auto param6 = py::convert_to<winrt::Windows::Globalization::DateTimeFormatting::SecondFormat>(args, 6);
                auto param7 = py::convert_to<winrt::Windows::Foundation::Collections::IIterable<winrt::hstring>>(args, 7);

                winrt::Windows::Globalization::DateTimeFormatting::DateTimeFormatter instance{ param0, param1, param2, param3, param4, param5, param6, param7 };
                return py::wrap(instance, type);
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else if (arg_count == 11)
        {
            try
            {
                auto param0 = py::convert_to<winrt::Windows::Globalization::DateTimeFormatting::YearFormat>(args, 0);
                auto param1 = py::convert_to<winrt::Windows::Globalization::DateTimeFormatting::MonthFormat>(args, 1);
                auto param2 = py::convert_to<winrt::Windows::Globalization::DateTimeFormatting::DayFormat>(args, 2);
                auto param3 = py::convert_to<winrt::Windows::Globalization::DateTimeFormatting::DayOfWeekFormat>(args, 3);
                auto param4 = py::convert_to<winrt::Windows::Globalization::DateTimeFormatting::HourFormat>(args, 4);
                auto param5 = py::convert_to<winrt::Windows::Globalization::DateTimeFormatting::MinuteFormat>(args, 5);
                auto param6 = py::convert_to<winrt::Windows::Globalization::DateTimeFormatting::SecondFormat>(args, 6);
                auto param7 = py::convert_to<winrt::Windows::Foundation::Collections::IIterable<winrt::hstring>>(args, 7);
                auto param8 = py::convert_to<winrt::hstring>(args, 8);
                auto param9 = py::convert_to<winrt::hstring>(args, 9);
                auto param10 = py::convert_to<winrt::hstring>(args, 10);

                winrt::Windows::Globalization::DateTimeFormatting::DateTimeFormatter instance{ param0, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10 };
                return py::wrap(instance, type);
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else
        {
            py::set_invalid_arg_count_error(arg_count);
            return nullptr;
        }
    }

    static void _dealloc_DateTimeFormatter(py::wrapper::Windows::Globalization::DateTimeFormatting::DateTimeFormatter* self) noexcept
    {
        auto tp = Py_TYPE(self);

        if (PyType_IS_GC(tp))
        {
            PyObject_GC_UnTrack(self);
        }

        std::destroy_at(&self->obj);
        tp->tp_free(self);
        Py_DECREF(tp);
    }

    static PyObject* DateTimeFormatter_Format(py::wrapper::Windows::Globalization::DateTimeFormatting::DateTimeFormatter* self, PyObject* args) noexcept
    {
        auto arg_count = PyTuple_Size(args);

        if (arg_count == 1)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Globalization.DateTimeFormatting.DateTimeFormatter", L"Format", 1))
            {
                py::set_arg_count_version_error(1);
                return nullptr;
            }

            try
            {
                auto param0 = py::convert_to<winrt::Windows::Foundation::DateTime>(args, 0);

                return py::convert(self->obj.Format(param0));
            }
            catch (...)
            {
                py::to_PyErr();
                return nullptr;
            }
        }
        else if (arg_count == 2)
        {
            if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsMethodPresent(L"Windows.Globalization.DateTimeFormatting.DateTimeFormatter", L"Format", 2))
            {
                py::set_arg_count_version_error(2);
                return nullptr;
            }

            try
            {
                auto param0 = py::convert_to<winrt::Windows::Foundation::DateTime>(args, 0);
                auto param1 = py::convert_to<winrt::hstring>(args, 1);

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

    static PyObject* DateTimeFormatter_get_NumeralSystem(py::wrapper::Windows::Globalization::DateTimeFormatting::DateTimeFormatter* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Globalization.DateTimeFormatting.DateTimeFormatter", L"NumeralSystem"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.NumeralSystem());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static int DateTimeFormatter_put_NumeralSystem(py::wrapper::Windows::Globalization::DateTimeFormatting::DateTimeFormatter* self, PyObject* arg, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Globalization.DateTimeFormatting.DateTimeFormatter", L"NumeralSystem"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return -1;
        }

        if (arg == nullptr)
        {
            PyErr_SetString(PyExc_AttributeError, "can't delete attribute");
            return -1;
        }

        try
        {
            auto param0 = py::convert_to<winrt::hstring>(arg);

            self->obj.NumeralSystem(param0);
            return 0;
        }
        catch (...)
        {
            py::to_PyErr();
            return -1;
        }
    }

    static PyObject* DateTimeFormatter_get_Clock(py::wrapper::Windows::Globalization::DateTimeFormatting::DateTimeFormatter* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Globalization.DateTimeFormatting.DateTimeFormatter", L"Clock"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.Clock());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* DateTimeFormatter_get_GeographicRegion(py::wrapper::Windows::Globalization::DateTimeFormatting::DateTimeFormatter* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Globalization.DateTimeFormatting.DateTimeFormatter", L"GeographicRegion"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.GeographicRegion());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* DateTimeFormatter_get_IncludeDay(py::wrapper::Windows::Globalization::DateTimeFormatting::DateTimeFormatter* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Globalization.DateTimeFormatting.DateTimeFormatter", L"IncludeDay"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.IncludeDay());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* DateTimeFormatter_get_IncludeDayOfWeek(py::wrapper::Windows::Globalization::DateTimeFormatting::DateTimeFormatter* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Globalization.DateTimeFormatting.DateTimeFormatter", L"IncludeDayOfWeek"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.IncludeDayOfWeek());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* DateTimeFormatter_get_IncludeHour(py::wrapper::Windows::Globalization::DateTimeFormatting::DateTimeFormatter* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Globalization.DateTimeFormatting.DateTimeFormatter", L"IncludeHour"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.IncludeHour());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* DateTimeFormatter_get_IncludeMinute(py::wrapper::Windows::Globalization::DateTimeFormatting::DateTimeFormatter* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Globalization.DateTimeFormatting.DateTimeFormatter", L"IncludeMinute"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.IncludeMinute());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* DateTimeFormatter_get_IncludeMonth(py::wrapper::Windows::Globalization::DateTimeFormatting::DateTimeFormatter* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Globalization.DateTimeFormatting.DateTimeFormatter", L"IncludeMonth"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.IncludeMonth());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* DateTimeFormatter_get_IncludeSecond(py::wrapper::Windows::Globalization::DateTimeFormatting::DateTimeFormatter* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Globalization.DateTimeFormatting.DateTimeFormatter", L"IncludeSecond"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.IncludeSecond());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* DateTimeFormatter_get_IncludeYear(py::wrapper::Windows::Globalization::DateTimeFormatting::DateTimeFormatter* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Globalization.DateTimeFormatting.DateTimeFormatter", L"IncludeYear"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.IncludeYear());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* DateTimeFormatter_get_Languages(py::wrapper::Windows::Globalization::DateTimeFormatting::DateTimeFormatter* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Globalization.DateTimeFormatting.DateTimeFormatter", L"Languages"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.Languages());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* DateTimeFormatter_get_Calendar(py::wrapper::Windows::Globalization::DateTimeFormatting::DateTimeFormatter* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Globalization.DateTimeFormatting.DateTimeFormatter", L"Calendar"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.Calendar());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* DateTimeFormatter_get_Patterns(py::wrapper::Windows::Globalization::DateTimeFormatting::DateTimeFormatter* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Globalization.DateTimeFormatting.DateTimeFormatter", L"Patterns"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.Patterns());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* DateTimeFormatter_get_ResolvedGeographicRegion(py::wrapper::Windows::Globalization::DateTimeFormatting::DateTimeFormatter* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Globalization.DateTimeFormatting.DateTimeFormatter", L"ResolvedGeographicRegion"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.ResolvedGeographicRegion());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* DateTimeFormatter_get_ResolvedLanguage(py::wrapper::Windows::Globalization::DateTimeFormatting::DateTimeFormatter* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Globalization.DateTimeFormatting.DateTimeFormatter", L"ResolvedLanguage"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.ResolvedLanguage());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* DateTimeFormatter_get_Template(py::wrapper::Windows::Globalization::DateTimeFormatting::DateTimeFormatter* self, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Globalization.DateTimeFormatting.DateTimeFormatter", L"Template"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(self->obj.Template());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* DateTimeFormatter_get_LongDate(PyObject* /*unused*/, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Globalization.DateTimeFormatting.DateTimeFormatter", L"LongDate"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(winrt::Windows::Globalization::DateTimeFormatting::DateTimeFormatter::LongDate());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* DateTimeFormatter_get_LongTime(PyObject* /*unused*/, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Globalization.DateTimeFormatting.DateTimeFormatter", L"LongTime"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(winrt::Windows::Globalization::DateTimeFormatting::DateTimeFormatter::LongTime());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* DateTimeFormatter_get_ShortDate(PyObject* /*unused*/, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Globalization.DateTimeFormatting.DateTimeFormatter", L"ShortDate"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(winrt::Windows::Globalization::DateTimeFormatting::DateTimeFormatter::ShortDate());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* DateTimeFormatter_get_ShortTime(PyObject* /*unused*/, void* /*unused*/) noexcept
    {
        if (!winrt::Windows::Foundation::Metadata::ApiInformation::IsPropertyPresent(L"Windows.Globalization.DateTimeFormatting.DateTimeFormatter", L"ShortTime"))
        {
            PyErr_SetString(PyExc_AttributeError, "property is not available in this version of Windows");
            return nullptr;
        }

        try
        {
            return py::convert(winrt::Windows::Globalization::DateTimeFormatting::DateTimeFormatter::ShortTime());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyObject* _assign_array_DateTimeFormatter(PyObject* /*unused*/, PyObject* arg) noexcept
    {
        auto array = std::make_unique<py::ComArray<winrt::Windows::Globalization::DateTimeFormatting::DateTimeFormatter>>();
        if (!py::cpp::_winrt::Array_Assign(arg, std::move(array)))
        {
            return nullptr;
        }
        Py_RETURN_NONE;
    }

    static PyObject* _from_DateTimeFormatter(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::Globalization::DateTimeFormatting::DateTimeFormatter>());
        }
        catch (...)
        {
            py::to_PyErr();
            return nullptr;
        }
    }

    static PyMethodDef _methods_DateTimeFormatter[] = {
        { "format", reinterpret_cast<PyCFunction>(DateTimeFormatter_Format), METH_VARARGS, nullptr },
        { "_assign_array_", _assign_array_DateTimeFormatter, METH_O | METH_STATIC, nullptr },
        { "_from", reinterpret_cast<PyCFunction>(_from_DateTimeFormatter), METH_O | METH_STATIC, nullptr },
        { }
    };

    static PyGetSetDef _getset_DateTimeFormatter[] = {
        { "numeral_system", reinterpret_cast<getter>(DateTimeFormatter_get_NumeralSystem), reinterpret_cast<setter>(DateTimeFormatter_put_NumeralSystem), nullptr, nullptr },
        { "clock", reinterpret_cast<getter>(DateTimeFormatter_get_Clock), nullptr, nullptr, nullptr },
        { "geographic_region", reinterpret_cast<getter>(DateTimeFormatter_get_GeographicRegion), nullptr, nullptr, nullptr },
        { "include_day", reinterpret_cast<getter>(DateTimeFormatter_get_IncludeDay), nullptr, nullptr, nullptr },
        { "include_day_of_week", reinterpret_cast<getter>(DateTimeFormatter_get_IncludeDayOfWeek), nullptr, nullptr, nullptr },
        { "include_hour", reinterpret_cast<getter>(DateTimeFormatter_get_IncludeHour), nullptr, nullptr, nullptr },
        { "include_minute", reinterpret_cast<getter>(DateTimeFormatter_get_IncludeMinute), nullptr, nullptr, nullptr },
        { "include_month", reinterpret_cast<getter>(DateTimeFormatter_get_IncludeMonth), nullptr, nullptr, nullptr },
        { "include_second", reinterpret_cast<getter>(DateTimeFormatter_get_IncludeSecond), nullptr, nullptr, nullptr },
        { "include_year", reinterpret_cast<getter>(DateTimeFormatter_get_IncludeYear), nullptr, nullptr, nullptr },
        { "languages", reinterpret_cast<getter>(DateTimeFormatter_get_Languages), nullptr, nullptr, nullptr },
        { "calendar", reinterpret_cast<getter>(DateTimeFormatter_get_Calendar), nullptr, nullptr, nullptr },
        { "patterns", reinterpret_cast<getter>(DateTimeFormatter_get_Patterns), nullptr, nullptr, nullptr },
        { "resolved_geographic_region", reinterpret_cast<getter>(DateTimeFormatter_get_ResolvedGeographicRegion), nullptr, nullptr, nullptr },
        { "resolved_language", reinterpret_cast<getter>(DateTimeFormatter_get_ResolvedLanguage), nullptr, nullptr, nullptr },
        { "template", reinterpret_cast<getter>(DateTimeFormatter_get_Template), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot _type_slots_DateTimeFormatter[] = 
    {
        { Py_tp_new, reinterpret_cast<void*>(_new_DateTimeFormatter) },
        { Py_tp_dealloc, reinterpret_cast<void*>(_dealloc_DateTimeFormatter) },
        { Py_tp_methods, reinterpret_cast<void*>(_methods_DateTimeFormatter) },
        { Py_tp_getset, reinterpret_cast<void*>(_getset_DateTimeFormatter) },
        { },
    };

    static PyType_Spec type_spec_DateTimeFormatter =
    {
        "_winsdk_Windows_Globalization_DateTimeFormatting.DateTimeFormatter",
        sizeof(py::wrapper::Windows::Globalization::DateTimeFormatting::DateTimeFormatter),
        0,
        Py_TPFLAGS_DEFAULT,
        _type_slots_DateTimeFormatter
    };

    static PyGetSetDef getset_DateTimeFormatter_Meta[] = {
        { "long_date", reinterpret_cast<getter>(DateTimeFormatter_get_LongDate), nullptr, nullptr, nullptr },
        { "long_time", reinterpret_cast<getter>(DateTimeFormatter_get_LongTime), nullptr, nullptr, nullptr },
        { "short_date", reinterpret_cast<getter>(DateTimeFormatter_get_ShortDate), nullptr, nullptr, nullptr },
        { "short_time", reinterpret_cast<getter>(DateTimeFormatter_get_ShortTime), nullptr, nullptr, nullptr },
        { }
    };

    static PyType_Slot type_slots_DateTimeFormatter_Meta[] = 
    {
        { Py_tp_base, reinterpret_cast<void*>(&PyType_Type) },
        { Py_tp_getset, reinterpret_cast<void*>(getset_DateTimeFormatter_Meta) },
        { }
    };

    static PyType_Spec type_spec_DateTimeFormatter_Meta =
    {
        "_winsdk_Windows_Globalization_DateTimeFormatting.DateTimeFormatter_Meta",
        static_cast<int>(PyType_Type.tp_basicsize),
        static_cast<int>(PyType_Type.tp_itemsize),
        Py_TPFLAGS_DEFAULT,
        type_slots_DateTimeFormatter_Meta
    };

    // ----- Windows.Globalization.DateTimeFormatting Initialization --------------------
    PyDoc_STRVAR(module_doc, "Windows::Globalization::DateTimeFormatting");

    static PyMethodDef module_methods[] = {
        {"_register_DayFormat", register_DayFormat, METH_O, "registers type"},
        {"_register_DayOfWeekFormat", register_DayOfWeekFormat, METH_O, "registers type"},
        {"_register_HourFormat", register_HourFormat, METH_O, "registers type"},
        {"_register_MinuteFormat", register_MinuteFormat, METH_O, "registers type"},
        {"_register_MonthFormat", register_MonthFormat, METH_O, "registers type"},
        {"_register_SecondFormat", register_SecondFormat, METH_O, "registers type"},
        {"_register_YearFormat", register_YearFormat, METH_O, "registers type"},
        {}};


    static int module_traverse(PyObject* module, visitproc visit, void* arg) noexcept
    {
        auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));

        if (!state)
        {
            return 0;
        }

        Py_VISIT(state->type_DayFormat);
        Py_VISIT(state->type_DayOfWeekFormat);
        Py_VISIT(state->type_HourFormat);
        Py_VISIT(state->type_MinuteFormat);
        Py_VISIT(state->type_MonthFormat);
        Py_VISIT(state->type_SecondFormat);
        Py_VISIT(state->type_YearFormat);
        Py_VISIT(state->type_DateTimeFormatter);

        return 0;
    }

    static int module_clear(PyObject* module) noexcept
    {
        auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));

        if (!state)
        {
            return 0;
        }

        Py_CLEAR(state->type_DayFormat);
        Py_CLEAR(state->type_DayOfWeekFormat);
        Py_CLEAR(state->type_HourFormat);
        Py_CLEAR(state->type_MinuteFormat);
        Py_CLEAR(state->type_MonthFormat);
        Py_CLEAR(state->type_SecondFormat);
        Py_CLEAR(state->type_YearFormat);
        Py_CLEAR(state->type_DateTimeFormatter);

        return 0;
    }


    static PyModuleDef module_def
        = {PyModuleDef_HEAD_INIT,
           "_winsdk_Windows_Globalization_DateTimeFormatting",
           module_doc,
           sizeof(module_state),
           module_methods,
           nullptr,
           module_traverse,
           module_clear,
           nullptr};

} // py::cpp::Windows::Globalization::DateTimeFormatting

PyMODINIT_FUNC PyInit__winsdk_Windows_Globalization_DateTimeFormatting(void) noexcept
{
    using namespace py::cpp::Windows::Globalization::DateTimeFormatting;

    py::pyobj_handle module{PyModule_Create(&module_def)};

    if (!module)
    {
        return nullptr;
    }

    auto object_type = py::get_python_type<py::Object>();
    if (!object_type)
    {
        return nullptr;
    }

    py::pyobj_handle bases{PyTuple_Pack(1, object_type)};

    if (!bases)
    {
        return nullptr;
    }

    py::pyobj_handle collections_abc_module{PyImport_ImportModule("collections.abc")};

    if (!collections_abc_module)
    {
        return nullptr;
    }

    py::pyobj_handle sequence_type{PyObject_GetAttrString(collections_abc_module.get(), "Sequence")};

    if (!sequence_type)
    {
        return nullptr;
    }

    py::pyobj_handle sequence_bases{PyTuple_Pack(2, object_type, sequence_type.get())};

    if (!sequence_bases)
    {
        return nullptr;
    }

    py::pyobj_handle mutable_sequence_type{PyObject_GetAttrString(collections_abc_module.get(), "MutableSequence")};

    if (!mutable_sequence_type)
    {
        return nullptr;
    }

    py::pyobj_handle mutable_sequence_bases{PyTuple_Pack(2, object_type, mutable_sequence_type.get())};

    if (!mutable_sequence_bases)
    {
        return nullptr;
    }

    py::pyobj_handle mapping_type{PyObject_GetAttrString(collections_abc_module.get(), "Mapping")};

    if (!mapping_type)
    {
        return nullptr;
    }

    py::pyobj_handle mapping_bases{PyTuple_Pack(2, object_type, mapping_type.get())};

    if (!mapping_bases)
    {
        return nullptr;
    }

    py::pyobj_handle mutable_mapping_type{PyObject_GetAttrString(collections_abc_module.get(), "MutableMapping")};

    if (!mutable_mapping_type)
    {
        return nullptr;
    }

    py::pyobj_handle mutable_mapping_bases{PyTuple_Pack(2, object_type, mutable_mapping_type.get())};

    if (!mutable_mapping_bases)
    {
        return nullptr;
    }

    auto state = reinterpret_cast<module_state*>(PyModule_GetState(module.get()));
    assert(state);

    py::pyobj_handle type_DateTimeFormatter_Meta{PyType_FromSpec(&type_spec_DateTimeFormatter_Meta)};
    if (!type_DateTimeFormatter_Meta)
    {
        return nullptr;
    }

    state->type_DateTimeFormatter = py::register_python_type(module.get(), type_name_DateTimeFormatter, &type_spec_DateTimeFormatter, bases.get(), reinterpret_cast<PyTypeObject*>(type_DateTimeFormatter_Meta.get()));
    if (!state->type_DateTimeFormatter)
    {
        return nullptr;
    }


    return module.detach();
}

PyObject* py::py_type<winrt::Windows::Globalization::DateTimeFormatting::DayFormat>::get_python_type() noexcept {
    using namespace py::cpp::Windows::Globalization::DateTimeFormatting;

    PyObject* module = PyState_FindModule(&module_def);

    if (!module) {
        PyErr_SetString(PyExc_RuntimeError, "could not find module for Windows::Globalization::DateTimeFormatting");
        return nullptr;
    }

    auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));
    assert(state);

    auto python_type = state->type_DayFormat;

    if (!python_type) {
        PyErr_SetString(PyExc_RuntimeError, "type winrt::Windows::Globalization::DateTimeFormatting::DayFormat is not registered");
        return nullptr;
    }

    return python_type;
}

PyObject* py::py_type<winrt::Windows::Globalization::DateTimeFormatting::DayOfWeekFormat>::get_python_type() noexcept {
    using namespace py::cpp::Windows::Globalization::DateTimeFormatting;

    PyObject* module = PyState_FindModule(&module_def);

    if (!module) {
        PyErr_SetString(PyExc_RuntimeError, "could not find module for Windows::Globalization::DateTimeFormatting");
        return nullptr;
    }

    auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));
    assert(state);

    auto python_type = state->type_DayOfWeekFormat;

    if (!python_type) {
        PyErr_SetString(PyExc_RuntimeError, "type winrt::Windows::Globalization::DateTimeFormatting::DayOfWeekFormat is not registered");
        return nullptr;
    }

    return python_type;
}

PyObject* py::py_type<winrt::Windows::Globalization::DateTimeFormatting::HourFormat>::get_python_type() noexcept {
    using namespace py::cpp::Windows::Globalization::DateTimeFormatting;

    PyObject* module = PyState_FindModule(&module_def);

    if (!module) {
        PyErr_SetString(PyExc_RuntimeError, "could not find module for Windows::Globalization::DateTimeFormatting");
        return nullptr;
    }

    auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));
    assert(state);

    auto python_type = state->type_HourFormat;

    if (!python_type) {
        PyErr_SetString(PyExc_RuntimeError, "type winrt::Windows::Globalization::DateTimeFormatting::HourFormat is not registered");
        return nullptr;
    }

    return python_type;
}

PyObject* py::py_type<winrt::Windows::Globalization::DateTimeFormatting::MinuteFormat>::get_python_type() noexcept {
    using namespace py::cpp::Windows::Globalization::DateTimeFormatting;

    PyObject* module = PyState_FindModule(&module_def);

    if (!module) {
        PyErr_SetString(PyExc_RuntimeError, "could not find module for Windows::Globalization::DateTimeFormatting");
        return nullptr;
    }

    auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));
    assert(state);

    auto python_type = state->type_MinuteFormat;

    if (!python_type) {
        PyErr_SetString(PyExc_RuntimeError, "type winrt::Windows::Globalization::DateTimeFormatting::MinuteFormat is not registered");
        return nullptr;
    }

    return python_type;
}

PyObject* py::py_type<winrt::Windows::Globalization::DateTimeFormatting::MonthFormat>::get_python_type() noexcept {
    using namespace py::cpp::Windows::Globalization::DateTimeFormatting;

    PyObject* module = PyState_FindModule(&module_def);

    if (!module) {
        PyErr_SetString(PyExc_RuntimeError, "could not find module for Windows::Globalization::DateTimeFormatting");
        return nullptr;
    }

    auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));
    assert(state);

    auto python_type = state->type_MonthFormat;

    if (!python_type) {
        PyErr_SetString(PyExc_RuntimeError, "type winrt::Windows::Globalization::DateTimeFormatting::MonthFormat is not registered");
        return nullptr;
    }

    return python_type;
}

PyObject* py::py_type<winrt::Windows::Globalization::DateTimeFormatting::SecondFormat>::get_python_type() noexcept {
    using namespace py::cpp::Windows::Globalization::DateTimeFormatting;

    PyObject* module = PyState_FindModule(&module_def);

    if (!module) {
        PyErr_SetString(PyExc_RuntimeError, "could not find module for Windows::Globalization::DateTimeFormatting");
        return nullptr;
    }

    auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));
    assert(state);

    auto python_type = state->type_SecondFormat;

    if (!python_type) {
        PyErr_SetString(PyExc_RuntimeError, "type winrt::Windows::Globalization::DateTimeFormatting::SecondFormat is not registered");
        return nullptr;
    }

    return python_type;
}

PyObject* py::py_type<winrt::Windows::Globalization::DateTimeFormatting::YearFormat>::get_python_type() noexcept {
    using namespace py::cpp::Windows::Globalization::DateTimeFormatting;

    PyObject* module = PyState_FindModule(&module_def);

    if (!module) {
        PyErr_SetString(PyExc_RuntimeError, "could not find module for Windows::Globalization::DateTimeFormatting");
        return nullptr;
    }

    auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));
    assert(state);

    auto python_type = state->type_YearFormat;

    if (!python_type) {
        PyErr_SetString(PyExc_RuntimeError, "type winrt::Windows::Globalization::DateTimeFormatting::YearFormat is not registered");
        return nullptr;
    }

    return python_type;
}

PyTypeObject* py::winrt_type<winrt::Windows::Globalization::DateTimeFormatting::DateTimeFormatter>::get_python_type() noexcept {
    using namespace py::cpp::Windows::Globalization::DateTimeFormatting;

    PyObject* module = PyState_FindModule(&module_def);

    if (!module) {
        PyErr_SetString(PyExc_RuntimeError, "could not find module for Windows::Globalization::DateTimeFormatting");
        return nullptr;
    }

    auto state = reinterpret_cast<module_state*>(PyModule_GetState(module));
    assert(state);

    auto python_type = state->type_DateTimeFormatter;

    if (!python_type) {
        PyErr_SetString(PyExc_RuntimeError, "type winrt::Windows::Globalization::DateTimeFormatting::DateTimeFormatter is not registered");
        return nullptr;
    }

    return python_type;
}
