syntax = "proto3";

package com.wixpress.metasite.event.api;

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

import "google/protobuf/timestamp.proto";

enum State {
    UNKNOWN_STATE = 0;
    TEMPLATE = 1;
    STUB = 2;
    INITIALIZED = 3;
}

message TrackingData {
    google.protobuf.StringValue google_analytics_id = 1 [(wix.api.maxLength) = 255]; // Google Analytics ID.
    google.protobuf.StringValue google_site_verification_code = 2 [(wix.api.maxLength) = 255]; // Google Site verification code.
    google.protobuf.StringValue google_remarketing_id = 3 [(wix.api.maxLength) = 255]; // Google Remarketing ID.
    google.protobuf.StringValue facebook_remarketing_id = 4 [(wix.api.maxLength) = 255]; // Facebook Remarketing ID.
    google.protobuf.StringValue yandex_metrika_id = 5 [(wix.api.maxLength) = 255]; // Yandex Metrica ID.
    //flynt-disable unannotated-pii-fields
    google.protobuf.StringValue ip_anonymization = 6 [(wix.api.maxLength) = 255, (.wix.api.pii) = false]; // TBD.
}

message Domain {
    string name = 1 [(wix.api.maxLength) = 253]; // A domain name.
    bool primary = 2; // Indicates whether the domain is primary.
    bool has_www_prefix = 3; // Indicates whether the domain should have "www." prefix.
    TrackingData tracking_data = 4; // An SEO data.
    string registrar = 5 [(wix.api.maxLength) = 255]; // A registrar.
}

message MetaTag {
    string name = 1 [(wix.api.maxLength) = 50]; // A name.
    string value = 2 [(wix.api.maxLength) = 500]; // A value.
    bool property = 3; // Indicates whether should be rendered as property.
}

message SeoData {
    google.protobuf.StringValue title = 1 [(wix.api.maxLength) = 255]; // A title.
    bool indexable = 2; // Indicates whether the site should be indexable by bots.
    bool suppress_tracking_cookies = 3; // TDB.
    google.protobuf.StringValue og_image = 4 [(wix.api.maxLength) = 300]; // TDB.
    repeated MetaTag meta_tags = 5 [(wix.api.maxSize) = 100]; // A list of meta tags.
    google.protobuf.StringValue canonical_url = 6 [(wix.api.maxLength) = 4000]; // A canonical URL for a site.
}

message UrlMapping {
    google.protobuf.StringValue host = 1 [(wix.api.maxLength) = 253]; // A host.
    string uri = 2 [(wix.api.maxLength) = 4000]; // An URI.
}

//Renderer representation in meta site model (determines to which renderer to call when the request comes to public)
message Application {
    int32 int_id = 1; // Deprecated.
    string instance_id = 2 [(wix.api.maxLength) = 160]; // An instance id. TODO(meta-site): Remove WixLists!!!
    google.protobuf.StringValue template_id_in_app = 3 [(wix.api.maxLength) = 36]; // An instance id of a template from which this instance was cloned.
    string language_code = 4 [(wix.api.maxLength) = 5]; // A language code.
    ApplicationType application_type = 5; // An application (renderer) type.
    Compatibility compatibility = 6; // TDB.
    string supported_view = 7 [(wix.api.maxLength) = 255]; // TDB.
    SeoData seo_data = 8; // An SEO data.
    int64 date_created = 9; // A date of creation.
    int64 date_updated = 10; // A date of the last update.
    bool published = 11; // Indicates whether this instance was published (WixApplication SPI is called).
    State state = 12; // An application state. Effectively unused.
    google.protobuf.StringValue thumbnail = 13 [(wix.api.maxLength) = 255]; // TDB.
    repeated UrlMapping url_mappings = 14 [(wix.api.maxSize) = 100]; // A list of mappings.

    enum ApplicationType {
        UNKNOWN_APPLICATION_TYPE = 0;
        FLASH = 1 [deprecated = true];
        FLASH_FACEBOOK = 2 [deprecated = true];
        FLASH_WIDGET = 3 [deprecated = true];
        FLASH_BANNER = 4 [deprecated = true];
        HTML_MOBILE = 5;
        HTML_WEB = 6;
        HTML_FACEBOOK = 7 [deprecated = true];
        BLOG = 8;
        WIX_LISTS = 9;
        STATIC_MOUNT = 10; // Used only for wix sites used only. Basically proxy the request to the source outside of Wix.
        STATIC_MOUNT_REDIRECT = 11; // Used only for wix sites used only. Basically redirects the request to the source outside of Wix
        AMP_BLOG = 12;
        COMMUNITIES_AMP_BLOG = 13;
        HTML_ANYWHERE = 14;
        HOPP = 15;
    }

    enum Compatibility {
        UNKNOWN_COMPATIBILITY = 0;
        WEB = 1;
        MOBILE = 2;
        ALL = 3;
    }
}

message EmbeddedService {
    int32 int_id = 1; // Deprecated.
    string instance_id = 2 [(wix.api.maxLength) = 36]; // An instance id.
    int64 date_created = 3; // A date of creation.
    int64 date_updated = 4; // A date of the last update.
    State state = 5; // A state.
    google.protobuf.StringValue non_shared_instance_id = 6 [(wix.api.maxLength) = 36];//for data sharing will hold the original instance id of the child site

    oneof attributes {
        AppBuilderAttributes app_builder = 10; // Deprecated.
        SiteMembersAttributes site_members = 11; // Site members (wix-sm-webapp).
        ListsAppsAttributes lists_apps = 12; // Deprecated.
        // ECommerceAttributes ecommerce = 13 [deprecated = true];
        ThirdPartyAppsAttributes third_party = 14; // A regular TPA.
        WixCodeAttributes wix_code = 15; // Wix code (data).
        MobileAppAttributes mobile_app = 16; // Deprecated.
        OnboardingAttributes onboarding = 17; // ADI/Onboarding.
        ClubsAttributes clubs = 18; // Clubs.
        ContactsAttributes contacts = 19; // Contacts.
        ProvidedMailingServiceAttributes provided_mailing_service = 20; // Deprecated?
    }

    message AppBuilderAttributes {
    }

    message SiteMembersAttributes {
        Kind kind = 1; // TDB.
        FormFace form_face = 2; // TDB.
        CollectionExposure collection_exposure = 3; // TDB.

        enum Kind {
            OPEN = 0;
            CLOSED = 1;
            APPLY_FOR_MEMBERSHIP = 2;
        }

        enum FormFace {
            REGISTER = 0;
            LOGIN = 1;
        }

        enum CollectionExposure {
            PUBLIC = 0;
            WIX_INTERNAL = 1;
        }
    }

    message ListsAppsAttributes {
        string app_id = 1 [(wix.api.maxLength) = 36]; // Deprecated.
        google.protobuf.BoolValue added_in_editor = 2; // Deprecated.
        google.protobuf.BoolValue visible_at_dashboard = 3; // Deprecated.
        google.protobuf.StringValue origin_instance_id = 4 [(wix.api.maxLength) = 36]; // Deprecated.
    }

    message ThirdPartyAppsAttributes {
        string app_id = 1 [(wix.api.maxLength) = 36]; // An application definition id (app_id in dev-center).
        google.protobuf.BoolValue added_in_editor = 2; // Indicates whether a component was added in the editor.
        google.protobuf.BoolValue visible_at_dashboard = 3; // Indicates whether an app should be hidden from the dashboard.
        google.protobuf.StringValue origin_instance_id = 4 [(wix.api.maxLength) = 36]; // Identifier of the originating application.
        google.protobuf.StringValue vendor_product_id = 5 [(wix.api.maxLength) = 255]; // If set -- indicates that it's premium.
        google.protobuf.BoolValue editor_dismissed = 6; // TBD.
        google.protobuf.BoolValue revoked = 7; // If true - uninstalled.
        google.protobuf.StringValue version = 8 [(wix.api.maxLength) = 500]; // A version.
        google.protobuf.StringValue published_version = 9 [(wix.api.maxLength) = 500]; // A version for rendering.
    }

    message WixCodeAttributes {
    }

    message MobileAppBannerInfo {
        string name = 1 [(wix.api.maxLength) = 255]; // Deprecated.
        string icon_url = 2 [(wix.api.maxLength) = 4000]; // Deprecated.
    }

    message MobileAppAttributes {
        MobileAppBannerInfo banner = 1; // Deprecated.
    }

    message OnboardingAttributes {
        bool in_use = 1; // Indicates whether Onboarding editor is in use.
    }

    message ClubsAttributes {
    }

    message ContactsAttributes {
    }

    message ProvidedMailingServiceAttributes {
    }
}

message WixSiteProperties {
    bool user_name_in_host = 1; // TBD.
    int32 footer_id = 2; // TBD.
    repeated string embed_tags = 3 [(wix.api.maxLength) = 255, (wix.api.maxSize) = 100]; //used to add html embeds to a site. eg: header footer
    bool iframe_render_allowed = 4; // TBD.
    HttpsPolicy https_policy = 5; // TBD.

    enum HttpsPolicy {
        UNKNOWN_HTTPS_POLICY = 0;
        DISALLOW = 1;
        ALLOW = 2;
        ENFORCE = 3;
    }
}

message EntryPoint {
    bool primary = 1; // Indicates whether an entry point is primary.

    oneof data {
        UserInHost user_in_host = 10; // TBD.
        UserInPath user_in_path = 11; // TBD.
        Domain domain = 12; // TBD.
        SinglePath single_path = 13; // TBD.
        MultilingualDomain multilingual_domain = 14; // TBD.
    }

    message UserInHost {
        string user_name = 1 [(wix.api.maxLength) = 100]; // A user name.
        string site_name = 2 [(wix.api.maxLength) = 255]; // A site name. TODO(meta-site): the limit is 20, but we have meta sites with longer site name.
    }

    message UserInPath {
        string user_name = 1 [(wix.api.maxLength) = 100]; // A user name.
        string site_name = 2 [(wix.api.maxLength) = 255]; // A site name. TODO(meta-site): the limit is 20, but we have meta sites with longer site name.
    }

    message Domain {
        string name = 1 [(wix.api.maxLength) = 253]; // A domain name.
    }

    message SinglePath {
        string path = 1 [(wix.api.maxLength) = 4000]; // A full URL.
    }

    message MultilingualDomain {
        string name = 1 [(wix.api.maxLength) = 253]; // this is the full domain including language code e.g. fr.domain.com
        string language_code = 2 [(wix.api.maxLength) = 5]; // A language code.
    }
}

message ExternalUriMapping {
    string from_external_uri = 1 [(wix.api.maxLength) = 255]; // Deprecated.
    string to_wix_uri = 2 [(wix.api.maxLength) = 255]; // Deprecated.
    google.protobuf.StringValue old_to_wix_uri = 3 [(wix.api.maxLength) = 255]; // Deprecated.
    google.protobuf.BoolValue require_domain = 4; // Deprecated.
}

message PendingApps {
    repeated PendingApp apps = 1 [(wix.api.maxSize) = 100]; // A list of pending apps.

    message PendingApp {
        string app_id = 1 [(wix.api.maxLength) = 36]; // App definition id.
        repeated PendingReason reasons = 2 [(wix.api.maxSize) = 2]; // A reason.
    }

    enum PendingReason {
        UNKNOWN = 0;
        PREMIUM = 1;
        APP_MARKET = 2;
    }
}

//Determined by Multilingual via SiteProperties
message SiteLanguages {
    SiteLanguage primary = 1; // A primary language.
    repeated SiteLanguage secondaries = 2 [(wix.api.maxSize) = 1000]; // All secondaries.
}

message SiteLanguage {
    string language_code = 1 [(wix.api.maxLength) = 5]; // A language code.
    ResolutionMethod resolution_method = 3; // A resolution method.

    enum ResolutionMethod {
        QUERY_PARAM = 0; //Render site for language using query param. eg: https://www.alonkochba.com/?lang=fr
        SUBDOMAIN = 1; //Render site for language using subdomain. eg: https://fr.alonkochba.com/
        SUBDIRECTORY = 2; //Render site for language using subdirectory. eg: https://www.alonkochba.com/fr
    }
}

message DeleteContext {
    google.protobuf.Timestamp date_deleted = 1; // When the meta site was deleted.
    DeleteStatus delete_status = 2; // A status.
    string delete_origin = 3 [(wix.api.maxLength) = 255]; // A reason (flow).
    google.protobuf.StringValue initiator_id = 4 [(wix.api.maxLength) = 255]; // A service that deleted it.

    enum DeleteStatus {
        UNKNOWN = 0;
        TRASH = 1;
        DELETED = 2;
        PENDING_PURGE = 3;
        PURGED_EXTERNALLY = 4;
    }
}

// Contains data related to Routes API (routes-writer service).
message RoutesApiData {
    PrimaryUrl primary_url = 1; // A primary URL selected in Routes API.

    message PrimaryUrl {
        string route_id = 1 [(wix.api.maxLength) = 36]; // A route id of the primary URL.
        string url = 2 [(wix.api.maxLength) = 4000]; // A URL.
    }
}

message MetaSite {
    string id = 1 [(wix.api.format) = GUID]; // A meta site id.
    int64 version = 2; // A version.
    google.protobuf.StringValue origin_template_id = 3 [(wix.api.format) = GUID]; // TBD.
    string owner_id = 4 [(wix.api.format) = GUID]; // An owner id.
    DocumentType document_type = 5; // A document type.
    string name = 6 [(wix.api.maxLength) = 255]; // A site name (free URL slug). TODO(meta-site): Our actual limit is 20, but we have 1M+ meta sites with longer site name (44034 published).
    int64 date_created = 7; // A date of creation.
    int64 date_updated = 8; // The last update date.
    google.protobuf.StringValue description = 9 [(wix.api.maxLength) = 255]; // Legacy.
    repeated PremiumFeature premium_features = 10 [(wix.api.maxSize) = 10]; // Legacy.
    google.protobuf.StringValue favicon = 11 [(wix.api.maxLength) = 255]; // A favicon file name.
    repeated Domain domains = 12 [(wix.api.maxSize) = 1000]; // A list of domains.
    repeated Application applications = 13 [(wix.api.maxSize) = 100]; // A list of renderers.
    repeated EmbeddedService embedded_services = 14 [(wix.api.maxSize) = 500]; // A list of apps.
    SeoData default_seo_data = 15; // A default SEO data.
    //google.protobuf.StringValue published_base_uri = 16;
    WixSiteProperties wix_site_properties = 17; // For documentType=WixSite only. Legacy.
    repeated EntryPoint entry_points = 18 [(wix.api.maxSize) = 10000]; // A list of entry points.
    repeated EntryPoint aliases = 19 [(wix.api.maxSize) = 10000]; // A list of aliases.
    repeated Namespace namespaces = 20 [(wix.api.maxSize) = 1]; // A namespace (empty or 1 element always).
    repeated Flag flags = 21 [(wix.api.maxSize) = 100]; // A list of flags.
    repeated ExternalUriMapping external_uri_mappings = 22 [(wix.api.maxSize) = 10000, deprecated = true, (wix.api.field_deprecated).replaced_by = "redirector-server", (wix.api.field_deprecated).target_removal_date = "2024-12-31"]; // Deprecated.
    bool published = 23; // Indicates whether a meta site is published (accessible from router-server).
    //bool dirty_routes = 24;
    //bool dirty_meta_data = 25;
    PendingApps pending_apps = 26; // Pending apps.
    google.protobuf.StringValue dev_site_app_def_id = 27 [(wix.api.readOnly) = true, (wix.api.format) = GUID]; // TBD.
    SiteLanguages languages = 28; // ML.
    DeleteContext delete_context = 29; // A delete context.
    int64 published_html_site_revision = 30; // TBD.
    RoutesApiData routes_api_data = 31; // A cached data from Routes API.
    google.protobuf.Timestamp account_created_date = 32 [(wix.api.readOnly) = true]; //A date of creation of the account that owns this meta site.

    enum DocumentType {
        UNKNOWN_DOCUMENT_TYPE = 0;
        UGC = 1; //User Generated Content - user site
        TEMPLATE = 2; // Sites used for template
        WIX_SITE = 3; // Wix's Landing Pages, marketing pages, Wix Home Page etc.
    }

    enum PremiumFeature {
        UNKNOWN_PREMIUM_FEATURE = 0;
        SHOW_WIX_WHILE_LOADING = 1;
        ADS_FREE = 2;
        HAS_ECOMMERCE = 3;
        HAS_DOMAIN = 4;
        ALWAYS_SHOW_FOOTER = 5;
        NO_ADS_IN_SOCIAL_SITES = 6;
    }

    enum Namespace {
        UNKNOWN_NAMESPACE = 0;
        WIX = 1; // Default namespace for UGC sites. MetaSites with this namespace will be shown in a user's site list by default.
        SHOUT_OUT = 2; // ShoutOut stand alone product. These are siteless (no actual Wix site, no HtmlWeb). MetaSites with this namespace will *not* be shown in a user's site list by default.
        ALBUMS = 3; // MetaSites created by the Albums product, they appear as part of the Albums app. MetaSites with this namespace will *not* be shown in a user's site list by default.
        WIX_STORES_TEST_DRIVE = 4; // Part of the WixStores migration flow, a user tries to migrate and gets this site to view and if the user likes it then stores removes this namespace and deletes the old site with the old stores. MetaSites with this namespace will *not* be shown in a user's site list by default.
        HOTELS = 5; // Hotels standalone (siteless). MetaSites with this namespace will *not* be shown in a user's site list by default.
        CLUBS = 6; // Clubs siteless MetaSites, a club without a wix website. MetaSites with this namespace will *not* be shown in a user's site list by default.
        ONBOARDING_DRAFT = 7; // A partially created ADI website. MetaSites with this namespace will *not* be shown in a user's site list by default.
        DEV_SITE = 8; // AppBuilder for AppStudio / shmite (c). MetaSites with this namespace will *not* be shown in a user's site list by default.
        LOGOS = 9; // LogoMaker websites offered to the user after logo purchase. MetaSites with this namespace will *not* be shown in a user's site list by default.
        VIDEO_MAKER = 10; // VideoMaker websites offered to the user after video purchase. MetaSites with this namespace will *not* be shown in a user's site list by default.
        PARTNER_DASHBOARD = 11; // MetaSites with this namespace will *not* be shown in a user's site list by default.
        DEV_CENTER_COMPANY = 12; // MetaSites with this namespace will *not* be shown in a user's site list by default.

        /*
           A draft created by HTML editor on open. Upon "first save" it will be moved to be of WIX domain.

           Meta site with this namespace will *not* be shown in a user's site list by default.
        */
        HTML_DRAFT = 13;
        /*
        the user-journey for Fitness users who want to start from managing their business instead of designing their website.
        Will be accessible from Site List and will not have a website app.
        Once the user attaches a site, the site will become a regular wixsite.
        */
        SITELESS_BUSINESS = 14;
        /*
        Belongs to "strategic products" company. Supports new product in the creator's economy space.
        */
        CREATOR_ECONOMY = 15;
        /**
        It is to be used in the Business First efforts.
         */
        DASHBOARD_FIRST = 16;
        /**
        Bookings business flow with no site.
         */
        ANYWHERE = 17;
        /**
        Namespace for Headless Backoffice with no editor
         */
        HEADLESS = 18;
        /**
        Namespace for master site that will exist in parent account that will be referenced by subaccounts
        The site will be used for account level CSM feature for enterprise
         */
        ACCOUNT_MASTER_CMS = 19;
        /**
        Rise.ai Siteless account management for Gift Cards and Store Credit.
         */
        RISE = 20;
        /**
        As part of the branded app new funnel, users now can create a meta site that will be branded app first.
        There's a blank site behind the scene but it's blank).
        The Mobile company will be the owner of this namespace.
         */
        BRANDED_FIRST = 21;
        /*
        Nownia.com Siteless account management for Ai Scheduling Assistant.
         */
        NOWNIA = 22;
        /*
        UGC Templates are templates that are created by users for personal use and to sale to other users.
        The Partners company owns this namespace.
         */
        UGC_TEMPLATE = 23;
        /*
        Codux Headless Sites
         */
        CODUX = 24;
        /*
        Bobb - AI Design Creator.
         */
        MEDIA_DESIGN_CREATOR = 25;
        /*
        Shared Blog Site is a unique single site across Enterprise account, 
        This site will hold all Blog posts related to the Marketing product.   
        */
        SHARED_BLOG_ENTERPRISE = 26;
        /*
        Standalone forms (siteless). MetaSites with this namespace will *not* be shown in a user's site list by default.
         */
        STANDALONE_FORMS = 27;
        /*
        Standalone events (siteless). MetaSites with this namespace will *not* be shown in a user's site list by default.
         */
        STANDALONE_EVENTS = 28;
        /*
        MIMIR - Siteless account for MIMIR Ai Job runner.
         */
        MIMIR = 29;
        /*
        Wix Twins platform.
         */
        TWINS = 30;
    }

    enum Flag {
        // Unknown flag.
        UNKNOWN_FLAG = 0;
        // ECOM_TEST_DRIVE = 1 [deprecated = true];
        // ECOM_MIGRATED = 2 [deprecated = true];
        // If present, forces usage of wixsite.com/editorx.io for free site + no usage of #!.
        URL_MIGRATED = 3;
        // Indicates whether HTTPS is used for accessing site.
        USE_HTTPS = 4;
        // Indicates that the site is managed by Editor X. Implications: different domain (editorx.com and editorx.io).
        EDITOR_X = 5;
        // Indicates metasite blocked from publishing and added additional filtering in listing API (MSS). READ_ONLY.
        BLOCKED = 6;
        /*
          Indicates that default routing won't be used for this meta site. Additionally it means that this meta site
          doesn't have viewer url based on meta site data.

          Default routing is based on domains, free url, ML etc. None of it will be used. This feature is needed
          when routing is defined completely in Routes API (routes-writer or meta-site-routes).
         */
        DONT_USE_DEFAULT_ROUTING = 7;
        //Indicates the site is managed bv Wix Studio. Implications: different domain
        STUDIO = 8;
        //Indicates the site is used as critical asset and as such is protected. You would be only able to provision applications to this meta site.
        CRITICAL_ASSET = 9;
        //Indicates that site is managed by Odeditor
        ODEDITOR = 11;
        //Indicates that site is managed by Picasso
        PICASSO = 12;
    }
}
