syntax = "proto2";

package maps_adv.adv_store.proto.event_list;

import "google/protobuf/timestamp.proto";

message TimeRangeFilter {
    optional google.protobuf.Timestamp from_timestamp = 1;
    optional google.protobuf.Timestamp to_timestamp = 2;
}

message CampaignEventForOrderIdsInput {
   repeated uint64 order_ids = 1;
   repeated uint64 manul_order_ids = 2;
   optional TimeRangeFilter time_range = 3;
   optional uint64 starting_event_id = 4;
   optional uint32 limit = 5 [default = 20];
}

message CampaignEventList {
    repeated CampaignEventListItem events = 1;
}

message CampaignEventListItem {
    required uint64 id = 1;
    required google.protobuf.Timestamp timestamp = 2;
    required uint64 campaign_id = 3;
    required string campaign_name = 4;
    oneof order_id {
        uint64 billing_order_id = 5;
        uint64 manul_order_id = 6;
    }
    required CampaignEventType.Enum event_type = 7;
}

message CampaignEventType {
    enum Enum {
        END_DATE_CHANGED = 1;
        STOPPED_MANUALLY = 2;
        STOPPED_BUDGET_REACHED = 3;
        BUDGET_DECREASED = 4;
        NOT_SPENDING_BUDGET = 5;
    }
}

message CampaignEventData { // for POST
    required google.protobuf.Timestamp timestamp = 1;
    required uint64 campaign_id = 2;
    required CampaignEventType.Enum event_type = 3;
}

message CampaignEventDataList {
    repeated CampaignEventData events = 1;
}
