// Copyright 2025 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

module ai.mojom;

import "mojo/public/mojom/base/proto_wrapper.mojom";

// Represents an Enhanced Calendar Service request parameters.
struct EnhancedCalendarServiceRequestParams {
  // The text that was selected by the user for which this Enhanced Calendar
  // request is for.
  string selected_text;

  // Text surrounding the `selected text`, to help uniquely identify it within
  // the page's innerText.
  string surrounding_text;

  // An optional prompt to override the default one.
  string? optional_prompt;
};

// Represents the result of an Enhanced Calendar response. Only one of these
// fields can hold a value.
union EnhancedCalendarResponseResult {
  mojo_base.mojom.ProtoWrapper response;
  string error;
};

// Used to bridge a mojo service and execute server-side enhanced calendar
// feature requests. Different iOS mediators will instantiate, execute queries
// (by passing a completion callback) and finally destroy this service. As all
// things iOS, this runs and is used on the Browser process.
interface EnhancedCalendarService {

    // Executes an enhanced calendar feature request. The result can either
    // hold a wrapper of the EnhancedCalendarResponse proto, or an error
    // string.
    ExecuteEnhancedCalendarRequest(EnhancedCalendarServiceRequestParams request_params)
        => (EnhancedCalendarResponseResult result);

};
