syntax = "proto3";

package wix.devcenter.apps.permissions.v1;
option java_package = "com.wixpress.devcenter.apps.permissions.v1";

import "wix/api/validations.proto";
import "wix/api/entity.proto";
import "google/protobuf/timestamp.proto";

message AppPermission {
  option (.wix.api.entity) = {
    fqdn: "wix.devcenter.apps.v1.app_permission"
    segment: USERS
    appendix_files: {
      type: DOCS_CONF
      path: "appendices/docs"
    };
    appendix_files: {
      type: AUTO_SDK
      path: "appendices/sdk"
    };

    app_def_id: "82203184-b013-46b3-b143-57f5b60422a0"
    domain_events_read_permission: "DEV_CENTER.READ_APP_PERMISSIONS"
  };

  // Triggered when a permission is added to an app. 
  option (.wix.api.domain_event) = {
    event_type: CREATED
    exposure: INTERNAL
    maturity: BETA
  };
  // Triggered when a permission is deleted from an app. 
  option (.wix.api.domain_event) = {
    event_type: DELETED
    exposure: INTERNAL
    maturity: BETA
  };

  // App ID. 
  //
  // You can find the app ID in the app's dashboard's [Home page](https://manage.wix.com/app-selector?title=Select+an+App&primaryButtonText=Select+Site&actionUrl=https%3A%2F%2Fdev.wix.com%2Fapps%2F%7BappId%7D%home).
  string app_id = 1 [(.wix.api.format) = GUID];
  // Permission the app requests when installed on a site.
  //
  // Learn more [about permissions for Wix apps](https://dev.wix.com/docs/build-apps/develop-your-app/access/authorization/about-permissions).
  Permission permission = 2; 
  // When the permission was created.
  google.protobuf.Timestamp created_date = 3 [(wix.api.readOnly) = true]; 
  // When the permission was last updated.
  google.protobuf.Timestamp updated_date = 4 [(wix.api.readOnly) = true]; 
}

message Permission {
  // Permission ID.
  //
  // To find the permission ID, navigate to the [Permissions page](https://dev.wix.com/app-selector?title=Select+an+App&primaryButtonText=Select+Site&actionUrl=https%3A%2F%2Fdev.wix.com%2Fapps%2F%7BappId%7D%2Fdev-center-permissions/add) in the app's dashboard and search for the [permission you want to configure](https://dev.wix.com/docs/build-apps/develop-your-app/access/authorization/configure-permissions-for-your-app#step-1--identify-required-permissions).
  string permission_id = 1 [(wix.api.minLength) = 1, (wix.api.maxLength) = 164]; 
}

