syntax = "proto3";

import "wix/api/validations.proto";
import "google/protobuf/wrappers.proto";

package com.wixpress.appservice.api;

message HeadlessOAuth {
  // ID of the site that uses the component.
  string site_id = 1 [(.wix.api.format) = GUID];

  // Allowlist of domains that can be redirected to after a login.
  repeated string allowed_domains = 2;

  // Component description.
  google.protobuf.StringValue description = 3;
  
  // Login URL to automatically redirect users to from Wix pages.
  google.protobuf.StringValue login_url = 4 [(.wix.api.format) = WEB_URL];
  
  // Array of URIs that can be redirected to after oAuth2 authorization.
  repeated string allowed_redirect_uris = 5 [(.wix.api.maxLength) = 2048];
  
  // Whether a user can resolve the [app secret](https://dev.wix.com/docs/rest/internal-only/dev-center-platform/app-service/introduction).
  bool block_secret_generation = 6;
    
  // Logout URL that is invoked when users logout from wix pages.
  google.protobuf.StringValue logout_url = 7 [(.wix.api.format) = WEB_URL];

  // OAuth application type.
  OAuthAppType application_type = 13;

  // OAuth technology used by the application.
  OAuthTechnologies technology = 14;

  // List of domain mappings from external domains to Wix domains.
  //
  // When a user accesses a non-Wix domain, they can be automatically forwarded to the corresponding
  // Wix domain based on these mappings. This enables domain-level redirection from
  // external domains to Wix-hosted pages.
  repeated WixPagesDomainMapping wix_pages_domains_mappings = 15 [(.wix.api.maxSize) = 10];

  // Redirect url for Wix-hosted pages.
  google.protobuf.StringValue redirect_url_wix_pages = 16 [(.wix.api.maxLength) = 1024];
}

// Types of OAuth application.
enum OAuthAppType {
  // OAuth app type is not specified.
  OAUTH_APP_TYPE_UNSPECIFIED = 0;

  // OAuth app type is a web application.
  WEB_APP = 1;

  // OAuth app type is a mobile application.
  MOBILE = 2;

  // OAuth app type is some other type of application.
  OTHER = 3;
}

// OAuth technology used by the oauth application.
enum OAuthTechnologies {
  // The OAuth technology is not specified.
  OAUTH_TECHNOLOGY_UNSPECIFIED = 0;

  // OAuth technology using JavaScript.
  JAVASCRIPT = 1;

  // OAuth technology using Angular.
  ANGULAR = 2;

  // OAuth technology using Vue.js.
  VUE = 3;

  // OAuth technology using React.
  REACT = 4;

  // OAuth technology using React Native.
  REACT_NATIVE = 5;

  // OAuth technology using iOS.
  IOS = 6;

  // OAuth technology using Android.
  ANDROID = 7;

  // OAuth technology using some other kind of technology.
  OTHER_TECHNOLOGY = 8;
}

message WixPagesDomainMapping  {
  string origin = 1 [(.wix.api.maxLength) = 2048];
  string destination = 2 [(.wix.api.maxLength) = 2048];
}