// C++/WinRT v2.0.190620.2

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

#ifndef WINRT_Windows_Media_Protection_H
#define WINRT_Windows_Media_Protection_H
#include "base.h"
static_assert(winrt::check_version(CPPWINRT_VERSION, "2.0.190620.2"), "Mismatched C++/WinRT headers.");
#include "Windows.Media.h"
#include "impl/Windows.Foundation.2.h"
#include "impl/Windows.Foundation.Collections.2.h"
#include "impl/Windows.Media.Playback.2.h"
#include "impl/Windows.Media.Protection.2.h"
namespace winrt::impl
{
    template <typename D> auto consume_Windows_Media_Protection_IComponentLoadFailedEventArgs<D>::Information() const
    {
        void* value{};
        check_hresult(WINRT_IMPL_SHIM(Windows::Media::Protection::IComponentLoadFailedEventArgs)->get_Information(&value));
        return Windows::Media::Protection::RevocationAndRenewalInformation{ value, take_ownership_from_abi };
    }
    template <typename D> auto consume_Windows_Media_Protection_IComponentLoadFailedEventArgs<D>::Completion() const
    {
        void* value{};
        check_hresult(WINRT_IMPL_SHIM(Windows::Media::Protection::IComponentLoadFailedEventArgs)->get_Completion(&value));
        return Windows::Media::Protection::MediaProtectionServiceCompletion{ value, take_ownership_from_abi };
    }
    template <typename D> auto consume_Windows_Media_Protection_IComponentRenewalStatics<D>::RenewSystemComponentsAsync(Windows::Media::Protection::RevocationAndRenewalInformation const& information) const
    {
        void* operation{};
        check_hresult(WINRT_IMPL_SHIM(Windows::Media::Protection::IComponentRenewalStatics)->RenewSystemComponentsAsync(*(void**)(&information), &operation));
        return Windows::Foundation::IAsyncOperationWithProgress<Windows::Media::Protection::RenewalStatus, uint32_t>{ operation, take_ownership_from_abi };
    }
    template <typename D> auto consume_Windows_Media_Protection_IHdcpSession<D>::IsEffectiveProtectionAtLeast(Windows::Media::Protection::HdcpProtection const& protection) const
    {
        bool value;
        check_hresult(WINRT_IMPL_SHIM(Windows::Media::Protection::IHdcpSession)->IsEffectiveProtectionAtLeast(static_cast<int32_t>(protection), &value));
        return value;
    }
    template <typename D> auto consume_Windows_Media_Protection_IHdcpSession<D>::GetEffectiveProtection() const
    {
        void* value{};
        check_hresult(WINRT_IMPL_SHIM(Windows::Media::Protection::IHdcpSession)->GetEffectiveProtection(&value));
        return Windows::Foundation::IReference<Windows::Media::Protection::HdcpProtection>{ value, take_ownership_from_abi };
    }
    template <typename D> auto consume_Windows_Media_Protection_IHdcpSession<D>::SetDesiredMinProtectionAsync(Windows::Media::Protection::HdcpProtection const& protection) const
    {
        void* value{};
        check_hresult(WINRT_IMPL_SHIM(Windows::Media::Protection::IHdcpSession)->SetDesiredMinProtectionAsync(static_cast<int32_t>(protection), &value));
        return Windows::Foundation::IAsyncOperation<Windows::Media::Protection::HdcpSetProtectionResult>{ value, take_ownership_from_abi };
    }
    template <typename D> auto consume_Windows_Media_Protection_IHdcpSession<D>::ProtectionChanged(Windows::Foundation::TypedEventHandler<Windows::Media::Protection::HdcpSession, Windows::Foundation::IInspectable> const& handler) const
    {
        winrt::event_token token;
        check_hresult(WINRT_IMPL_SHIM(Windows::Media::Protection::IHdcpSession)->add_ProtectionChanged(*(void**)(&handler), put_abi(token)));
        return token;
    }
    template <typename D> typename consume_Windows_Media_Protection_IHdcpSession<D>::ProtectionChanged_revoker consume_Windows_Media_Protection_IHdcpSession<D>::ProtectionChanged(auto_revoke_t, Windows::Foundation::TypedEventHandler<Windows::Media::Protection::HdcpSession, Windows::Foundation::IInspectable> const& handler) const
    {
        return impl::make_event_revoker<D, ProtectionChanged_revoker>(this, ProtectionChanged(handler));
    }
    template <typename D> auto consume_Windows_Media_Protection_IHdcpSession<D>::ProtectionChanged(winrt::event_token const& token) const noexcept
    {
        WINRT_VERIFY_(0, WINRT_IMPL_SHIM(Windows::Media::Protection::IHdcpSession)->remove_ProtectionChanged(impl::bind_in(token)));
    }
    template <typename D> auto consume_Windows_Media_Protection_IMediaProtectionManager<D>::ServiceRequested(Windows::Media::Protection::ServiceRequestedEventHandler const& handler) const
    {
        winrt::event_token cookie;
        check_hresult(WINRT_IMPL_SHIM(Windows::Media::Protection::IMediaProtectionManager)->add_ServiceRequested(*(void**)(&handler), put_abi(cookie)));
        return cookie;
    }
    template <typename D> typename consume_Windows_Media_Protection_IMediaProtectionManager<D>::ServiceRequested_revoker consume_Windows_Media_Protection_IMediaProtectionManager<D>::ServiceRequested(auto_revoke_t, Windows::Media::Protection::ServiceRequestedEventHandler const& handler) const
    {
        return impl::make_event_revoker<D, ServiceRequested_revoker>(this, ServiceRequested(handler));
    }
    template <typename D> auto consume_Windows_Media_Protection_IMediaProtectionManager<D>::ServiceRequested(winrt::event_token const& cookie) const noexcept
    {
        WINRT_VERIFY_(0, WINRT_IMPL_SHIM(Windows::Media::Protection::IMediaProtectionManager)->remove_ServiceRequested(impl::bind_in(cookie)));
    }
    template <typename D> auto consume_Windows_Media_Protection_IMediaProtectionManager<D>::RebootNeeded(Windows::Media::Protection::RebootNeededEventHandler const& handler) const
    {
        winrt::event_token cookie;
        check_hresult(WINRT_IMPL_SHIM(Windows::Media::Protection::IMediaProtectionManager)->add_RebootNeeded(*(void**)(&handler), put_abi(cookie)));
        return cookie;
    }
    template <typename D> typename consume_Windows_Media_Protection_IMediaProtectionManager<D>::RebootNeeded_revoker consume_Windows_Media_Protection_IMediaProtectionManager<D>::RebootNeeded(auto_revoke_t, Windows::Media::Protection::RebootNeededEventHandler const& handler) const
    {
        return impl::make_event_revoker<D, RebootNeeded_revoker>(this, RebootNeeded(handler));
    }
    template <typename D> auto consume_Windows_Media_Protection_IMediaProtectionManager<D>::RebootNeeded(winrt::event_token const& cookie) const noexcept
    {
        WINRT_VERIFY_(0, WINRT_IMPL_SHIM(Windows::Media::Protection::IMediaProtectionManager)->remove_RebootNeeded(impl::bind_in(cookie)));
    }
    template <typename D> auto consume_Windows_Media_Protection_IMediaProtectionManager<D>::ComponentLoadFailed(Windows::Media::Protection::ComponentLoadFailedEventHandler const& handler) const
    {
        winrt::event_token cookie;
        check_hresult(WINRT_IMPL_SHIM(Windows::Media::Protection::IMediaProtectionManager)->add_ComponentLoadFailed(*(void**)(&handler), put_abi(cookie)));
        return cookie;
    }
    template <typename D> typename consume_Windows_Media_Protection_IMediaProtectionManager<D>::ComponentLoadFailed_revoker consume_Windows_Media_Protection_IMediaProtectionManager<D>::ComponentLoadFailed(auto_revoke_t, Windows::Media::Protection::ComponentLoadFailedEventHandler const& handler) const
    {
        return impl::make_event_revoker<D, ComponentLoadFailed_revoker>(this, ComponentLoadFailed(handler));
    }
    template <typename D> auto consume_Windows_Media_Protection_IMediaProtectionManager<D>::ComponentLoadFailed(winrt::event_token const& cookie) const noexcept
    {
        WINRT_VERIFY_(0, WINRT_IMPL_SHIM(Windows::Media::Protection::IMediaProtectionManager)->remove_ComponentLoadFailed(impl::bind_in(cookie)));
    }
    template <typename D> auto consume_Windows_Media_Protection_IMediaProtectionManager<D>::Properties() const
    {
        void* value{};
        check_hresult(WINRT_IMPL_SHIM(Windows::Media::Protection::IMediaProtectionManager)->get_Properties(&value));
        return Windows::Foundation::Collections::IPropertySet{ value, take_ownership_from_abi };
    }
    template <typename D> auto consume_Windows_Media_Protection_IMediaProtectionPMPServer<D>::Properties() const
    {
        void* ppProperties{};
        check_hresult(WINRT_IMPL_SHIM(Windows::Media::Protection::IMediaProtectionPMPServer)->get_Properties(&ppProperties));
        return Windows::Foundation::Collections::IPropertySet{ ppProperties, take_ownership_from_abi };
    }
    template <typename D> auto consume_Windows_Media_Protection_IMediaProtectionPMPServerFactory<D>::CreatePMPServer(Windows::Foundation::Collections::IPropertySet const& pProperties) const
    {
        void* ppObject{};
        check_hresult(WINRT_IMPL_SHIM(Windows::Media::Protection::IMediaProtectionPMPServerFactory)->CreatePMPServer(*(void**)(&pProperties), &ppObject));
        return Windows::Media::Protection::MediaProtectionPMPServer{ ppObject, take_ownership_from_abi };
    }
    template <typename D> auto consume_Windows_Media_Protection_IMediaProtectionServiceCompletion<D>::Complete(bool success) const
    {
        check_hresult(WINRT_IMPL_SHIM(Windows::Media::Protection::IMediaProtectionServiceCompletion)->Complete(success));
    }
    template <typename D> auto consume_Windows_Media_Protection_IMediaProtectionServiceRequest<D>::ProtectionSystem() const
    {
        winrt::guid system;
        check_hresult(WINRT_IMPL_SHIM(Windows::Media::Protection::IMediaProtectionServiceRequest)->get_ProtectionSystem(put_abi(system)));
        return system;
    }
    template <typename D> auto consume_Windows_Media_Protection_IMediaProtectionServiceRequest<D>::Type() const
    {
        winrt::guid type;
        check_hresult(WINRT_IMPL_SHIM(Windows::Media::Protection::IMediaProtectionServiceRequest)->get_Type(put_abi(type)));
        return type;
    }
    template <typename D> auto consume_Windows_Media_Protection_IProtectionCapabilities<D>::IsTypeSupported(param::hstring const& type, param::hstring const& keySystem) const
    {
        Windows::Media::Protection::ProtectionCapabilityResult value;
        check_hresult(WINRT_IMPL_SHIM(Windows::Media::Protection::IProtectionCapabilities)->IsTypeSupported(*(void**)(&type), *(void**)(&keySystem), put_abi(value)));
        return value;
    }
    template <typename D> auto consume_Windows_Media_Protection_IRevocationAndRenewalInformation<D>::Items() const
    {
        void* items{};
        check_hresult(WINRT_IMPL_SHIM(Windows::Media::Protection::IRevocationAndRenewalInformation)->get_Items(&items));
        return Windows::Foundation::Collections::IVector<Windows::Media::Protection::RevocationAndRenewalItem>{ items, take_ownership_from_abi };
    }
    template <typename D> auto consume_Windows_Media_Protection_IRevocationAndRenewalItem<D>::Reasons() const
    {
        Windows::Media::Protection::RevocationAndRenewalReasons reasons;
        check_hresult(WINRT_IMPL_SHIM(Windows::Media::Protection::IRevocationAndRenewalItem)->get_Reasons(put_abi(reasons)));
        return reasons;
    }
    template <typename D> auto consume_Windows_Media_Protection_IRevocationAndRenewalItem<D>::HeaderHash() const
    {
        void* value{};
        check_hresult(WINRT_IMPL_SHIM(Windows::Media::Protection::IRevocationAndRenewalItem)->get_HeaderHash(&value));
        return hstring{ value, take_ownership_from_abi };
    }
    template <typename D> auto consume_Windows_Media_Protection_IRevocationAndRenewalItem<D>::PublicKeyHash() const
    {
        void* value{};
        check_hresult(WINRT_IMPL_SHIM(Windows::Media::Protection::IRevocationAndRenewalItem)->get_PublicKeyHash(&value));
        return hstring{ value, take_ownership_from_abi };
    }
    template <typename D> auto consume_Windows_Media_Protection_IRevocationAndRenewalItem<D>::Name() const
    {
        void* name{};
        check_hresult(WINRT_IMPL_SHIM(Windows::Media::Protection::IRevocationAndRenewalItem)->get_Name(&name));
        return hstring{ name, take_ownership_from_abi };
    }
    template <typename D> auto consume_Windows_Media_Protection_IRevocationAndRenewalItem<D>::RenewalId() const
    {
        void* value{};
        check_hresult(WINRT_IMPL_SHIM(Windows::Media::Protection::IRevocationAndRenewalItem)->get_RenewalId(&value));
        return hstring{ value, take_ownership_from_abi };
    }
    template <typename D> auto consume_Windows_Media_Protection_IServiceRequestedEventArgs<D>::Request() const
    {
        void* value{};
        check_hresult(WINRT_IMPL_SHIM(Windows::Media::Protection::IServiceRequestedEventArgs)->get_Request(&value));
        return Windows::Media::Protection::IMediaProtectionServiceRequest{ value, take_ownership_from_abi };
    }
    template <typename D> auto consume_Windows_Media_Protection_IServiceRequestedEventArgs<D>::Completion() const
    {
        void* value{};
        check_hresult(WINRT_IMPL_SHIM(Windows::Media::Protection::IServiceRequestedEventArgs)->get_Completion(&value));
        return Windows::Media::Protection::MediaProtectionServiceCompletion{ value, take_ownership_from_abi };
    }
    template <typename D> auto consume_Windows_Media_Protection_IServiceRequestedEventArgs2<D>::MediaPlaybackItem() const
    {
        void* value{};
        check_hresult(WINRT_IMPL_SHIM(Windows::Media::Protection::IServiceRequestedEventArgs2)->get_MediaPlaybackItem(&value));
        return Windows::Media::Playback::MediaPlaybackItem{ value, take_ownership_from_abi };
    }
    template <typename H> struct delegate<Windows::Media::Protection::ComponentLoadFailedEventHandler, H> : implements_delegate<Windows::Media::Protection::ComponentLoadFailedEventHandler, H>
    {
        delegate(H&& handler) : implements_delegate<Windows::Media::Protection::ComponentLoadFailedEventHandler, H>(std::forward<H>(handler)) {}

        int32_t __stdcall Invoke(void* sender, void* e) noexcept final try
        {
            (*this)(*reinterpret_cast<Windows::Media::Protection::MediaProtectionManager const*>(&sender), *reinterpret_cast<Windows::Media::Protection::ComponentLoadFailedEventArgs const*>(&e));
            return 0;
        }
        catch (...) { return to_hresult(); }
    };
    template <typename H> struct delegate<Windows::Media::Protection::RebootNeededEventHandler, H> : implements_delegate<Windows::Media::Protection::RebootNeededEventHandler, H>
    {
        delegate(H&& handler) : implements_delegate<Windows::Media::Protection::RebootNeededEventHandler, H>(std::forward<H>(handler)) {}

        int32_t __stdcall Invoke(void* sender) noexcept final try
        {
            (*this)(*reinterpret_cast<Windows::Media::Protection::MediaProtectionManager const*>(&sender));
            return 0;
        }
        catch (...) { return to_hresult(); }
    };
    template <typename H> struct delegate<Windows::Media::Protection::ServiceRequestedEventHandler, H> : implements_delegate<Windows::Media::Protection::ServiceRequestedEventHandler, H>
    {
        delegate(H&& handler) : implements_delegate<Windows::Media::Protection::ServiceRequestedEventHandler, H>(std::forward<H>(handler)) {}

        int32_t __stdcall Invoke(void* sender, void* e) noexcept final try
        {
            (*this)(*reinterpret_cast<Windows::Media::Protection::MediaProtectionManager const*>(&sender), *reinterpret_cast<Windows::Media::Protection::ServiceRequestedEventArgs const*>(&e));
            return 0;
        }
        catch (...) { return to_hresult(); }
    };
    template <typename D>
    struct produce<D, Windows::Media::Protection::IComponentLoadFailedEventArgs> : produce_base<D, Windows::Media::Protection::IComponentLoadFailedEventArgs>
    {
        int32_t __stdcall get_Information(void** value) noexcept final try
        {
            clear_abi(value);
            typename D::abi_guard guard(this->shim());
            *value = detach_from<Windows::Media::Protection::RevocationAndRenewalInformation>(this->shim().Information());
            return 0;
        }
        catch (...) { return to_hresult(); }
        int32_t __stdcall get_Completion(void** value) noexcept final try
        {
            clear_abi(value);
            typename D::abi_guard guard(this->shim());
            *value = detach_from<Windows::Media::Protection::MediaProtectionServiceCompletion>(this->shim().Completion());
            return 0;
        }
        catch (...) { return to_hresult(); }
    };
    template <typename D>
    struct produce<D, Windows::Media::Protection::IComponentRenewalStatics> : produce_base<D, Windows::Media::Protection::IComponentRenewalStatics>
    {
        int32_t __stdcall RenewSystemComponentsAsync(void* information, void** operation) noexcept final try
        {
            clear_abi(operation);
            typename D::abi_guard guard(this->shim());
            *operation = detach_from<Windows::Foundation::IAsyncOperationWithProgress<Windows::Media::Protection::RenewalStatus, uint32_t>>(this->shim().RenewSystemComponentsAsync(*reinterpret_cast<Windows::Media::Protection::RevocationAndRenewalInformation const*>(&information)));
            return 0;
        }
        catch (...) { return to_hresult(); }
    };
    template <typename D>
    struct produce<D, Windows::Media::Protection::IHdcpSession> : produce_base<D, Windows::Media::Protection::IHdcpSession>
    {
        int32_t __stdcall IsEffectiveProtectionAtLeast(int32_t protection, bool* value) noexcept final try
        {
            typename D::abi_guard guard(this->shim());
            *value = detach_from<bool>(this->shim().IsEffectiveProtectionAtLeast(*reinterpret_cast<Windows::Media::Protection::HdcpProtection const*>(&protection)));
            return 0;
        }
        catch (...) { return to_hresult(); }
        int32_t __stdcall GetEffectiveProtection(void** value) noexcept final try
        {
            clear_abi(value);
            typename D::abi_guard guard(this->shim());
            *value = detach_from<Windows::Foundation::IReference<Windows::Media::Protection::HdcpProtection>>(this->shim().GetEffectiveProtection());
            return 0;
        }
        catch (...) { return to_hresult(); }
        int32_t __stdcall SetDesiredMinProtectionAsync(int32_t protection, void** value) noexcept final try
        {
            clear_abi(value);
            typename D::abi_guard guard(this->shim());
            *value = detach_from<Windows::Foundation::IAsyncOperation<Windows::Media::Protection::HdcpSetProtectionResult>>(this->shim().SetDesiredMinProtectionAsync(*reinterpret_cast<Windows::Media::Protection::HdcpProtection const*>(&protection)));
            return 0;
        }
        catch (...) { return to_hresult(); }
        int32_t __stdcall add_ProtectionChanged(void* handler, winrt::event_token* token) noexcept final try
        {
            zero_abi<winrt::event_token>(token);
            typename D::abi_guard guard(this->shim());
            *token = detach_from<winrt::event_token>(this->shim().ProtectionChanged(*reinterpret_cast<Windows::Foundation::TypedEventHandler<Windows::Media::Protection::HdcpSession, Windows::Foundation::IInspectable> const*>(&handler)));
            return 0;
        }
        catch (...) { return to_hresult(); }
        int32_t __stdcall remove_ProtectionChanged(winrt::event_token token) noexcept final
        {
            typename D::abi_guard guard(this->shim());
            this->shim().ProtectionChanged(*reinterpret_cast<winrt::event_token const*>(&token));
            return 0;
        }
    };
    template <typename D>
    struct produce<D, Windows::Media::Protection::IMediaProtectionManager> : produce_base<D, Windows::Media::Protection::IMediaProtectionManager>
    {
        int32_t __stdcall add_ServiceRequested(void* handler, winrt::event_token* cookie) noexcept final try
        {
            zero_abi<winrt::event_token>(cookie);
            typename D::abi_guard guard(this->shim());
            *cookie = detach_from<winrt::event_token>(this->shim().ServiceRequested(*reinterpret_cast<Windows::Media::Protection::ServiceRequestedEventHandler const*>(&handler)));
            return 0;
        }
        catch (...) { return to_hresult(); }
        int32_t __stdcall remove_ServiceRequested(winrt::event_token cookie) noexcept final
        {
            typename D::abi_guard guard(this->shim());
            this->shim().ServiceRequested(*reinterpret_cast<winrt::event_token const*>(&cookie));
            return 0;
        }
        int32_t __stdcall add_RebootNeeded(void* handler, winrt::event_token* cookie) noexcept final try
        {
            zero_abi<winrt::event_token>(cookie);
            typename D::abi_guard guard(this->shim());
            *cookie = detach_from<winrt::event_token>(this->shim().RebootNeeded(*reinterpret_cast<Windows::Media::Protection::RebootNeededEventHandler const*>(&handler)));
            return 0;
        }
        catch (...) { return to_hresult(); }
        int32_t __stdcall remove_RebootNeeded(winrt::event_token cookie) noexcept final
        {
            typename D::abi_guard guard(this->shim());
            this->shim().RebootNeeded(*reinterpret_cast<winrt::event_token const*>(&cookie));
            return 0;
        }
        int32_t __stdcall add_ComponentLoadFailed(void* handler, winrt::event_token* cookie) noexcept final try
        {
            zero_abi<winrt::event_token>(cookie);
            typename D::abi_guard guard(this->shim());
            *cookie = detach_from<winrt::event_token>(this->shim().ComponentLoadFailed(*reinterpret_cast<Windows::Media::Protection::ComponentLoadFailedEventHandler const*>(&handler)));
            return 0;
        }
        catch (...) { return to_hresult(); }
        int32_t __stdcall remove_ComponentLoadFailed(winrt::event_token cookie) noexcept final
        {
            typename D::abi_guard guard(this->shim());
            this->shim().ComponentLoadFailed(*reinterpret_cast<winrt::event_token const*>(&cookie));
            return 0;
        }
        int32_t __stdcall get_Properties(void** value) noexcept final try
        {
            clear_abi(value);
            typename D::abi_guard guard(this->shim());
            *value = detach_from<Windows::Foundation::Collections::IPropertySet>(this->shim().Properties());
            return 0;
        }
        catch (...) { return to_hresult(); }
    };
    template <typename D>
    struct produce<D, Windows::Media::Protection::IMediaProtectionPMPServer> : produce_base<D, Windows::Media::Protection::IMediaProtectionPMPServer>
    {
        int32_t __stdcall get_Properties(void** ppProperties) noexcept final try
        {
            clear_abi(ppProperties);
            typename D::abi_guard guard(this->shim());
            *ppProperties = detach_from<Windows::Foundation::Collections::IPropertySet>(this->shim().Properties());
            return 0;
        }
        catch (...) { return to_hresult(); }
    };
    template <typename D>
    struct produce<D, Windows::Media::Protection::IMediaProtectionPMPServerFactory> : produce_base<D, Windows::Media::Protection::IMediaProtectionPMPServerFactory>
    {
        int32_t __stdcall CreatePMPServer(void* pProperties, void** ppObject) noexcept final try
        {
            clear_abi(ppObject);
            typename D::abi_guard guard(this->shim());
            *ppObject = detach_from<Windows::Media::Protection::MediaProtectionPMPServer>(this->shim().CreatePMPServer(*reinterpret_cast<Windows::Foundation::Collections::IPropertySet const*>(&pProperties)));
            return 0;
        }
        catch (...) { return to_hresult(); }
    };
    template <typename D>
    struct produce<D, Windows::Media::Protection::IMediaProtectionServiceCompletion> : produce_base<D, Windows::Media::Protection::IMediaProtectionServiceCompletion>
    {
        int32_t __stdcall Complete(bool success) noexcept final try
        {
            typename D::abi_guard guard(this->shim());
            this->shim().Complete(success);
            return 0;
        }
        catch (...) { return to_hresult(); }
    };
    template <typename D>
    struct produce<D, Windows::Media::Protection::IMediaProtectionServiceRequest> : produce_base<D, Windows::Media::Protection::IMediaProtectionServiceRequest>
    {
        int32_t __stdcall get_ProtectionSystem(winrt::guid* system) noexcept final try
        {
            typename D::abi_guard guard(this->shim());
            *system = detach_from<winrt::guid>(this->shim().ProtectionSystem());
            return 0;
        }
        catch (...) { return to_hresult(); }
        int32_t __stdcall get_Type(winrt::guid* type) noexcept final try
        {
            typename D::abi_guard guard(this->shim());
            *type = detach_from<winrt::guid>(this->shim().Type());
            return 0;
        }
        catch (...) { return to_hresult(); }
    };
    template <typename D>
    struct produce<D, Windows::Media::Protection::IProtectionCapabilities> : produce_base<D, Windows::Media::Protection::IProtectionCapabilities>
    {
        int32_t __stdcall IsTypeSupported(void* type, void* keySystem, int32_t* value) noexcept final try
        {
            typename D::abi_guard guard(this->shim());
            *value = detach_from<Windows::Media::Protection::ProtectionCapabilityResult>(this->shim().IsTypeSupported(*reinterpret_cast<hstring const*>(&type), *reinterpret_cast<hstring const*>(&keySystem)));
            return 0;
        }
        catch (...) { return to_hresult(); }
    };
    template <typename D>
    struct produce<D, Windows::Media::Protection::IRevocationAndRenewalInformation> : produce_base<D, Windows::Media::Protection::IRevocationAndRenewalInformation>
    {
        int32_t __stdcall get_Items(void** items) noexcept final try
        {
            clear_abi(items);
            typename D::abi_guard guard(this->shim());
            *items = detach_from<Windows::Foundation::Collections::IVector<Windows::Media::Protection::RevocationAndRenewalItem>>(this->shim().Items());
            return 0;
        }
        catch (...) { return to_hresult(); }
    };
    template <typename D>
    struct produce<D, Windows::Media::Protection::IRevocationAndRenewalItem> : produce_base<D, Windows::Media::Protection::IRevocationAndRenewalItem>
    {
        int32_t __stdcall get_Reasons(uint32_t* reasons) noexcept final try
        {
            typename D::abi_guard guard(this->shim());
            *reasons = detach_from<Windows::Media::Protection::RevocationAndRenewalReasons>(this->shim().Reasons());
            return 0;
        }
        catch (...) { return to_hresult(); }
        int32_t __stdcall get_HeaderHash(void** value) noexcept final try
        {
            clear_abi(value);
            typename D::abi_guard guard(this->shim());
            *value = detach_from<hstring>(this->shim().HeaderHash());
            return 0;
        }
        catch (...) { return to_hresult(); }
        int32_t __stdcall get_PublicKeyHash(void** value) noexcept final try
        {
            clear_abi(value);
            typename D::abi_guard guard(this->shim());
            *value = detach_from<hstring>(this->shim().PublicKeyHash());
            return 0;
        }
        catch (...) { return to_hresult(); }
        int32_t __stdcall get_Name(void** name) noexcept final try
        {
            clear_abi(name);
            typename D::abi_guard guard(this->shim());
            *name = detach_from<hstring>(this->shim().Name());
            return 0;
        }
        catch (...) { return to_hresult(); }
        int32_t __stdcall get_RenewalId(void** value) noexcept final try
        {
            clear_abi(value);
            typename D::abi_guard guard(this->shim());
            *value = detach_from<hstring>(this->shim().RenewalId());
            return 0;
        }
        catch (...) { return to_hresult(); }
    };
    template <typename D>
    struct produce<D, Windows::Media::Protection::IServiceRequestedEventArgs> : produce_base<D, Windows::Media::Protection::IServiceRequestedEventArgs>
    {
        int32_t __stdcall get_Request(void** value) noexcept final try
        {
            clear_abi(value);
            typename D::abi_guard guard(this->shim());
            *value = detach_from<Windows::Media::Protection::IMediaProtectionServiceRequest>(this->shim().Request());
            return 0;
        }
        catch (...) { return to_hresult(); }
        int32_t __stdcall get_Completion(void** value) noexcept final try
        {
            clear_abi(value);
            typename D::abi_guard guard(this->shim());
            *value = detach_from<Windows::Media::Protection::MediaProtectionServiceCompletion>(this->shim().Completion());
            return 0;
        }
        catch (...) { return to_hresult(); }
    };
    template <typename D>
    struct produce<D, Windows::Media::Protection::IServiceRequestedEventArgs2> : produce_base<D, Windows::Media::Protection::IServiceRequestedEventArgs2>
    {
        int32_t __stdcall get_MediaPlaybackItem(void** value) noexcept final try
        {
            clear_abi(value);
            typename D::abi_guard guard(this->shim());
            *value = detach_from<Windows::Media::Playback::MediaPlaybackItem>(this->shim().MediaPlaybackItem());
            return 0;
        }
        catch (...) { return to_hresult(); }
    };
}
namespace winrt::Windows::Media::Protection
{
    constexpr auto operator|(RevocationAndRenewalReasons const left, RevocationAndRenewalReasons const right) noexcept
    {
        return static_cast<RevocationAndRenewalReasons>(impl::to_underlying_type(left) | impl::to_underlying_type(right));
    }
    constexpr auto operator|=(RevocationAndRenewalReasons& left, RevocationAndRenewalReasons const right) noexcept
    {
        left = left | right;
        return left;
    }
    constexpr auto operator&(RevocationAndRenewalReasons const left, RevocationAndRenewalReasons const right) noexcept
    {
        return static_cast<RevocationAndRenewalReasons>(impl::to_underlying_type(left) & impl::to_underlying_type(right));
    }
    constexpr auto operator&=(RevocationAndRenewalReasons& left, RevocationAndRenewalReasons const right) noexcept
    {
        left = left & right;
        return left;
    }
    constexpr auto operator~(RevocationAndRenewalReasons const value) noexcept
    {
        return static_cast<RevocationAndRenewalReasons>(~impl::to_underlying_type(value));
    }
    constexpr auto operator^(RevocationAndRenewalReasons const left, RevocationAndRenewalReasons const right) noexcept
    {
        return static_cast<RevocationAndRenewalReasons>(impl::to_underlying_type(left) ^ impl::to_underlying_type(right));
    }
    constexpr auto operator^=(RevocationAndRenewalReasons& left, RevocationAndRenewalReasons const right) noexcept
    {
        left = left ^ right;
        return left;
    }
    inline auto ComponentRenewal::RenewSystemComponentsAsync(Windows::Media::Protection::RevocationAndRenewalInformation const& information)
    {
        return impl::call_factory<ComponentRenewal, Windows::Media::Protection::IComponentRenewalStatics>([&](auto&& f) { return f.RenewSystemComponentsAsync(information); });
    }
    inline HdcpSession::HdcpSession() :
        HdcpSession(impl::call_factory<HdcpSession>([](auto&& f) { return f.template ActivateInstance<HdcpSession>(); }))
    {
    }
    inline MediaProtectionManager::MediaProtectionManager() :
        MediaProtectionManager(impl::call_factory<MediaProtectionManager>([](auto&& f) { return f.template ActivateInstance<MediaProtectionManager>(); }))
    {
    }
    inline MediaProtectionPMPServer::MediaProtectionPMPServer(Windows::Foundation::Collections::IPropertySet const& pProperties) :
        MediaProtectionPMPServer(impl::call_factory<MediaProtectionPMPServer, Windows::Media::Protection::IMediaProtectionPMPServerFactory>([&](auto&& f) { return f.CreatePMPServer(pProperties); }))
    {
    }
    inline ProtectionCapabilities::ProtectionCapabilities() :
        ProtectionCapabilities(impl::call_factory<ProtectionCapabilities>([](auto&& f) { return f.template ActivateInstance<ProtectionCapabilities>(); }))
    {
    }
    template <typename L> ComponentLoadFailedEventHandler::ComponentLoadFailedEventHandler(L handler) :
        ComponentLoadFailedEventHandler(impl::make_delegate<ComponentLoadFailedEventHandler>(std::forward<L>(handler)))
    {
    }
    template <typename F> ComponentLoadFailedEventHandler::ComponentLoadFailedEventHandler(F* handler) :
        ComponentLoadFailedEventHandler([=](auto&&... args) { return handler(args...); })
    {
    }
    template <typename O, typename M> ComponentLoadFailedEventHandler::ComponentLoadFailedEventHandler(O* object, M method) :
        ComponentLoadFailedEventHandler([=](auto&&... args) { return ((*object).*(method))(args...); })
    {
    }
    template <typename O, typename M> ComponentLoadFailedEventHandler::ComponentLoadFailedEventHandler(com_ptr<O>&& object, M method) :
        ComponentLoadFailedEventHandler([o = std::move(object), method](auto&&... args) { return ((*o).*(method))(args...); })
    {
    }
    template <typename O, typename M> ComponentLoadFailedEventHandler::ComponentLoadFailedEventHandler(weak_ref<O>&& object, M method) :
        ComponentLoadFailedEventHandler([o = std::move(object), method](auto&&... args) { if (auto s = o.get()) { ((*s).*(method))(args...); } })
    {
    }
    inline auto ComponentLoadFailedEventHandler::operator()(Windows::Media::Protection::MediaProtectionManager const& sender, Windows::Media::Protection::ComponentLoadFailedEventArgs const& e) const
    {
        check_hresult((*(impl::abi_t<ComponentLoadFailedEventHandler>**)this)->Invoke(*(void**)(&sender), *(void**)(&e)));
    }
    template <typename L> RebootNeededEventHandler::RebootNeededEventHandler(L handler) :
        RebootNeededEventHandler(impl::make_delegate<RebootNeededEventHandler>(std::forward<L>(handler)))
    {
    }
    template <typename F> RebootNeededEventHandler::RebootNeededEventHandler(F* handler) :
        RebootNeededEventHandler([=](auto&&... args) { return handler(args...); })
    {
    }
    template <typename O, typename M> RebootNeededEventHandler::RebootNeededEventHandler(O* object, M method) :
        RebootNeededEventHandler([=](auto&&... args) { return ((*object).*(method))(args...); })
    {
    }
    template <typename O, typename M> RebootNeededEventHandler::RebootNeededEventHandler(com_ptr<O>&& object, M method) :
        RebootNeededEventHandler([o = std::move(object), method](auto&&... args) { return ((*o).*(method))(args...); })
    {
    }
    template <typename O, typename M> RebootNeededEventHandler::RebootNeededEventHandler(weak_ref<O>&& object, M method) :
        RebootNeededEventHandler([o = std::move(object), method](auto&&... args) { if (auto s = o.get()) { ((*s).*(method))(args...); } })
    {
    }
    inline auto RebootNeededEventHandler::operator()(Windows::Media::Protection::MediaProtectionManager const& sender) const
    {
        check_hresult((*(impl::abi_t<RebootNeededEventHandler>**)this)->Invoke(*(void**)(&sender)));
    }
    template <typename L> ServiceRequestedEventHandler::ServiceRequestedEventHandler(L handler) :
        ServiceRequestedEventHandler(impl::make_delegate<ServiceRequestedEventHandler>(std::forward<L>(handler)))
    {
    }
    template <typename F> ServiceRequestedEventHandler::ServiceRequestedEventHandler(F* handler) :
        ServiceRequestedEventHandler([=](auto&&... args) { return handler(args...); })
    {
    }
    template <typename O, typename M> ServiceRequestedEventHandler::ServiceRequestedEventHandler(O* object, M method) :
        ServiceRequestedEventHandler([=](auto&&... args) { return ((*object).*(method))(args...); })
    {
    }
    template <typename O, typename M> ServiceRequestedEventHandler::ServiceRequestedEventHandler(com_ptr<O>&& object, M method) :
        ServiceRequestedEventHandler([o = std::move(object), method](auto&&... args) { return ((*o).*(method))(args...); })
    {
    }
    template <typename O, typename M> ServiceRequestedEventHandler::ServiceRequestedEventHandler(weak_ref<O>&& object, M method) :
        ServiceRequestedEventHandler([o = std::move(object), method](auto&&... args) { if (auto s = o.get()) { ((*s).*(method))(args...); } })
    {
    }
    inline auto ServiceRequestedEventHandler::operator()(Windows::Media::Protection::MediaProtectionManager const& sender, Windows::Media::Protection::ServiceRequestedEventArgs const& e) const
    {
        check_hresult((*(impl::abi_t<ServiceRequestedEventHandler>**)this)->Invoke(*(void**)(&sender), *(void**)(&e)));
    }
}
namespace std
{
    template<> struct hash<winrt::Windows::Media::Protection::IComponentLoadFailedEventArgs> : winrt::impl::hash_base<winrt::Windows::Media::Protection::IComponentLoadFailedEventArgs> {};
    template<> struct hash<winrt::Windows::Media::Protection::IComponentRenewalStatics> : winrt::impl::hash_base<winrt::Windows::Media::Protection::IComponentRenewalStatics> {};
    template<> struct hash<winrt::Windows::Media::Protection::IHdcpSession> : winrt::impl::hash_base<winrt::Windows::Media::Protection::IHdcpSession> {};
    template<> struct hash<winrt::Windows::Media::Protection::IMediaProtectionManager> : winrt::impl::hash_base<winrt::Windows::Media::Protection::IMediaProtectionManager> {};
    template<> struct hash<winrt::Windows::Media::Protection::IMediaProtectionPMPServer> : winrt::impl::hash_base<winrt::Windows::Media::Protection::IMediaProtectionPMPServer> {};
    template<> struct hash<winrt::Windows::Media::Protection::IMediaProtectionPMPServerFactory> : winrt::impl::hash_base<winrt::Windows::Media::Protection::IMediaProtectionPMPServerFactory> {};
    template<> struct hash<winrt::Windows::Media::Protection::IMediaProtectionServiceCompletion> : winrt::impl::hash_base<winrt::Windows::Media::Protection::IMediaProtectionServiceCompletion> {};
    template<> struct hash<winrt::Windows::Media::Protection::IMediaProtectionServiceRequest> : winrt::impl::hash_base<winrt::Windows::Media::Protection::IMediaProtectionServiceRequest> {};
    template<> struct hash<winrt::Windows::Media::Protection::IProtectionCapabilities> : winrt::impl::hash_base<winrt::Windows::Media::Protection::IProtectionCapabilities> {};
    template<> struct hash<winrt::Windows::Media::Protection::IRevocationAndRenewalInformation> : winrt::impl::hash_base<winrt::Windows::Media::Protection::IRevocationAndRenewalInformation> {};
    template<> struct hash<winrt::Windows::Media::Protection::IRevocationAndRenewalItem> : winrt::impl::hash_base<winrt::Windows::Media::Protection::IRevocationAndRenewalItem> {};
    template<> struct hash<winrt::Windows::Media::Protection::IServiceRequestedEventArgs> : winrt::impl::hash_base<winrt::Windows::Media::Protection::IServiceRequestedEventArgs> {};
    template<> struct hash<winrt::Windows::Media::Protection::IServiceRequestedEventArgs2> : winrt::impl::hash_base<winrt::Windows::Media::Protection::IServiceRequestedEventArgs2> {};
    template<> struct hash<winrt::Windows::Media::Protection::ComponentLoadFailedEventArgs> : winrt::impl::hash_base<winrt::Windows::Media::Protection::ComponentLoadFailedEventArgs> {};
    template<> struct hash<winrt::Windows::Media::Protection::ComponentRenewal> : winrt::impl::hash_base<winrt::Windows::Media::Protection::ComponentRenewal> {};
    template<> struct hash<winrt::Windows::Media::Protection::HdcpSession> : winrt::impl::hash_base<winrt::Windows::Media::Protection::HdcpSession> {};
    template<> struct hash<winrt::Windows::Media::Protection::MediaProtectionManager> : winrt::impl::hash_base<winrt::Windows::Media::Protection::MediaProtectionManager> {};
    template<> struct hash<winrt::Windows::Media::Protection::MediaProtectionPMPServer> : winrt::impl::hash_base<winrt::Windows::Media::Protection::MediaProtectionPMPServer> {};
    template<> struct hash<winrt::Windows::Media::Protection::MediaProtectionServiceCompletion> : winrt::impl::hash_base<winrt::Windows::Media::Protection::MediaProtectionServiceCompletion> {};
    template<> struct hash<winrt::Windows::Media::Protection::ProtectionCapabilities> : winrt::impl::hash_base<winrt::Windows::Media::Protection::ProtectionCapabilities> {};
    template<> struct hash<winrt::Windows::Media::Protection::RevocationAndRenewalInformation> : winrt::impl::hash_base<winrt::Windows::Media::Protection::RevocationAndRenewalInformation> {};
    template<> struct hash<winrt::Windows::Media::Protection::RevocationAndRenewalItem> : winrt::impl::hash_base<winrt::Windows::Media::Protection::RevocationAndRenewalItem> {};
    template<> struct hash<winrt::Windows::Media::Protection::ServiceRequestedEventArgs> : winrt::impl::hash_base<winrt::Windows::Media::Protection::ServiceRequestedEventArgs> {};
}
#endif
