// Copyright 2026 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.datamanager.v1;

import "google/ads/datamanager/v1/user_list_direct_license.proto";
import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/protobuf/field_mask.proto";

option csharp_namespace = "Google.Ads.DataManager.V1";
option go_package = "cloud.google.com/go/datamanager/apiv1/datamanagerpb;datamanagerpb";
option java_multiple_files = true;
option java_outer_classname = "UserListDirectLicenseServiceProto";
option java_package = "com.google.ads.datamanager.v1";
option php_namespace = "Google\\Ads\\DataManager\\V1";
option ruby_package = "Google::Ads::DataManager::V1";

// Service for managing user list direct licenses. Delete is not a supported
// operation for UserListDirectLicenses.  Callers should update the
// license status to DISABLED to instead to deactivate a license.
//
// This feature is only available to data partners.
service UserListDirectLicenseService {
  option (google.api.default_host) = "datamanager.googleapis.com";
  option (google.api.oauth_scopes) =
      "https://www.googleapis.com/auth/datamanager";

  // Creates a user list direct license.
  //
  // This feature is only available to data partners.
  rpc CreateUserListDirectLicense(CreateUserListDirectLicenseRequest)
      returns (UserListDirectLicense) {
    option (google.api.http) = {
      post: "/v1/{parent=accountTypes/*/accounts/*}/userListDirectLicenses"
      body: "user_list_direct_license"
    };
    option (google.api.method_signature) = "parent,user_list_direct_license";
  }

  // Retrieves a user list direct license.
  //
  // This feature is only available to data partners.
  rpc GetUserListDirectLicense(GetUserListDirectLicenseRequest)
      returns (UserListDirectLicense) {
    option (google.api.http) = {
      get: "/v1/{name=accountTypes/*/accounts/*/userListDirectLicenses/*}"
    };
    option (google.api.method_signature) = "name";
  }

  // Updates a user list direct license.
  //
  // This feature is only available to data partners.
  rpc UpdateUserListDirectLicense(UpdateUserListDirectLicenseRequest)
      returns (UserListDirectLicense) {
    option (google.api.http) = {
      patch: "/v1/{user_list_direct_license.name=accountTypes/*/accounts/*/userListDirectLicenses/*}"
      body: "user_list_direct_license"
    };
    option (google.api.method_signature) =
        "user_list_direct_license,update_mask";
  }

  // Lists all user list direct licenses owned by the parent account.
  //
  // This feature is only available to data partners.
  rpc ListUserListDirectLicenses(ListUserListDirectLicensesRequest)
      returns (ListUserListDirectLicensesResponse) {
    option (google.api.http) = {
      get: "/v1/{parent=accountTypes/*/accounts/*}/userListDirectLicenses"
    };
    option (google.api.method_signature) = "parent";
  }
}

// Request to create a
// [UserListDirectLicense][google.ads.datamanager.v1.UserListDirectLicense]
// resource.
message CreateUserListDirectLicenseRequest {
  // Required. The account that owns the user list being licensed. Should be in
  // the format accountTypes/{ACCOUNT_TYPE}/accounts/{ACCOUNT_ID}
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "datamanager.googleapis.com/UserListDirectLicense"
    }
  ];

  // Required. The user list direct license to create.
  UserListDirectLicense user_list_direct_license = 2
      [(google.api.field_behavior) = REQUIRED];
}

// Request to get a
// [UserListDirectLicense][google.ads.datamanager.v1.UserListDirectLicense]
// resource.
message GetUserListDirectLicenseRequest {
  // Required. The resource name of the user list direct license.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "datamanager.googleapis.com/UserListDirectLicense"
    }
  ];
}

// Request to update a
// [UserListDirectLicense][google.ads.datamanager.v1.UserListDirectLicense]
// resource.
message UpdateUserListDirectLicenseRequest {
  // Required. The licenses' `name` field is used to identify the license to
  // update.
  UserListDirectLicense user_list_direct_license = 1
      [(google.api.field_behavior) = REQUIRED];

  // Optional. The list of fields to update. The special character `*` is not
  // supported and an `INVALID_UPDATE_MASK` error will be thrown if used.
  google.protobuf.FieldMask update_mask = 2
      [(google.api.field_behavior) = OPTIONAL];
}

// Request to list all
// [UserListDirectLicense][google.ads.datamanager.v1.UserListDirectLicense]
// resources for a given account.
message ListUserListDirectLicensesRequest {
  // Required. The account whose licenses are being queried. Should be in the
  // format accountTypes/{ACCOUNT_TYPE}/accounts/{ACCOUNT_ID}
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "datamanager.googleapis.com/UserListDirectLicense"
    }
  ];

  // Optional. A [filter string](https://google.aip.dev/160) to apply to the
  // list request. All fields need to be on the left hand side of each condition
  // (for example: `user_list_id = 123`). Fields must be specified using either
  // all [camel case](https://en.wikipedia.org/wiki/Camel_case) or all [snake
  // case](https://en.wikipedia.org/wiki/Snake_case). Don't use a combination of
  // camel case and snake case.
  //
  // **Supported Operations:**
  //
  // - `AND`
  // - `=`
  // - `!=`
  // - `>`
  // - `>=`
  // - `<`
  // - `<=`
  //
  // **Unsupported Fields:**
  //
  // - `name` (use get method instead)
  // - `historical_pricings` and all its subfields
  // - `pricing.start_time`
  // - `pricing.end_time`
  string filter = 2 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The maximum number of licenses to return per page. The service
  // may return fewer than this value. If unspecified, at most 50 licenses will
  // be returned. The maximum value is 1000; values above 1000 will be coerced
  // to 1000.
  int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL];

  // Optional. A page token, received from a previous
  // `ListUserListDirectLicense` call. Provide this to retrieve the subsequent
  // page.
  //
  // When paginating, all other parameters provided to
  // `ListUserListDirectLicense` must match the call that provided the page
  // token.
  string page_token = 4 [(google.api.field_behavior) = OPTIONAL];
}

// Response from the
// [ListUserListDirectLicensesRequest][google.ads.datamanager.v1.ListUserListDirectLicensesRequest].
message ListUserListDirectLicensesResponse {
  // The licenses for the given user list in the request.
  repeated UserListDirectLicense user_list_direct_licenses = 1;

  // A token, which can be sent as `page_token` to retrieve the next page.
  // If this field is omitted, there are no subsequent pages.
  string next_page_token = 2;
}
