//
// Automatically generated by ipdlc.
// Edit at your own risk
//


#include "mozilla/dom/PWindowGlobalParent.h"
#include "mozilla/dom/PWindowGlobalChild.h"
#include "mozilla/dom/PDigitalCredential.h"
#include "mozilla/dom/PDigitalCredentialParent.h"
#include "mozilla/dom/PDigitalCredentialChild.h"

#include "ipc/IPCMessageUtils.h"
#include "ipc/IPCMessageUtilsSpecializations.h"
#include "nsIFile.h"
#include "mozilla/ipc/Endpoint.h"
#include "mozilla/ipc/ProtocolMessageUtils.h"
#include "mozilla/ipc/ProtocolUtils.h"
#include "mozilla/ipc/ShmemMessageUtils.h"
#include "mozilla/ipc/TaintingIPCUtils.h"

namespace mozilla {
namespace dom {
namespace PDigitalCredential {

nsresult
CreateEndpoints(
        mozilla::ipc::EndpointProcInfo aParentDestInfo,
        mozilla::ipc::EndpointProcInfo aChildDestInfo,
        mozilla::ipc::Endpoint<::mozilla::dom::PDigitalCredentialParent>* aParent,
        mozilla::ipc::Endpoint<::mozilla::dom::PDigitalCredentialChild>* aChild)
{
    return mozilla::ipc::CreateEndpoints(
        mozilla::ipc::PrivateIPDLInterface(),
        aParentDestInfo, aChildDestInfo, aParent, aChild);
}
nsresult
CreateEndpoints(
        mozilla::ipc::Endpoint<::mozilla::dom::PDigitalCredentialParent>* aParent,
        mozilla::ipc::Endpoint<::mozilla::dom::PDigitalCredentialChild>* aChild)
{
    return mozilla::ipc::CreateEndpoints(
        mozilla::ipc::PrivateIPDLInterface(),
        aParent, aChild);
}
mozilla::UniquePtr<IPC::Message>
Msg_GetDigitalCredential(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Msg_GetDigitalCredential__ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::NOT_REPLY));
}
mozilla::UniquePtr<IPC::Message>
Reply_GetDigitalCredential(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Reply_GetDigitalCredential__ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::REPLY));
}
mozilla::UniquePtr<IPC::Message>
Msg_CreateDigitalCredential(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Msg_CreateDigitalCredential__ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::NOT_REPLY));
}
mozilla::UniquePtr<IPC::Message>
Reply_CreateDigitalCredential(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Reply_CreateDigitalCredential__ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::REPLY));
}
mozilla::UniquePtr<IPC::Message>
Msg_CancelOperationInParent(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Msg_CancelOperationInParent__ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::NOT_REPLY));
}
mozilla::UniquePtr<IPC::Message>
Msg___delete__(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Msg___delete____ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::NOT_REPLY));
}
mozilla::UniquePtr<IPC::Message>
Reply___delete__(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Reply___delete____ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::REPLY));
}

} // namespace PDigitalCredential
} // namespace dom
} // namespace mozilla

//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |struct IPCDigitalCredentialRequest|
//
namespace mozilla {
namespace dom {
} // namespace dom
} // namespace mozilla

namespace IPC {
auto ParamTraits<::mozilla::dom::IPCDigitalCredentialRequest>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    IPC::WriteParam(aWriter, (aVar).proto());
    // Sentinel = 'proto'
    (aWriter)->WriteSentinel(111215157);
    IPC::WriteParam(aWriter, (aVar).data());
    // Sentinel = 'data'
    (aWriter)->WriteSentinel(67109275);
}

auto ParamTraits<::mozilla::dom::IPCDigitalCredentialRequest>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    auto maybe___proto = IPC::ReadParam<::nsString>(aReader);
    if (!maybe___proto) {
        aReader->FatalError("Error deserializing 'proto' (nsString) member of 'IPCDigitalCredentialRequest'");
        return {};

    }
    auto& _proto = *maybe___proto;
    // Sentinel = 'proto'
    if ((!((aReader)->ReadSentinel(111215157)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'proto' (nsString) member of 'IPCDigitalCredentialRequest'");
        return {};
    }
    auto maybe___data = IPC::ReadParam<::nsString>(aReader);
    if (!maybe___data) {
        aReader->FatalError("Error deserializing 'data' (nsString) member of 'IPCDigitalCredentialRequest'");
        return {};

    }
    auto& _data = *maybe___data;
    // Sentinel = 'data'
    if ((!((aReader)->ReadSentinel(67109275)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'data' (nsString) member of 'IPCDigitalCredentialRequest'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            std::move(_proto),
            std::move(_data)};
    return result__;
}

} // namespace IPC

//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |struct IPCDigitalCredential|
//
namespace mozilla {
namespace dom {
} // namespace dom
} // namespace mozilla

namespace IPC {
auto ParamTraits<::mozilla::dom::IPCDigitalCredential>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    IPC::WriteParam(aWriter, (aVar).proto());
    // Sentinel = 'proto'
    (aWriter)->WriteSentinel(111215157);
    IPC::WriteParam(aWriter, (aVar).data());
    // Sentinel = 'data'
    (aWriter)->WriteSentinel(67109275);
}

auto ParamTraits<::mozilla::dom::IPCDigitalCredential>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    auto maybe___proto = IPC::ReadParam<::nsString>(aReader);
    if (!maybe___proto) {
        aReader->FatalError("Error deserializing 'proto' (nsString) member of 'IPCDigitalCredential'");
        return {};

    }
    auto& _proto = *maybe___proto;
    // Sentinel = 'proto'
    if ((!((aReader)->ReadSentinel(111215157)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'proto' (nsString) member of 'IPCDigitalCredential'");
        return {};
    }
    auto maybe___data = IPC::ReadParam<::nsString>(aReader);
    if (!maybe___data) {
        aReader->FatalError("Error deserializing 'data' (nsString) member of 'IPCDigitalCredential'");
        return {};

    }
    auto& _data = *maybe___data;
    // Sentinel = 'data'
    if ((!((aReader)->ReadSentinel(67109275)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'data' (nsString) member of 'IPCDigitalCredential'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            std::move(_proto),
            std::move(_data)};
    return result__;
}

} // namespace IPC

//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |union IPCDigitalCredentialResponse|
//
namespace mozilla {
namespace dom {
auto IPCDigitalCredentialResponse::MaybeDestroy() -> void
{
    if ((mType) == (T__None)) {
        return;
    }
    switch (mType) {
    case Tnsresult:
        {
            (ptr_nsresult())->~nsresult__tdef();
            break;
        }
    case TIPCDigitalCredential:
        {
            (ptr_IPCDigitalCredential())->~IPCDigitalCredential__tdef();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("not reached");
            break;
        }
    }
}

MOZ_IMPLICIT IPCDigitalCredentialResponse::IPCDigitalCredentialResponse(const nsresult& aOther)
{
    new (mozilla::KnownNotNull, ptr_nsresult()) nsresult(aOther);
    mType = Tnsresult;
}

MOZ_IMPLICIT IPCDigitalCredentialResponse::IPCDigitalCredentialResponse(nsresult&& aOther)
{
    new (mozilla::KnownNotNull, ptr_nsresult()) nsresult(std::move(aOther));
    mType = Tnsresult;
}

MOZ_IMPLICIT IPCDigitalCredentialResponse::IPCDigitalCredentialResponse(const IPCDigitalCredential& aOther)
{
    new (mozilla::KnownNotNull, ptr_IPCDigitalCredential()) IPCDigitalCredential(aOther);
    mType = TIPCDigitalCredential;
}

MOZ_IMPLICIT IPCDigitalCredentialResponse::IPCDigitalCredentialResponse(IPCDigitalCredential&& aOther)
{
    new (mozilla::KnownNotNull, ptr_IPCDigitalCredential()) IPCDigitalCredential(std::move(aOther));
    mType = TIPCDigitalCredential;
}

MOZ_IMPLICIT IPCDigitalCredentialResponse::IPCDigitalCredentialResponse(const IPCDigitalCredentialResponse& aOther)
{
    (aOther).AssertSanity();
    switch ((aOther).type()) {
    case Tnsresult:
        {
            new (mozilla::KnownNotNull, ptr_nsresult()) nsresult((aOther).get_nsresult());
            break;
        }
    case TIPCDigitalCredential:
        {
            new (mozilla::KnownNotNull, ptr_IPCDigitalCredential()) IPCDigitalCredential((aOther).get_IPCDigitalCredential());
            break;
        }
    case T__None:
        {
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            return;
        }
    }
    mType = (aOther).type();
}

MOZ_IMPLICIT IPCDigitalCredentialResponse::IPCDigitalCredentialResponse(IPCDigitalCredentialResponse&& aOther)
{
    (aOther).AssertSanity();
    Type t = (aOther).type();
    switch (t) {
    case Tnsresult:
        {
            new (mozilla::KnownNotNull, ptr_nsresult()) nsresult(std::move((aOther).get_nsresult()));
            (aOther).MaybeDestroy();
            break;
        }
    case TIPCDigitalCredential:
        {
            new (mozilla::KnownNotNull, ptr_IPCDigitalCredential()) IPCDigitalCredential(std::move((aOther).get_IPCDigitalCredential()));
            (aOther).MaybeDestroy();
            break;
        }
    case T__None:
        {
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            return;
        }
    }
    (aOther).mType = T__None;
    mType = t;
}

IPCDigitalCredentialResponse::~IPCDigitalCredentialResponse()
{
    MaybeDestroy();
}

auto IPCDigitalCredentialResponse::operator=(const nsresult& aRhs) -> IPCDigitalCredentialResponse&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_nsresult()) nsresult(aRhs);
    mType = Tnsresult;
    return (*(this));
}

auto IPCDigitalCredentialResponse::operator=(nsresult&& aRhs) -> IPCDigitalCredentialResponse&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_nsresult()) nsresult(std::move(aRhs));
    mType = Tnsresult;
    return (*(this));
}

auto IPCDigitalCredentialResponse::operator=(const IPCDigitalCredential& aRhs) -> IPCDigitalCredentialResponse&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_IPCDigitalCredential()) IPCDigitalCredential(aRhs);
    mType = TIPCDigitalCredential;
    return (*(this));
}

auto IPCDigitalCredentialResponse::operator=(IPCDigitalCredential&& aRhs) -> IPCDigitalCredentialResponse&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_IPCDigitalCredential()) IPCDigitalCredential(std::move(aRhs));
    mType = TIPCDigitalCredential;
    return (*(this));
}

auto IPCDigitalCredentialResponse::operator=(const IPCDigitalCredentialResponse& aRhs) -> IPCDigitalCredentialResponse&
{
    (aRhs).AssertSanity();
    Type t = (aRhs).type();
    switch (t) {
    case Tnsresult:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_nsresult()) nsresult((aRhs).get_nsresult());
            break;
        }
    case TIPCDigitalCredential:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_IPCDigitalCredential()) IPCDigitalCredential((aRhs).get_IPCDigitalCredential());
            break;
        }
    case T__None:
        {
            MaybeDestroy();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            break;
        }
    }
    mType = t;
    return (*(this));
}

auto IPCDigitalCredentialResponse::operator=(IPCDigitalCredentialResponse&& aRhs) -> IPCDigitalCredentialResponse&
{
    (aRhs).AssertSanity();
    Type t = (aRhs).type();
    switch (t) {
    case Tnsresult:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_nsresult()) nsresult(std::move((aRhs).get_nsresult()));
            (aRhs).MaybeDestroy();
            break;
        }
    case TIPCDigitalCredential:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_IPCDigitalCredential()) IPCDigitalCredential(std::move((aRhs).get_IPCDigitalCredential()));
            (aRhs).MaybeDestroy();
            break;
        }
    case T__None:
        {
            MaybeDestroy();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            break;
        }
    }
    (aRhs).mType = T__None;
    mType = t;
    return (*(this));
}

} // namespace dom
} // namespace mozilla

namespace IPC {
auto ParamTraits<::mozilla::dom::IPCDigitalCredentialResponse>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    typedef ::mozilla::dom::IPCDigitalCredentialResponse union__;
    int type = (aVar).type();
    IPC::WriteParam(aWriter, type);
    // Sentinel = 'IPCDigitalCredentialResponse'
    (aWriter)->WriteSentinel(2530478821);

    switch (type) {
    case union__::Tnsresult:
        {
            IPC::WriteParam(aWriter, (aVar).get_nsresult());
            // Sentinel = 'Tnsresult'
            (aWriter)->WriteSentinel(313394133);
            return;
        }
    case union__::TIPCDigitalCredential:
        {
            IPC::WriteParam(aWriter, (aVar).get_IPCDigitalCredential());
            // Sentinel = 'TIPCDigitalCredential'
            (aWriter)->WriteSentinel(1384318954);
            return;
        }
    default:
        {
            aWriter->FatalError("unknown variant of union IPCDigitalCredentialResponse");
            return;
        }
    }
}

auto ParamTraits<::mozilla::dom::IPCDigitalCredentialResponse>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    typedef ::mozilla::dom::IPCDigitalCredentialResponse union__;
    auto maybe__type = IPC::ReadParam<int>(aReader);
    if (!maybe__type) {
        aReader->FatalError("Error deserializing type of union IPCDigitalCredentialResponse");
        return {};

    }
    auto& type = *maybe__type;
    // Sentinel = 'IPCDigitalCredentialResponse'
    if ((!((aReader)->ReadSentinel(2530478821)))) {
        mozilla::ipc::SentinelReadError("Error deserializing type of union IPCDigitalCredentialResponse");
        return {};
    }

    switch (type) {
    case union__::Tnsresult:
        {
            auto maybe__tmp = IPC::ReadParam<::nsresult>(aReader);
            if (!maybe__tmp) {
                aReader->FatalError("Error deserializing variant Tnsresult of union IPCDigitalCredentialResponse");
                return {};

            }
            auto& tmp = *maybe__tmp;
            // Sentinel = 'Tnsresult'
            if ((!((aReader)->ReadSentinel(313394133)))) {
                mozilla::ipc::SentinelReadError("Error deserializing variant Tnsresult of union IPCDigitalCredentialResponse");
                return {};
            }
            return std::move(tmp);
        }
    case union__::TIPCDigitalCredential:
        {
            auto maybe__tmp = IPC::ReadParam<::mozilla::dom::IPCDigitalCredential>(aReader);
            if (!maybe__tmp) {
                aReader->FatalError("Error deserializing variant TIPCDigitalCredential of union IPCDigitalCredentialResponse");
                return {};

            }
            auto& tmp = *maybe__tmp;
            // Sentinel = 'TIPCDigitalCredential'
            if ((!((aReader)->ReadSentinel(1384318954)))) {
                mozilla::ipc::SentinelReadError("Error deserializing variant TIPCDigitalCredential of union IPCDigitalCredentialResponse");
                return {};
            }
            return std::move(tmp);
        }
    default:
        {
            aReader->FatalError("unknown variant of union IPCDigitalCredentialResponse");
            return {};
        }
    }
}

} // namespace IPC
