syntax = "proto2";

package maps_adv.billing_proxy.proto.orders;

import "google/protobuf/timestamp.proto";
import "maps_adv/billing_proxy/proto/common.proto";

// Order creation request payload
message OrderCreationInput {
    required string title = 1;
    required uint64 client_id = 2;
    optional uint64 agency_id = 3;
    required uint64 product_id = 4;
    optional uint64 contract_id = 5;
    optional string text = 7;
    optional string comment = 8;
    optional uint64 service_id = 9;
}

// Order info
message Order {
    required uint64 id = 1;
    required string title = 2;
    required google.protobuf.Timestamp created_at = 3;
    required uint64 client_id = 4;
    optional uint64 agency_id = 5;
    optional uint64 contract_id = 6;
    required uint64 product_id = 7;
    optional string text = 9;
    optional string comment = 10;
    optional common.MoneyQuantity OBSOLETE__limit = 11;
    optional common.MoneyQuantity OBSOLETE__consumed = 12;
    optional string limit = 16;
    optional string consumed = 17;
    optional uint64 external_id = 19;
    optional uint64 service_id = 20;

    // Read-only fields denormalized from product
    optional common.CampaignType campaign_type = 13;
    optional common.PlatformType platform = 14;
    repeated common.PlatformType platforms = 18;
    optional common.CurrencyType currency = 15;
}

message Orders {
    repeated Order orders = 1;
}

// Order deposit request creation payload
message OrderDepositRequestCreationInput {
    oneof amount_compat {
        common.MoneyQuantity OBSOLETE__amount = 1;
        string amount = 3;
    }
    optional string region = 2;
}

message OrderDepositRequest {
    required uint64 request_id = 1;
    required string user_url = 2;
    required string admin_url = 3;
}

// Order debit payload
//message OrderDebitInput {
//    required uint64 order_id = 1;
//    oneof amount_compat {
//        common.MoneyQuantity OBSOLETE__amount = 2;
//        string amount = 3;
//    }
//}
//
//message OrdersDebitInput {
//    repeated OrderDebitInput debits = 1;
//}


message OrderIds {
    repeated uint64 order_ids = 1;
}

message OrderUpdateInput {
    required string title = 1;
    required string text = 2;
    required string comment = 3;
}

message AccountManagerId {
    required uint64 account_manager_id = 1;
}
