/* THIS FILE IS AUTOGENERATED - DO NOT EDIT */

#ifndef mozilla_dom_RTCIdentityProviderBinding_h
#define mozilla_dom_RTCIdentityProviderBinding_h

#include "js/RootingAPI.h"
#include "jspubtd.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/BindingUtils.h"
#include "mozilla/dom/CallbackInterface.h"
#include "mozilla/dom/Nullable.h"

namespace mozilla {
namespace dom {

struct NativePropertyHooks;
class Promise;
class ProtoAndIfaceCache;
struct RTCIdentityAssertionResultAtoms;
class RTCIdentityProvider;
struct RTCIdentityProviderAtoms;
struct RTCIdentityProviderDetails;
struct RTCIdentityProviderDetailsAtoms;
class RTCIdentityProviderRegistrar;
struct RTCIdentityProviderRegistrarAtoms;
struct RTCIdentityValidationResultAtoms;

} // namespace dom
} // namespace mozilla

namespace mozilla {
namespace dom {

struct RTCIdentityProviderDetails : public DictionaryBase
{
  nsString mDomain;
  nsString mProtocol;

  RTCIdentityProviderDetails();

  explicit inline RTCIdentityProviderDetails(const FastDictionaryInitializer& )
  {
    // Do nothing here; this is used by our "Fast" subclass
  }

  explicit inline RTCIdentityProviderDetails(const RTCIdentityProviderDetails& aOther)
  {
    *this = aOther;
  }

  bool
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);

  bool
  Init(const nsAString& aJSON);

  bool
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;

  bool
  ToJSON(nsAString& aJSON) const;

  void
  TraceDictionary(JSTracer* trc);

  void
  operator=(const RTCIdentityProviderDetails& aOther);

private:
  static bool
  InitIds(JSContext* cx, RTCIdentityProviderDetailsAtoms* atomsCache);
};

namespace binding_detail {
struct FastRTCIdentityProviderDetails : public RTCIdentityProviderDetails
{
  inline FastRTCIdentityProviderDetails()
    : RTCIdentityProviderDetails(FastDictionaryInitializer())
  {
    // Doesn't matter what int we pass to the parent constructor
  }
};
} // namespace binding_detail


struct RTCIdentityValidationResult : public DictionaryBase
{
  nsString mContents;
  nsString mIdentity;

  RTCIdentityValidationResult();

  explicit inline RTCIdentityValidationResult(const FastDictionaryInitializer& )
  {
    // Do nothing here; this is used by our "Fast" subclass
  }

  explicit inline RTCIdentityValidationResult(const RTCIdentityValidationResult& aOther)
  {
    *this = aOther;
  }

  bool
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);

  bool
  Init(const nsAString& aJSON);

  bool
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;

  bool
  ToJSON(nsAString& aJSON) const;

  void
  TraceDictionary(JSTracer* trc);

  void
  operator=(const RTCIdentityValidationResult& aOther);

private:
  static bool
  InitIds(JSContext* cx, RTCIdentityValidationResultAtoms* atomsCache);
};

namespace binding_detail {
struct FastRTCIdentityValidationResult : public RTCIdentityValidationResult
{
  inline FastRTCIdentityValidationResult()
    : RTCIdentityValidationResult(FastDictionaryInitializer())
  {
    // Doesn't matter what int we pass to the parent constructor
  }
};
} // namespace binding_detail


struct RTCIdentityAssertionResult : public DictionaryBase
{
  nsString mAssertion;
  RTCIdentityProviderDetails mIdp;

  RTCIdentityAssertionResult();

  explicit inline RTCIdentityAssertionResult(const FastDictionaryInitializer& )
    : mIdp(FastDictionaryInitializer())
  {
    // Do nothing here; this is used by our "Fast" subclass
  }

  explicit inline RTCIdentityAssertionResult(const RTCIdentityAssertionResult& aOther)
    : mIdp(FastDictionaryInitializer())
  {
    *this = aOther;
  }

  bool
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);

  bool
  Init(const nsAString& aJSON);

  bool
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;

  bool
  ToJSON(nsAString& aJSON) const;

  void
  TraceDictionary(JSTracer* trc);

  void
  operator=(const RTCIdentityAssertionResult& aOther);

private:
  static bool
  InitIds(JSContext* cx, RTCIdentityAssertionResultAtoms* atomsCache);
};

namespace binding_detail {
struct FastRTCIdentityAssertionResult : public RTCIdentityAssertionResult
{
  inline FastRTCIdentityAssertionResult()
    : RTCIdentityAssertionResult(FastDictionaryInitializer())
  {
    // Doesn't matter what int we pass to the parent constructor
  }
};
} // namespace binding_detail


namespace RTCIdentityProviderRegistrarBinding {

  typedef mozilla::dom::RTCIdentityProviderRegistrar NativeType;

  // We declare this as an array so that retrieving a pointer to this
  // binding's property hooks only requires compile/link-time resolvable
  // address arithmetic.  Declaring it as a pointer instead would require
  // doing a run-time load to fetch a pointer to this binding's property
  // hooks.  And then structures which embedded a pointer to this structure
  // would require a run-time load for proper initialization, which would
  // then induce static constructors.  Lots of static constructors.
  extern const NativePropertyHooks sNativePropertyHooks[];

  const JSClass*
  GetJSClass();

  bool
  Wrap(JSContext* aCx, mozilla::dom::RTCIdentityProviderRegistrar* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);

  template <class T>
  inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
  {
    JS::Rooted<JSObject*> reflector(aCx);
    return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
  }

  void
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);

  JS::Handle<JSObject*>
  GetProtoObjectHandle(JSContext* aCx, JS::Handle<JSObject*> aGlobal);

} // namespace RTCIdentityProviderRegistrarBinding



class RTCIdentityProvider : public CallbackInterface
{
public:
  explicit inline RTCIdentityProvider(JS::Handle<JSObject*> aCallback, nsIGlobalObject* aIncumbentGlobal)
    : CallbackInterface(aCallback, aIncumbentGlobal)
  {
  }

  already_AddRefed<Promise> GenerateAssertion(const nsAString& contents, const nsAString& origin, const Optional<nsAString>& usernameHint, ErrorResult& aRv, ExceptionHandling aExceptionHandling = eReportExceptions, JSCompartment* aCompartment = nullptr);

  already_AddRefed<Promise> ValidateAssertion(const nsAString& assertion, const nsAString& origin, ErrorResult& aRv, ExceptionHandling aExceptionHandling = eReportExceptions, JSCompartment* aCompartment = nullptr);

  inline bool
  operator==(const RTCIdentityProvider& aOther) const
  {
    return CallbackInterface::operator==(aOther);
  }

private:
  static bool
  InitIds(JSContext* cx, RTCIdentityProviderAtoms* atomsCache);
};


} // namespace dom
} // namespace mozilla

#endif // mozilla_dom_RTCIdentityProviderBinding_h
