syntax = "proto3";

package com.wixpress.appservice.api;

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

option java_package = "com.wixpress.appservice.api";

message InsertAssetsToMapRequest {
    string app_id = 1 [(wix.api.format) = GUID]; // the app id.
    string language_code = 2[(wix.api.format) = LANGUAGE]; // the language code;
    string key = 3 [(wix.api.minLength) = 1];
    com.wixpress.appservice.api.assets.Assets assets = 4;
}

message AddAssetRequest {
    string app_id = 1 [(wix.api.format) = GUID]; // the app id.
    string language_code = 2[(wix.api.format) = LANGUAGE]; // the language code;
    string key = 3 [(wix.api.minLength) = 1];
    com.wixpress.appservice.api.assets.Asset asset = 4;
}

message UpdateListingInfo {
    string app_id = 1 [(wix.api.format) = GUID]; // the app id.
    string language_code = 2[(wix.api.format) = LANGUAGE]; // the language code;
    MarketListing  market_listing = 3;
}

message GetListingInfo {
    string app_id = 1 [(wix.api.format) = GUID]; // the app id.
    string language_code = 2[(wix.api.format) = LANGUAGE]; // the language code;
}


message MarketListing {
    option (.wix.api.entity) = {
        fqdn: "wix.devcenter.listing_info.v2.market_listing"
        segment: USERS
    };
    // marketing materials
    BasicInfo basic_info = 1;
    map<string, com.wixpress.appservice.api.assets.Assets> assetsMap = 2; // map of all marketing assets
    ContactInfo contact_info = 3;
    Tracking tracking_and_analytics = 4;
    string language_code = 5 [(wix.api.format) = LANGUAGE]; // the language code;
    InstallationRequirement installation_requirement = 6;
}

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;
}

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

message BasicInfo {
    string app_id = 1 [(wix.api.format) = GUID]; // the app id.
    string name = 2;
    google.protobuf.StringValue teaser = 3;
    google.protobuf.StringValue long_description = 4;
    repeated Benefits benefits = 5;
    repeated string search_keywords = 6;
    google.protobuf.StringValue demo_url = 7 [(wix.api.format) = URI];
    repeated string categories = 8;
}

message Benefits {
    string title = 1;
}

message ContactInfo {
    google.protobuf.StringValue website = 1 [(wix.api.format) = URI];
    google.protobuf.StringValue developer_meta_site_id = 2;
    google.protobuf.StringValue support_email = 3 [(wix.api.format) = EMAIL, (.wix.api.pii) = true];
    google.protobuf.StringValue privacy_policy_url = 4 [(wix.api.format) = URI];
    google.protobuf.StringValue terms_of_use_url = 5 [(wix.api.format) = URI];
}

message Tracking {
    google.protobuf.StringValue google_analytics_tracking_id = 1;
    google.protobuf.StringValue google_conversion_id = 2;
    google.protobuf.StringValue adRolll_adv_id = 3;
    google.protobuf.StringValue adRolll_pix_id = 4;
}

//payload for kafka event to update new app market listing
message OldListingChanged {
    string appId = 1;
    MarketListing market_listing = 2;
    string language_code = 3 [(wix.api.format) = LANGUAGE];
    google.protobuf.StringValue name = 4;
    google.protobuf.StringValue icon_url = 5;
}
