// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package google.ads.admanager.v1;

import "google/ads/admanager/v1/custom_field_value.proto";
import "google/ads/admanager/v1/goal.proto";
import "google/ads/admanager/v1/line_item_enums.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/protobuf/timestamp.proto";
import "google/type/money.proto";

option csharp_namespace = "Google.Ads.AdManager.V1";
option go_package = "google.golang.org/genproto/googleapis/ads/admanager/v1;admanager";
option java_multiple_files = true;
option java_outer_classname = "LineItemMessagesProto";
option java_package = "com.google.ads.admanager.v1";
option php_namespace = "Google\\Ads\\AdManager\\V1";
option ruby_package = "Google::Ads::AdManager::V1";

// A LineItem contains information about how specific ad creatives are intended
// to serve to your website or app along with pricing and other delivery
// details.
message LineItem {
  option (google.api.resource) = {
    type: "admanager.googleapis.com/LineItem"
    pattern: "networks/{network_code}/lineItems/{line_item}"
    plural: "lineItems"
    singular: "lineItem"
  };

  // Identifier. The resource name of the `LineItem`.
  // Format: `networks/{network_code}/lineItems/{line_item_id}`
  string name = 1 [(google.api.field_behavior) = IDENTIFIER];

  // Output only. The ID of the Order to which the LineItem belongs. This
  // attribute is required. Format: `networks/{network_code}/orders/{order}`
  optional string order = 2 [
    (google.api.field_behavior) = OUTPUT_ONLY,
    (google.api.resource_reference) = { type: "admanager.googleapis.com/Order" }
  ];

  // Required. The name of the line item. This attribute is required and has a
  // maximum length of 255 characters.
  optional string display_name = 3 [(google.api.field_behavior) = REQUIRED];

  // Required. The date and time on which the LineItem is enabled to begin
  // serving. This attribute is required and must be in the future.
  optional google.protobuf.Timestamp start_time = 6
      [(google.api.field_behavior) = REQUIRED];

  // Output only. The timestamp when the LineItem will stop serving. This
  // attribute is read-only and includes auto extension days.
  optional google.protobuf.Timestamp end_time = 7
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Required. Indicates the line item type of a LineItem. This attribute is
  // required. The line item type determines the default priority of the line
  // item. More information can be found at
  // https://support.google.com/admanager/answer/177279.
  optional LineItemTypeEnum.LineItemType line_item_type = 17
      [(google.api.field_behavior) = REQUIRED];

  // Required. The amount of money to spend per impression or click.
  optional google.type.Money rate = 20 [(google.api.field_behavior) = REQUIRED];

  // Output only. The amount of money allocated to the LineItem. This attribute
  // is readonly and is populated by Google. The currency code is readonly.
  optional google.type.Money budget = 35
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Optional. The values of the custom fields associated with this line item.
  repeated CustomFieldValue custom_field_values = 59
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. The primary goal that this LineItem is associated with, which is
  // used in its pacing and budgeting.
  optional Goal goal = 76 [(google.api.field_behavior) = OPTIONAL];
}
