// Copyright 2022 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.apps.drive.labels.v2;

import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/apps/drive/labels/v2/label.proto";
import "google/apps/drive/labels/v2/label_permission.proto";

option go_package = "google.golang.org/genproto/googleapis/apps/drive/labels/v2;labels";
option java_multiple_files = true;
option java_outer_classname = "RequestsProto";
option java_package = "com.google.apps.drive.labels.v2";
option objc_class_prefix = "DLBL";

// Resource view that can be applied to label responses. The default value
// `LABEL_VIEW_BASIC` implies the field mask:
 // `name,id,revision_id,label_type,properties.*`\
enum LabelView {
// Implies the field mask:
// `name,id,revision_id,label_type,properties.*`
LABEL_VIEW_BASIC = 0;

// All possible fields.
LABEL_VIEW_FULL = 1;
}

// Request to get a label by resource name.
message GetLabelRequest {
  // Required. Label resource name.
  //
  // May be any of:
  //
  // * `labels/{id}` (equivalent to labels/{id}@latest)
  // * `labels/{id}@latest`
  // * `labels/{id}@published`
  // * `labels/{id}@{revision_id}`
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "drivelabels.googleapis.com/Label"
    }
  ];

  // Set to `true` in order to use the user's admin credentials. The server
  // verifies that the user is an admin for the label before allowing access.
  bool use_admin_access = 2;

  // The BCP-47 language code to use for evaluating localized field labels.
  // When not specified, values in the default configured language are used.
  string language_code = 3;

  // When specified, only certain fields belonging to the indicated view are
  // returned.
  LabelView view = 4;
}

// Request to list labels available to the current user.
message ListLabelsRequest {
  oneof access {
    // Set to `true` in order to use the user's admin credentials. This will
    // return all Labels within the customer.
    bool use_admin_access = 3;

    // Specifies the level of access the user must have on the returned Labels.
    // The minimum role a user must have on a label.
    // Defaults to `READER`.
    LabelPermission.LabelRole minimum_role = 4;
  }

  // Whether to include only published labels in the results.
  //
  // * When `true`, only the current published label revisions are returned.
  //   Disabled labels are included. Returned label resource names
  //   reference the published revision (`labels/{id}/{revision_id}`).
  // * When `false`, the current label revisions are returned, which might not
  //   be published. Returned label resource names don't reference a specific
  //   revision (`labels/{id}`).
  bool published_only = 1;

  // The BCP-47 language code to use for evaluating localized field labels.
  // When not specified, values in the default configured language are used.
  string language_code = 5;

  // Maximum number of labels to return per page. Default: 50. Max: 200.
  int32 page_size = 6;

  // The token of the page to return.
  string page_token = 7;

  // When specified, only certain fields belonging to the indicated view are
  // returned.
  LabelView view = 8;
}

// Response for listing Labels.
message ListLabelsResponse {
  // Labels.
  repeated Label labels = 1;

  // The token of the next page in the response.
  string next_page_token = 2;
}
