syntax = "proto3";

package com.wixpress.appservice.api.upstream.com.wix.bookings.externalcalendar.spi.v1;
option java_package = "com.wixpress.appservice.api.upstream.com.wix.bookings.externalcalendar.spi.v1";

import "wix/api/annotations.proto";
import "wix/spi/definitions.proto";
import "wix/api/validations.proto";
import "components_catalog_data/bookings_external_calendar_provider/com/wixpress/appservice/api/upstream/com/wix/bookings/externalcalendar/spi/v1/calendar.proto";

message ProviderConfig {
    option (.wix.api.decomposite_of) = "com.wix.bookings.externalcalendar.spi.v1.ProviderConfig";
  // The name of the calendar provider.
  string name = 1 [(.wix.api.minLength) = 1];
  // The base URI in which all methods are deployed.
  string base_uri = 2 [(.wix.spi.base_uri) = true];
  // The provided calendar type.
  CalendarTypeEnum.CalendarType calendar_type = 3;
  // Connect methods used to connect to the calendar.
  repeated ConnectMethod connect_methods = 4 [(.wix.api.minSize) = 1];
  // Whether the sync configuration can be updated.
  bool can_update_sync_config = 5;
  // Whether events can be listed from the external calendar to the Wix calendar.
  ListEventFromCalendars list_event_from_calendars = 6;
  // Whether Wix calendar sessions can be synced to the external calendar.
  SyncToCalendar sync_to_calendar = 7;
  
  enum ConnectMethod {
    OAUTH = 0;
    CREDENTIALS = 1;
  }
  
  enum ListEventFromCalendars {
    // Listing events from the external calendar is not supported.
    LIST_NOT_SUPPORTED = 0;
    // Listing events from the primary external calendar only.
    LIST_FROM_PRIMARY_CALENDAR_ONLY = 1;
    // Listing events from specific external calendars.
    // The external calendars can be listed using the `ExternalCalendarProvider.ListCalendars` API.
    LIST_FROM_SPECIFIC_CALENDARS = 2;
  }
  
  enum SyncToCalendar {
    // Syncing Wix calendar sessions to the external calendar is not supported.
    SYNC_NOT_SUPPORTED = 0;
    // Syncing Wix calendar sessions to the primary external calendar only.
    SYNC_TO_PRIMARY_CALENDAR_ONLY = 1;
    // Syncing Wix calendar sessions to a new external calendar.
    SYNC_TO_DEDICATED_CALENDAR = 2;
  }
}

