syntax = "proto2";

package maps_adv.statistics.dashboard.proto.campaigns_stat;

import "google/protobuf/timestamp.proto";

message CampaignsStatInput {
    repeated uint64 campaign_ids = 1;
    required google.protobuf.Timestamp period_from = 2;
    required google.protobuf.Timestamp period_to = 3;
}

message CampaignsStatDetails {
    // Possible events
    required uint64 call = 1;
    required uint64 makeRoute = 2;
    required uint64 openSite = 3;
    required uint64 saveOffer = 4;
    required uint64 search = 5;
    required uint64 show = 6;
    required uint64 tap = 7;

    // Some stat
    required float ctr = 13;
    required uint64 show_unique = 15;
    required string charged_sum = 16;  // two decimal places

    required float clicks_to_routes = 17;
}

message CampaignsStatOnDate {
    required string date = 1; // like "2019-10-15"
    required CampaignsStatDetails details = 2;
}

message CampaignsStatOutput {
    required CampaignsStatDetails total = 1;
    repeated CampaignsStatOnDate by_dates = 2;
}

message IconCampaignsStatOutput {
    required IconCampaignsStatDetails total = 1;
    repeated IconCampaignsStatOnDate by_dates = 2;
}

message IconCampaignsStatDetails {
    required uint64 icon_shows = 1;
    required uint64 icon_clicks = 2;
    required uint64 pin_shows = 3;
    required uint64 pin_clicks = 4;
    required uint64 routes = 5;

    // only for stats for one campaign in one day
    // should not be used in any totals
    optional uint64 unique_icon_shows = 6;
}

message IconCampaignsStatOnDate {
    required string date = 1; // like "2019-10-15"
    required IconCampaignsStatDetails details = 2;
}
