syntax = "proto3";

package com.wixpress.devcenter.appmarketlisting;

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

message MarketListing {
  // flynt-disable missing-taggable-annotation, missing-extensible
  option (.wix.api.entity) = {
    fqdn: "wix.devcenter.app_market_listing.v1.market_listing"
    segment: USERS
    app_def_id: "1b74bb2d-9961-4ceb-a92d-24816f77e118"
    query_options: {
      wql: {
        pattern: {
          operator: ALL_APPLICABLE_OPERATORS
          field: "id"
          field: "app_id"
          field: "language_code"
          field: "basic_info"
          field: "contact_info"
          field: "installation_requirement"
          field: "status"
          field: "classification"
          field: "pricing_data"
          field: "updated_date"
          field: "created_date"
          field: "revision"
          field: "basic_info.name"
          field: "basic_info.teaser"
          field: "basic_info.long_description"
          field: "basic_info.demo_url"
          field: "contact_info.website"
          field: "contact_info.developer_meta_site_id"
          field: "contact_info.support_email"
          field: "contact_info.privacy_policy_url"
          field: "contact_info.terms_of_use_url"
          field: "installation_requirement.allow_language_customization"
          field: "installation_requirement.required_wix_premium"
          field: "pricing_data.external_pricing_page_url"
          field: "pricing_data.external_checkout"
          field: "pricing_data.free_trial_days"
          field: "pricing_data.internal_free_trial_days"
          field: "assetsMap"
          sort: BOTH
        }
      }
    }
  };

  // market listing id
  google.protobuf.StringValue id = 1 [(.wix.api.format) = GUID];
  // app id the listing belongs to.
  string app_id = 2 [(wix.api.format) = GUID];
  // language of the listing.
  string language_code = 3 [(wix.api.format) = LANGUAGE];
  // basic info about the app.
  BasicInfo  basic_info = 4;
  // map of all marketing assets.
  map<string, com.wixpress.appservice.api.assets.Assets> assetsMap = 5;
  // app's contact info.
  ContactInfo contact_info = 6;
  // requirements for the app's installation.
  InstallationRequirement installation_requirement = 7;
  // market listing revision.
  google.protobuf.UInt64Value revision = 8;
  // date the listing was created.
  google.protobuf.Timestamp created_date = 9 [(wix.api.readOnly) = true];
  // date the listing was updated.
  google.protobuf.Timestamp updated_date = 10 [(wix.api.readOnly) = true];
  // status of the listing.
  Status status = 11;
  // app classification (kind of the app)
  com.wixpress.appservice.api.Classification classification = 12;
  // app's pricing data
  PricingData pricing_data = 13;
}

// status of the listing, DRAFT for the current market listing in the Dev Center,
// and PUBLISHED for the published market listing in the App Market.
enum Status {
  // current market listing in the Dev Center.
  DRAFT = 0;
  // published market listing in the App Market.
  PUBLISHED = 1;
  // approved market listing in the App Market.
  APPROVED = 2;
}

message InstallationRequirement {
  repeated RequiredApp required_apps = 1; // the vertical appIds needed for this app, for example Store
  repeated string include_countries = 2 [(wix.api.format) = COUNTRY];
  repeated string exclude_countries = 3 [(wix.api.format) = COUNTRY];

  // language options
  repeated string include_languages = 4 [(wix.api.format) = LANGUAGE];
  repeated string exclude_languages = 5 [(wix.api.format) = LANGUAGE];
  bool allow_language_customization = 6;
  // is Wix Premium required for this app to be installed
  bool required_wix_premium = 7;
}

message RequiredApp {
  string id = 1 [(wix.api.format) = GUID];
  string slug = 2;
}

message BasicInfo {
  google.protobuf.StringValue name = 1;
  google.protobuf.StringValue teaser = 2;
  google.protobuf.StringValue long_description = 3;
  repeated Benefits benefits = 4;
  repeated string search_keywords = 5;
  google.protobuf.StringValue demo_url = 6 [(wix.api.format) = WEB_URL];
  repeated string categories = 7;
}

message Benefits {
  string title = 1;
}

message ContactInfo {
  google.protobuf.StringValue website = 1 [(wix.api.format) = WEB_URL];
  google.protobuf.StringValue developer_meta_site_id = 2;
  //flynt-disable unannotated-pii-fields
  google.protobuf.StringValue support_email = 3 [(wix.api.format) = EMAIL];
  google.protobuf.StringValue privacy_policy_url = 4 [(wix.api.format) = WEB_URL];
  google.protobuf.StringValue terms_of_use_url = 5 [(wix.api.format) = WEB_URL];
}

message PricingData {
  // indicates if there is external PP
  google.protobuf.StringValue external_pricing_page_url= 6;
  // indicates if there is external checkout
  bool external_checkout = 5;
  // app's free trial days
  google.protobuf.Int32Value free_trial_days = 7;
  // wix's free trial days
  google.protobuf.Int32Value internal_free_trial_days = 8 [(.wix.api.min) = 0, (.wix.api.max) = 30];
}

