// Copyright 2020 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.googleads.v2.resources;

import "google/ads/googleads/v2/common/user_lists.proto";
import "google/ads/googleads/v2/enums/access_reason.proto";
import "google/ads/googleads/v2/enums/user_list_access_status.proto";
import "google/ads/googleads/v2/enums/user_list_closing_reason.proto";
import "google/ads/googleads/v2/enums/user_list_membership_status.proto";
import "google/ads/googleads/v2/enums/user_list_size_range.proto";
import "google/ads/googleads/v2/enums/user_list_type.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/protobuf/wrappers.proto";
import "google/api/annotations.proto";

option csharp_namespace = "Google.Ads.GoogleAds.V2.Resources";
option go_package = "google.golang.org/genproto/googleapis/ads/googleads/v2/resources;resources";
option java_multiple_files = true;
option java_outer_classname = "UserListProto";
option java_package = "com.google.ads.googleads.v2.resources";
option objc_class_prefix = "GAA";
option php_namespace = "Google\\Ads\\GoogleAds\\V2\\Resources";
option ruby_package = "Google::Ads::GoogleAds::V2::Resources";

// Proto file describing the User List resource.

// A user list. This is a list of users a customer may target.
message UserList {
  option (google.api.resource) = {
    type: "googleads.googleapis.com/UserList"
    pattern: "customers/{customer}/userLists/{user_list}"
  };

  // Immutable. The resource name of the user list.
  // User list resource names have the form:
  //
  // `customers/{customer_id}/userLists/{user_list_id}`
  string resource_name = 1 [
    (google.api.field_behavior) = IMMUTABLE,
    (google.api.resource_reference) = {
      type: "googleads.googleapis.com/UserList"
    }
  ];

  // Output only. Id of the user list.
  google.protobuf.Int64Value id = 2 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. A flag that indicates if a user may edit a list. Depends on the list
  // ownership and list type. For example, external remarketing user lists are
  // not editable.
  //
  // This field is read-only.
  google.protobuf.BoolValue read_only = 3 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Name of this user list. Depending on its access_reason, the user list name
  // may not be unique (e.g. if access_reason=SHARED)
  google.protobuf.StringValue name = 4;

  // Description of this user list.
  google.protobuf.StringValue description = 5;

  // Membership status of this user list. Indicates whether a user list is open
  // or active. Only open user lists can accumulate more users and can be
  // targeted to.
  google.ads.googleads.v2.enums.UserListMembershipStatusEnum.UserListMembershipStatus membership_status = 6;

  // An ID from external system. It is used by user list sellers to correlate
  // IDs on their systems.
  google.protobuf.StringValue integration_code = 7;

  // Number of days a user's cookie stays on your list since its most recent
  // addition to the list. This field must be between 0 and 540 inclusive.
  // However, for CRM based userlists, this field can be set to 10000 which
  // means no expiration.
  //
  // It'll be ignored for logical_user_list.
  google.protobuf.Int64Value membership_life_span = 8;

  // Output only. Estimated number of users in this user list, on the Google Display Network.
  // This value is null if the number of users has not yet been determined.
  //
  // This field is read-only.
  google.protobuf.Int64Value size_for_display = 9 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Size range in terms of number of users of the UserList, on the Google
  // Display Network.
  //
  // This field is read-only.
  google.ads.googleads.v2.enums.UserListSizeRangeEnum.UserListSizeRange size_range_for_display = 10 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Estimated number of users in this user list in the google.com domain.
  // These are the users available for targeting in Search campaigns.
  // This value is null if the number of users has not yet been determined.
  //
  // This field is read-only.
  google.protobuf.Int64Value size_for_search = 11 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Size range in terms of number of users of the UserList, for Search ads.
  //
  // This field is read-only.
  google.ads.googleads.v2.enums.UserListSizeRangeEnum.UserListSizeRange size_range_for_search = 12 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Type of this list.
  //
  // This field is read-only.
  google.ads.googleads.v2.enums.UserListTypeEnum.UserListType type = 13 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Indicating the reason why this user list membership status is closed. It is
  // only populated on lists that were automatically closed due to inactivity,
  // and will be cleared once the list membership status becomes open.
  google.ads.googleads.v2.enums.UserListClosingReasonEnum.UserListClosingReason closing_reason = 14;

  // Output only. Indicates the reason this account has been granted access to the list.
  // The reason can be SHARED, OWNED, LICENSED or SUBSCRIBED.
  //
  // This field is read-only.
  google.ads.googleads.v2.enums.AccessReasonEnum.AccessReason access_reason = 15 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Indicates if this share is still enabled. When a UserList is shared with
  // the user this field is set to ENABLED. Later the userList owner can decide
  // to revoke the share and make it DISABLED.
  // The default value of this field is set to ENABLED.
  google.ads.googleads.v2.enums.UserListAccessStatusEnum.UserListAccessStatus account_user_list_status = 16;

  // Indicates if this user list is eligible for Google Search Network.
  google.protobuf.BoolValue eligible_for_search = 17;

  // Output only. Indicates this user list is eligible for Google Display Network.
  //
  // This field is read-only.
  google.protobuf.BoolValue eligible_for_display = 18 [(google.api.field_behavior) = OUTPUT_ONLY];

  // The user list.
  //
  // Exactly one must be set.
  oneof user_list {
    // User list of CRM users provided by the advertiser.
    google.ads.googleads.v2.common.CrmBasedUserListInfo crm_based_user_list = 19;

    // Output only. User list which are similar to users from another UserList.
    // These lists are readonly and automatically created by google.
    google.ads.googleads.v2.common.SimilarUserListInfo similar_user_list = 20 [(google.api.field_behavior) = OUTPUT_ONLY];

    // User list generated by a rule.
    google.ads.googleads.v2.common.RuleBasedUserListInfo rule_based_user_list = 21;

    // User list that is a custom combination of user lists and user interests.
    google.ads.googleads.v2.common.LogicalUserListInfo logical_user_list = 22;

    // User list targeting as a collection of conversion or remarketing actions.
    google.ads.googleads.v2.common.BasicUserListInfo basic_user_list = 23;
  }
}
