// chrome/browser/new_tab_page/modules/v2/calendar/google_calendar.mojom-webui.ts is auto generated by mojom_bindings_generator.py, do not edit
// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import { mojo } from '//resources/mojo/mojo/public/js/bindings.js';
import { CalendarEventSpec as ntp_calendar_mojom_CalendarEventSpec } from './calendar_data.mojom-webui.js';
export class GoogleCalendarPageHandlerPendingReceiver {
    handle;
    constructor(handle) {
        this.handle = mojo.internal.interfaceSupport.getEndpointForReceiver(handle);
    }
    bindInBrowser(scope = 'context') {
        mojo.internal.interfaceSupport.bind(this.handle, 'ntp.calendar.mojom.GoogleCalendarPageHandler', scope);
    }
}
export class GoogleCalendarPageHandlerRemote {
    proxy;
    $;
    onConnectionError;
    constructor(handle) {
        this.proxy =
            new mojo.internal.interfaceSupport.InterfaceRemoteBase(GoogleCalendarPageHandlerPendingReceiver, handle);
        this.$ = new mojo.internal.interfaceSupport.InterfaceRemoteBaseWrapper(this.proxy);
        this.onConnectionError = this.proxy.getConnectionErrorEventRouter();
    }
    getEvents() {
        return this.proxy.sendMessage(347811018, GoogleCalendarPageHandler_GetEvents_ParamsSpec.$, GoogleCalendarPageHandler_GetEvents_ResponseParamsSpec.$, [], false);
    }
    dismissModule() {
        this.proxy.sendMessage(1816119290, GoogleCalendarPageHandler_DismissModule_ParamsSpec.$, null, [], false);
    }
    restoreModule() {
        this.proxy.sendMessage(1823504012, GoogleCalendarPageHandler_RestoreModule_ParamsSpec.$, null, [], false);
    }
}
;
/**
 * An object which receives request messages for the GoogleCalendarPageHandler
 * mojom interface. Must be constructed over an object which implements that
 * interface.
 */
export class GoogleCalendarPageHandlerReceiver {
    helper_internal_;
    $;
    onConnectionError;
    constructor(impl) {
        this.helper_internal_ = new mojo.internal.interfaceSupport.InterfaceReceiverHelperInternal(GoogleCalendarPageHandlerRemote);
        this.$ = new mojo.internal.interfaceSupport.InterfaceReceiverHelper(this.helper_internal_);
        this.helper_internal_.registerHandler(347811018, GoogleCalendarPageHandler_GetEvents_ParamsSpec.$, GoogleCalendarPageHandler_GetEvents_ResponseParamsSpec.$, impl.getEvents.bind(impl), false);
        this.helper_internal_.registerHandler(1816119290, GoogleCalendarPageHandler_DismissModule_ParamsSpec.$, null, impl.dismissModule.bind(impl), false);
        this.helper_internal_.registerHandler(1823504012, GoogleCalendarPageHandler_RestoreModule_ParamsSpec.$, null, impl.restoreModule.bind(impl), false);
        this.onConnectionError = this.helper_internal_.getConnectionErrorEventRouter();
    }
}
export class GoogleCalendarPageHandler {
    static get $interfaceName() {
        return "ntp.calendar.mojom.GoogleCalendarPageHandler";
    }
    /**
     * Returns a remote for this interface which sends messages to the browser.
     * The browser must have an interface request binder registered for this
     * interface and accessible to the calling document's frame.
     */
    static getRemote() {
        let remote = new GoogleCalendarPageHandlerRemote;
        remote.$.bindNewPipeAndPassReceiver().bindInBrowser();
        return remote;
    }
}
/**
 * An object which receives request messages for the GoogleCalendarPageHandler
 * mojom interface and dispatches them as callbacks. One callback receiver exists
 * on this object for each message defined in the mojom interface, and each
 * receiver can have any number of listeners added to it.
 */
export class GoogleCalendarPageHandlerCallbackRouter {
    helper_internal_;
    $;
    router_;
    getEvents;
    dismissModule;
    restoreModule;
    onConnectionError;
    constructor() {
        this.helper_internal_ = new mojo.internal.interfaceSupport.InterfaceReceiverHelperInternal(GoogleCalendarPageHandlerRemote);
        this.$ = new mojo.internal.interfaceSupport.InterfaceReceiverHelper(this.helper_internal_);
        this.router_ = new mojo.internal.interfaceSupport.CallbackRouter;
        this.getEvents =
            new mojo.internal.interfaceSupport.InterfaceCallbackReceiver(this.router_);
        this.helper_internal_.registerHandler(347811018, GoogleCalendarPageHandler_GetEvents_ParamsSpec.$, GoogleCalendarPageHandler_GetEvents_ResponseParamsSpec.$, this.getEvents.createReceiverHandler(true /* expectsResponse */), false);
        this.dismissModule =
            new mojo.internal.interfaceSupport.InterfaceCallbackReceiver(this.router_);
        this.helper_internal_.registerHandler(1816119290, GoogleCalendarPageHandler_DismissModule_ParamsSpec.$, null, this.dismissModule.createReceiverHandler(false /* expectsResponse */), false);
        this.restoreModule =
            new mojo.internal.interfaceSupport.InterfaceCallbackReceiver(this.router_);
        this.helper_internal_.registerHandler(1823504012, GoogleCalendarPageHandler_RestoreModule_ParamsSpec.$, null, this.restoreModule.createReceiverHandler(false /* expectsResponse */), false);
        this.onConnectionError = this.helper_internal_.getConnectionErrorEventRouter();
    }
    /**
     * @param id An ID returned by a prior call to addListener.
     * @return True iff the identified listener was found and removed.
     */
    removeListener(id) {
        return this.router_.removeListener(id);
    }
}
export const GoogleCalendarPageHandler_GetEvents_ParamsSpec = { $: {} };
export const GoogleCalendarPageHandler_GetEvents_ResponseParamsSpec = { $: {} };
export const GoogleCalendarPageHandler_DismissModule_ParamsSpec = { $: {} };
export const GoogleCalendarPageHandler_RestoreModule_ParamsSpec = { $: {} };
mojo.internal.Struct(GoogleCalendarPageHandler_GetEvents_ParamsSpec.$, 'GoogleCalendarPageHandler_GetEvents_Params', [], [[0, 8],]);
mojo.internal.Struct(GoogleCalendarPageHandler_GetEvents_ResponseParamsSpec.$, 'GoogleCalendarPageHandler_GetEvents_ResponseParams', [
    mojo.internal.StructField('events', 0, 0, mojo.internal.Array(ntp_calendar_mojom_CalendarEventSpec.$, false), null, false /* nullable */, 0, undefined, undefined),
], [[0, 16],]);
mojo.internal.Struct(GoogleCalendarPageHandler_DismissModule_ParamsSpec.$, 'GoogleCalendarPageHandler_DismissModule_Params', [], [[0, 8],]);
mojo.internal.Struct(GoogleCalendarPageHandler_RestoreModule_ParamsSpec.$, 'GoogleCalendarPageHandler_RestoreModule_Params', [], [[0, 8],]);
