syntax = "proto2";

package maps_adv.geosmb.landlord.proto.internal.landing_details;

import "maps_adv/geosmb/landlord/proto/common.proto";
import "maps_adv/geosmb/landlord/proto/contacts.proto";
import "maps_adv/geosmb/landlord/proto/goods.proto";
import "maps_adv/geosmb/landlord/proto/organization_details.proto";
import "maps_adv/geosmb/landlord/proto/preferences.proto";

message ShowLandingDetailsInput {
    required uint64 biz_id = 1;
    required organization_details.LandingVersion version = 2;
}

message ShowLandingDetailsOutput {
    required string slug = 1;
    required LandingDetails landing_details = 2;
    required bool is_published = 3;
}

message EditLandingDetailsInput {
    required uint64 biz_id = 1;
    required organization_details.LandingVersion version = 2;
    required LandingDetailsInput landing_details = 3;
}

message EditLandingDetailsOutput {
    required string slug = 1;
    required LandingDetails landing_details = 2;
    required bool is_published = 3;
}

message DeleteLandingInput {
    required uint64 biz_id = 1;
}

message LandingDetailsInput {
    required string name = 1;
    repeated string categories = 2;
    optional string description = 4;
    optional common.ImageTemplate logo = 5;
    optional common.ImageTemplate cover = 6;

    required Preferences preferences = 10;
    required ContactsInput contacts = 20;

    optional organization_details.Extras extras = 32;
    required BlocksOptions blocks_options = 30;
}

message ContactsInput {
  optional string email = 10;
  optional string phone = 11;
  optional string website = 12;
  repeated string phones = 13;

  optional string instagram = 20;
  optional string facebook = 21;
  optional string vkontakte = 22;
  optional string twitter = 23;
  optional string telegram = 24;
  optional string viber = 25;
  optional string whatsapp = 26;
}

message LandingDetails {
    required string name = 1;
    repeated string categories = 2;
    optional string description = 4;
    optional common.ImageTemplate logo = 5;
    optional common.ImageTemplate cover = 6;

    required Preferences preferences = 10;
    required contacts.Contacts contacts = 20;

    optional organization_details.Extras extras = 32;
    required BlocksOptions blocks_options = 30;
    optional goods.GoodsData goods = 33;

    optional bool blocked = 40;
    optional BlockingData blocking_data = 41;
}

message BlocksOptions {
    required bool show_cover = 1;
    required bool show_logo = 2;
    required bool show_schedule = 3;
    required bool show_photos = 4;
    required bool show_map_and_address = 5;
    required bool show_services = 6;
    required bool show_reviews = 7;
    optional common.Decimal reviews_min_rating = 8;
    required bool show_extras = 9;
    optional bool show_branches = 10 [default = false];
}

message CheckSlugAvailableInput {
    required string slug = 1;
    optional uint64 biz_id = 2;
}

message CheckSlugAvailableOutput {
    required bool available = 1;
}

message UpdateSlugInput {
    required uint64 biz_id = 1;
    required string slug = 2;
}

message SetLandingPublicityInput {
    required uint64 biz_id = 1;
    required bool is_published = 2;
}

message Preferences {
  optional string personal_metrika_code = 1;  // specified by user in UI

  required ColorTheme color_theme = 10;

  optional preferences.CTAButton cta_button = 20;
  optional bool cart_enabled = 21 [default=false];
  repeated preferences.SocialButton social_buttons = 22;
}

message ColorTheme {
  enum ColorTone {
    LIGHT = 1;
    DARK = 2;
  }

  required ColorTone theme = 1;
  required string preset = 2;
}

message BlockingData {
    required int64 blocker_uid = 1;
    required string blocking_description = 2;
    required string ticket_id = 3; // ref to Sansara ticket where blocking processed
}

message SetBlockedInput {
    required uint64 biz_id = 1;
    required bool is_blocked = 2;
    optional BlockingData blocking_data = 3;
}

message LandingPhoneInput {
    required uint64 permalink = 1;
}

message LandingPhoneData {
    optional string phone = 1;
}

message Photo {
    optional string id = 1;  // TODO: make required after updating all landing_data.photos
    required string url = 2;
    optional bool hidden = 3 [default = false];
}

message ShowLandingPhotoInput {
    required uint64 biz_id = 1;
    required organization_details.LandingVersion version = 2;
}

message ShowLandingPhotoOutput {
    repeated Photo photos = 3;
}

message HideLandingPhotoInput {
    required uint64 biz_id = 1;
    required organization_details.LandingVersion version = 2;
    map<string, bool> photo_id_to_hidden = 3;
}


message PermalinkInput {
    required uint64 permalink = 1;
}

