1// Copyright 2023 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15syntax = "proto3";
16
17package google.cloud.channel.v1;
18
19import "google/api/field_behavior.proto";
20import "google/api/resource.proto";
21import "google/cloud/channel/v1/common.proto";
22import "google/cloud/channel/v1/products.proto";
23import "google/protobuf/timestamp.proto";
24import "google/type/money.proto";
25
26option go_package = "cloud.google.com/go/channel/apiv1/channelpb;channelpb";
27option java_multiple_files = true;
28option java_outer_classname = "OffersProto";
29option java_package = "com.google.cloud.channel.v1";
30
31// Constraints type for Promotional offers.
32enum PromotionalOrderType {
33  // Not used.
34  PROMOTIONAL_TYPE_UNSPECIFIED = 0;
35
36  // Order used for new customers, trial conversions and upgrades.
37  NEW_UPGRADE = 1;
38
39  // All orders for transferring an existing customer.
40  TRANSFER = 2;
41
42  // Orders for modifying an existing customer's promotion on the same SKU.
43  PROMOTION_SWITCH = 3;
44}
45
46// Describes how the reseller will be billed.
47enum PaymentPlan {
48  // Not used.
49  PAYMENT_PLAN_UNSPECIFIED = 0;
50
51  // Commitment.
52  COMMITMENT = 1;
53
54  // No commitment.
55  FLEXIBLE = 2;
56
57  // Free.
58  FREE = 3;
59
60  // Trial.
61  TRIAL = 4;
62
63  // Price and ordering not available through API.
64  OFFLINE = 5;
65}
66
67// Specifies when the payment needs to happen.
68enum PaymentType {
69  // Not used.
70  PAYMENT_TYPE_UNSPECIFIED = 0;
71
72  // Prepay. Amount has to be paid before service is rendered.
73  PREPAY = 1;
74
75  // Postpay. Reseller is charged at the end of the Payment cycle.
76  POSTPAY = 2;
77}
78
79// Represents the type for a monetizable resource(any entity on which billing
80// happens). For example, this could be MINUTES for Google Voice and GB for
81// Google Drive. One SKU can map to multiple monetizable resources.
82enum ResourceType {
83  // Not used.
84  RESOURCE_TYPE_UNSPECIFIED = 0;
85
86  // Seat.
87  SEAT = 1;
88
89  // Monthly active user.
90  MAU = 2;
91
92  // GB (used for storage SKUs).
93  GB = 3;
94
95  // Active licensed users(for Voice SKUs).
96  LICENSED_USER = 4;
97
98  // Voice usage.
99  MINUTES = 5;
100
101  // For IaaS SKUs like Google Cloud Platform, monetization is based on usage
102  // accrued on your billing account irrespective of the type of monetizable
103  // resource. This enum represents an aggregated resource/container for all
104  // usage SKUs on a billing account. Currently, only applicable to Google Cloud
105  // Platform.
106  IAAS_USAGE = 6;
107
108  // For Google Cloud Platform subscriptions like Anthos or SAP.
109  SUBSCRIPTION = 7;
110}
111
112// Period Type.
113enum PeriodType {
114  // Not used.
115  PERIOD_TYPE_UNSPECIFIED = 0;
116
117  // Day.
118  DAY = 1;
119
120  // Month.
121  MONTH = 2;
122
123  // Year.
124  YEAR = 3;
125}
126
127// Represents an offer made to resellers for purchase.
128// An offer is associated with a [Sku][google.cloud.channel.v1.Sku], has a plan
129// for payment, a price, and defines the constraints for buying.
130message Offer {
131  option (google.api.resource) = {
132    type: "cloudchannel.googleapis.com/Offer"
133    pattern: "accounts/{account}/offers/{offer}"
134  };
135
136  // Resource Name of the Offer.
137  // Format: accounts/{account_id}/offers/{offer_id}
138  string name = 1;
139
140  // Marketing information for the Offer.
141  MarketingInfo marketing_info = 2;
142
143  // SKU the offer is associated with.
144  Sku sku = 3;
145
146  // Describes the payment plan for the Offer.
147  Plan plan = 4;
148
149  // Constraints on transacting the Offer.
150  Constraints constraints = 5;
151
152  // Price for each monetizable resource type.
153  repeated PriceByResource price_by_resources = 6;
154
155  // Start of the Offer validity time.
156  google.protobuf.Timestamp start_time = 7;
157
158  // Output only. End of the Offer validity time.
159  google.protobuf.Timestamp end_time = 8
160      [(google.api.field_behavior) = OUTPUT_ONLY];
161
162  // Parameters required to use current Offer to purchase.
163  repeated ParameterDefinition parameter_definitions = 9;
164
165  // The deal code of the offer to get a special promotion or discount.
166  string deal_code = 12;
167}
168
169// Parameter's definition. Specifies what parameter is required to use the
170// current Offer to purchase.
171message ParameterDefinition {
172  // Data type of the parameter.
173  enum ParameterType {
174    // Not used.
175    PARAMETER_TYPE_UNSPECIFIED = 0;
176
177    // Int64 type.
178    INT64 = 1;
179
180    // String type.
181    STRING = 2;
182
183    // Double type.
184    DOUBLE = 3;
185  }
186
187  // Name of the parameter.
188  string name = 1;
189
190  // Data type of the parameter. Minimal value, Maximum value and allowed values
191  // will use specified data type here.
192  ParameterType parameter_type = 2;
193
194  // Minimal value of the parameter, if applicable. Inclusive. For example,
195  // minimal commitment when purchasing Anthos is 0.01.
196  // Applicable to INT64 and DOUBLE parameter types.
197  Value min_value = 3;
198
199  // Maximum value of the parameter, if applicable. Inclusive. For example,
200  // maximum seats when purchasing Google Workspace Business Standard.
201  // Applicable to INT64 and DOUBLE parameter types.
202  Value max_value = 4;
203
204  // If not empty, parameter values must be drawn from this list.
205  // For example, [us-west1, us-west2, ...]
206  // Applicable to STRING parameter type.
207  repeated Value allowed_values = 5;
208
209  // If set to true, parameter is optional to purchase this Offer.
210  bool optional = 6;
211}
212
213// Represents the constraints for buying the Offer.
214message Constraints {
215  // Represents constraints required to purchase the Offer for a customer.
216  CustomerConstraints customer_constraints = 1;
217}
218
219// Represents constraints required to purchase the Offer for a customer.
220message CustomerConstraints {
221  // Allowed geographical regions of the customer.
222  repeated string allowed_regions = 1;
223
224  // Allowed Customer Type.
225  repeated CloudIdentityInfo.CustomerType allowed_customer_types = 2;
226
227  // Allowed Promotional Order Type. Present for Promotional offers.
228  repeated PromotionalOrderType promotional_order_types = 3;
229}
230
231// The payment plan for the Offer. Describes how to make a payment.
232message Plan {
233  // Describes how a reseller will be billed.
234  PaymentPlan payment_plan = 1;
235
236  // Specifies when the payment needs to happen.
237  PaymentType payment_type = 2;
238
239  // Describes how frequently the reseller will be billed, such as
240  // once per month.
241  Period payment_cycle = 3;
242
243  // Present for Offers with a trial period.
244  // For trial-only Offers, a paid service needs to start before the trial
245  // period ends for continued service.
246  // For Regular Offers with a trial period, the regular pricing goes into
247  // effect when trial period ends, or if paid service is started before the end
248  // of the trial period.
249  Period trial_period = 4;
250
251  // Reseller Billing account to charge after an offer transaction.
252  // Only present for Google Cloud Platform offers.
253  string billing_account = 5;
254}
255
256// Represents price by resource type.
257message PriceByResource {
258  // Resource Type. Example: SEAT
259  ResourceType resource_type = 1;
260
261  // Price of the Offer. Present if there are no price phases.
262  Price price = 2;
263
264  // Specifies the price by time range.
265  repeated PricePhase price_phases = 3;
266}
267
268// Represents the price of the Offer.
269message Price {
270  // Base price.
271  google.type.Money base_price = 1;
272
273  // Discount percentage, represented as decimal.
274  // For example, a 20% discount will be represent as 0.2.
275  double discount = 2;
276
277  // Effective Price after applying the discounts.
278  google.type.Money effective_price = 3;
279
280  // Link to external price list, such as link to Google Voice rate card.
281  string external_price_uri = 4;
282}
283
284// Specifies the price by the duration of months.
285// For example, a 20% discount for the first six months, then a 10% discount
286// starting on the seventh month.
287message PricePhase {
288  // Defines the phase period type.
289  PeriodType period_type = 1;
290
291  // Defines first period for the phase.
292  int32 first_period = 2;
293
294  // Defines first period for the phase.
295  int32 last_period = 3;
296
297  // Price of the phase. Present if there are no price tiers.
298  Price price = 4;
299
300  // Price by the resource tiers.
301  repeated PriceTier price_tiers = 5;
302}
303
304// Defines price at resource tier level.
305// For example, an offer with following definition :
306//
307// * Tier 1: Provide 25% discount for all seats between 1 and 25.
308// * Tier 2: Provide 10% discount for all seats between 26 and 100.
309// * Tier 3: Provide flat 15% discount for all seats above 100.
310//
311// Each of these tiers is represented as a PriceTier.
312message PriceTier {
313  // First resource for which the tier price applies.
314  int32 first_resource = 1;
315
316  // Last resource for which the tier price applies.
317  int32 last_resource = 2;
318
319  // Price of the tier.
320  Price price = 3;
321}
322
323// Represents period in days/months/years.
324message Period {
325  // Total duration of Period Type defined.
326  int32 duration = 1;
327
328  // Period Type.
329  PeriodType period_type = 2;
330}
331