syntax = "proto3";

package com.wixpress.appservice.api;
import "google/protobuf/struct.proto";
import "google/protobuf/wrappers.proto";
import "wix/api/validations.proto";
import "wix/api/annotations.proto";
import "components_catalog_data/notifications_common.proto";

// Describes user notifications
message UserNotification {
  google.protobuf.StringValue reference_id = 8 [(wix.api.format) = GUID, (wix.api.field_exposure) = PRIVATE];

  UserNotificationData reference_data = 9;
}

message UserNotificationData {
  message RecipientFilter {
    enum Type {
      UNKNOWN_TYPE = 0 [(.wix.api.enum_maturity) = NOT_IMPLEMENTED, (.wix.api.enum_exposure) = PRIVATE];
      WIX_USERS = 1;
      SITE_CONTRIBUTORS = 2;
    }

    message WixUsersData {
      TypedDynamicParam id = 1; // id
    }

    message SiteContributorsData {
      repeated string permissions = 1 [(wix.api.minSize) = 1];
    }

    Type type = 1; // recipient filter type
    oneof data {
      WixUsersData wix_users_data = 2; // wix users data
      SiteContributorsData site_contributors_data = 3; // site contributors data
    }
  }
  message Initiator {
    enum Type {
      UNKNOWN_TYPE = 0 [(.wix.api.enum_maturity) = NOT_IMPLEMENTED, (.wix.api.enum_exposure) = PRIVATE];
      WIX_USER = 1;
      WIX_APP = 2;
    }

    message WixUserData {
      string dynamic_param_name = 1 [(.wix.api.minLength) = 1]; // dynamic param name
    }

    Type type = 1; // initiator type
    oneof data {
      WixUserData wix_user_data = 2; // wix user data
    }
  }
  message Deeplink {
    message BackofficeActionDeeplink {
      string app_id = 1 [(.wix.api.minLength) = 1]; // app ID
      map<string, ConstOrDynamicParam> params = 2; // params
    }

    oneof of {
      Url url = 1; // url
      BackofficeActionDeeplink backoffice = 2 [(wix.api.field_exposure) = INTERNAL]; // backoffice
    }

    google.protobuf.StringValue account_id_param_name = 3  [(wix.api.field_exposure) = INTERNAL]; // account id parameter name
  }
  
  message Context {
    enum Level {
      UNKNOWN_LEVEL = 0 [(.wix.api.enum_maturity) = NOT_IMPLEMENTED, (.wix.api.enum_exposure) = PRIVATE];
      ACCOUNT = 1;
      USER = 2 [(.wix.api.enum_maturity) = NOT_IMPLEMENTED, (.wix.api.enum_exposure) = PRIVATE];
      SITE = 3;
    }

    Level level = 1;
    map<string, OrderValue> params = 2; // params
  }

  enum Type {
    UNKNOWN_TYPE = 0 [(.wix.api.enum_maturity) = NOT_IMPLEMENTED, (.wix.api.enum_exposure) = PRIVATE];
    REGULAR = 1;
    ALERT_WARNING = 2;
    ALERT_INFO = 3;
  }

  google.protobuf.StringValue name = 1 [(.wix.api.field_exposure) = PRIVATE]; // name
  google.protobuf.StringValue description = 2; // description
  google.protobuf.StringValue topic_id = 3 [(.wix.api.minLength) = 1, (wix.api.format)=GUID]; // topic id
  NotificationChannels channels = 4; // channels
  Icon icon = 5; // icon
  Intent intent = 6; // intent
  LimiterField limiter_field = 7; // limiter field

  RecipientFilter recipient_filter = 10; // recipient filter
  Initiator initiator = 11; // initiator
  Deeplink single_deeplink = 12; // single deeplink
  Deeplink grouped_deeplink = 13; // grouped deeplink
  Context context = 14; // context
  Type type = 15; // type
}
