syntax = "proto2";

package maps_adv.adv_store.proto.charger_api;

import "maps_adv/adv_store/api/proto/billing.proto";
import "google/protobuf/timestamp.proto";

message Money {
    // Amount of money * 10^4
    required uint64 value = 1;
}

message CampaignForCharger {
    required uint64 campaign_id = 1;
    optional uint64 order_id = 2;
    required Money cost = 3;
    optional Money budget = 4;
    optional Money daily_budget = 5;
    required string timezone = 6;
}

message CampaignForChargerList {
    repeated CampaignForCharger campaigns = 1;
}

message CampaignForChargerCpa {
    required uint64 campaign_id = 1;
    optional uint64 order_id = 2;
    required Money cost = 3;
    optional Money budget = 4;
    optional Money daily_budget = 5;
    required string timezone = 6;
    repeated string paid_events_names = 7;
}

message CampaignForChargerCpaList {
    repeated CampaignForChargerCpa campaigns = 1;
}

message CampaignsToStopList {
    required google.protobuf.Timestamp processed_at = 1;
    repeated CampaignToStop campaigns = 2;
}

message ReasonStopped {
    enum Enum {
        ORDER_LIMIT_REACHED = 1;
        DAILY_BUDGET_REACHED = 2;
        BUDGET_REACHED = 3;
    }
}

message CampaignToStop {
    required uint64 campaign_id = 1;
    required ReasonStopped.Enum reason_stopped = 2;
}

message CampaignForChargerFix {
    required uint64 campaign_id = 1;
    required uint64 order_id = 2;
    required Money cost = 3;
    required billing.Fix.TimeIntervalEnum time_interval = 4;
    optional google.protobuf.Timestamp paid_till = 5;
    required string timezone = 6;
}

message CampaignForChargerFixList {
    repeated CampaignForChargerFix campaigns = 1;
}
