xref: /aosp_15_r20/external/googleapis/google/cloud/channel/v1/offers.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
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, monetization is based on usage accrued on
102  // your billing account irrespective of the type of monetizable resource. This
103  // enum represents an aggregated resource/container for all usage SKUs on a
104  // billing account. Currently, only applicable to Google Cloud.
105  IAAS_USAGE = 6;
106
107  // For Google Cloud subscriptions like Anthos or SAP.
108  SUBSCRIPTION = 7;
109}
110
111// Period Type.
112enum PeriodType {
113  // Not used.
114  PERIOD_TYPE_UNSPECIFIED = 0;
115
116  // Day.
117  DAY = 1;
118
119  // Month.
120  MONTH = 2;
121
122  // Year.
123  YEAR = 3;
124}
125
126// Represents an offer made to resellers for purchase.
127// An offer is associated with a [Sku][google.cloud.channel.v1.Sku], has a plan
128// for payment, a price, and defines the constraints for buying.
129message Offer {
130  option (google.api.resource) = {
131    type: "cloudchannel.googleapis.com/Offer"
132    pattern: "accounts/{account}/offers/{offer}"
133  };
134
135  // Resource Name of the Offer.
136  // Format: accounts/{account_id}/offers/{offer_id}
137  string name = 1;
138
139  // Marketing information for the Offer.
140  MarketingInfo marketing_info = 2;
141
142  // SKU the offer is associated with.
143  Sku sku = 3;
144
145  // Describes the payment plan for the Offer.
146  Plan plan = 4;
147
148  // Constraints on transacting the Offer.
149  Constraints constraints = 5;
150
151  // Price for each monetizable resource type.
152  repeated PriceByResource price_by_resources = 6;
153
154  // Start of the Offer validity time.
155  google.protobuf.Timestamp start_time = 7;
156
157  // Output only. End of the Offer validity time.
158  google.protobuf.Timestamp end_time = 8
159      [(google.api.field_behavior) = OUTPUT_ONLY];
160
161  // Parameters required to use current Offer to purchase.
162  repeated ParameterDefinition parameter_definitions = 9;
163
164  // The deal code of the offer to get a special promotion or discount.
165  string deal_code = 12;
166}
167
168// Parameter's definition. Specifies what parameter is required to use the
169// current Offer to purchase.
170message ParameterDefinition {
171  // Data type of the parameter.
172  enum ParameterType {
173    // Not used.
174    PARAMETER_TYPE_UNSPECIFIED = 0;
175
176    // Int64 type.
177    INT64 = 1;
178
179    // String type.
180    STRING = 2;
181
182    // Double type.
183    DOUBLE = 3;
184
185    // Boolean type.
186    BOOLEAN = 4;
187  }
188
189  // Name of the parameter.
190  string name = 1;
191
192  // Data type of the parameter. Minimal value, Maximum value and allowed values
193  // will use specified data type here.
194  ParameterType parameter_type = 2;
195
196  // Minimal value of the parameter, if applicable. Inclusive. For example,
197  // minimal commitment when purchasing Anthos is 0.01.
198  // Applicable to INT64 and DOUBLE parameter types.
199  Value min_value = 3;
200
201  // Maximum value of the parameter, if applicable. Inclusive. For example,
202  // maximum seats when purchasing Google Workspace Business Standard.
203  // Applicable to INT64 and DOUBLE parameter types.
204  Value max_value = 4;
205
206  // If not empty, parameter values must be drawn from this list.
207  // For example, [us-west1, us-west2, ...]
208  // Applicable to STRING parameter type.
209  repeated Value allowed_values = 5;
210
211  // If set to true, parameter is optional to purchase this Offer.
212  bool optional = 6;
213}
214
215// Represents the constraints for buying the Offer.
216message Constraints {
217  // Represents constraints required to purchase the Offer for a customer.
218  CustomerConstraints customer_constraints = 1;
219}
220
221// Represents constraints required to purchase the Offer for a customer.
222message CustomerConstraints {
223  // Allowed geographical regions of the customer.
224  repeated string allowed_regions = 1;
225
226  // Allowed Customer Type.
227  repeated CloudIdentityInfo.CustomerType allowed_customer_types = 2;
228
229  // Allowed Promotional Order Type. Present for Promotional offers.
230  repeated PromotionalOrderType promotional_order_types = 3;
231}
232
233// The payment plan for the Offer. Describes how to make a payment.
234message Plan {
235  // Describes how a reseller will be billed.
236  PaymentPlan payment_plan = 1;
237
238  // Specifies when the payment needs to happen.
239  PaymentType payment_type = 2;
240
241  // Describes how frequently the reseller will be billed, such as
242  // once per month.
243  Period payment_cycle = 3;
244
245  // Present for Offers with a trial period.
246  // For trial-only Offers, a paid service needs to start before the trial
247  // period ends for continued service.
248  // For Regular Offers with a trial period, the regular pricing goes into
249  // effect when trial period ends, or if paid service is started before the end
250  // of the trial period.
251  Period trial_period = 4;
252
253  // Reseller Billing account to charge after an offer transaction.
254  // Only present for Google Cloud offers.
255  string billing_account = 5;
256}
257
258// Represents price by resource type.
259message PriceByResource {
260  // Resource Type. Example: SEAT
261  ResourceType resource_type = 1;
262
263  // Price of the Offer. Present if there are no price phases.
264  Price price = 2;
265
266  // Specifies the price by time range.
267  repeated PricePhase price_phases = 3;
268}
269
270// Represents the price of the Offer.
271message Price {
272  // Base price.
273  google.type.Money base_price = 1;
274
275  // Discount percentage, represented as decimal.
276  // For example, a 20% discount will be represent as 0.2.
277  double discount = 2;
278
279  // Effective Price after applying the discounts.
280  google.type.Money effective_price = 3;
281
282  // Link to external price list, such as link to Google Voice rate card.
283  string external_price_uri = 4;
284}
285
286// Specifies the price by the duration of months.
287// For example, a 20% discount for the first six months, then a 10% discount
288// starting on the seventh month.
289message PricePhase {
290  // Defines the phase period type.
291  PeriodType period_type = 1;
292
293  // Defines first period for the phase.
294  int32 first_period = 2;
295
296  // Defines first period for the phase.
297  int32 last_period = 3;
298
299  // Price of the phase. Present if there are no price tiers.
300  Price price = 4;
301
302  // Price by the resource tiers.
303  repeated PriceTier price_tiers = 5;
304}
305
306// Defines price at resource tier level.
307// For example, an offer with following definition :
308//
309// * Tier 1: Provide 25% discount for all seats between 1 and 25.
310// * Tier 2: Provide 10% discount for all seats between 26 and 100.
311// * Tier 3: Provide flat 15% discount for all seats above 100.
312//
313// Each of these tiers is represented as a PriceTier.
314message PriceTier {
315  // First resource for which the tier price applies.
316  int32 first_resource = 1;
317
318  // Last resource for which the tier price applies.
319  int32 last_resource = 2;
320
321  // Price of the tier.
322  Price price = 3;
323}
324
325// Represents period in days/months/years.
326message Period {
327  // Total duration of Period Type defined.
328  int32 duration = 1;
329
330  // Period Type.
331  PeriodType period_type = 2;
332}
333