// Copyright 2021 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.

// @generated by protoc-gen-es v1.10.0 with parameter "target=ts"
// @generated from file visibility.proto (package google.api, syntax proto3)
/* eslint-disable */
// @ts-nocheck

import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";
import { Message, proto3 } from "@bufbuild/protobuf";
import { EnumOptions, EnumValueOptions, FieldOptions, MessageOptions, MethodOptions, ServiceOptions } from "./google/protobuf/descriptor_pb.js";

/**
 * `Visibility` defines restrictions for the visibility of service
 * elements.  Restrictions are specified using visibility labels
 * (e.g., PREVIEW) that are elsewhere linked to users and projects.
 *
 * Users and projects can have access to more than one visibility label. The
 * effective visibility for multiple labels is the union of each label's
 * elements, plus any unrestricted elements.
 *
 * If an element and its parents have no restrictions, visibility is
 * unconditionally granted.
 *
 * Example:
 *
 *     visibility:
 *       rules:
 *       - selector: google.calendar.Calendar.EnhancedSearch
 *         restriction: PREVIEW
 *       - selector: google.calendar.Calendar.Delegate
 *         restriction: INTERNAL
 *
 * Here, all methods are publicly visible except for the restricted methods
 * EnhancedSearch and Delegate.
 *
 * @generated from message google.api.Visibility
 */
export class Visibility extends Message<Visibility> {
  /**
   * A list of visibility rules that apply to individual API elements.
   *
   * **NOTE:** All service configuration rules follow "last one wins" order.
   *
   * @generated from field: repeated google.api.VisibilityRule rules = 1;
   */
  rules: VisibilityRule[] = [];

  constructor(data?: PartialMessage<Visibility>) {
    super();
    proto3.util.initPartial(data, this);
  }

  static readonly runtime: typeof proto3 = proto3;
  static readonly typeName = "google.api.Visibility";
  static readonly fields: FieldList = proto3.util.newFieldList(() => [
    { no: 1, name: "rules", kind: "message", T: VisibilityRule, repeated: true },
  ]);

  static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Visibility {
    return new Visibility().fromBinary(bytes, options);
  }

  static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Visibility {
    return new Visibility().fromJson(jsonValue, options);
  }

  static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Visibility {
    return new Visibility().fromJsonString(jsonString, options);
  }

  static equals(a: Visibility | PlainMessage<Visibility> | undefined, b: Visibility | PlainMessage<Visibility> | undefined): boolean {
    return proto3.util.equals(Visibility, a, b);
  }
}

/**
 * A visibility rule provides visibility configuration for an individual API
 * element.
 *
 * @generated from message google.api.VisibilityRule
 */
export class VisibilityRule extends Message<VisibilityRule> {
  /**
   * Selects methods, messages, fields, enums, etc. to which this rule applies.
   *
   * Refer to [selector][google.api.DocumentationRule.selector] for syntax details.
   *
   * @generated from field: string selector = 1;
   */
  selector = "";

  /**
   * A comma-separated list of visibility labels that apply to the `selector`.
   * Any of the listed labels can be used to grant the visibility.
   *
   * If a rule has multiple labels, removing one of the labels but not all of
   * them can break clients.
   *
   * Example:
   *
   *     visibility:
   *       rules:
   *       - selector: google.calendar.Calendar.EnhancedSearch
   *         restriction: INTERNAL, PREVIEW
   *
   * Removing INTERNAL from this restriction will break clients that rely on
   * this method and only had access to it through INTERNAL.
   *
   * @generated from field: string restriction = 2;
   */
  restriction = "";

  constructor(data?: PartialMessage<VisibilityRule>) {
    super();
    proto3.util.initPartial(data, this);
  }

  static readonly runtime: typeof proto3 = proto3;
  static readonly typeName = "google.api.VisibilityRule";
  static readonly fields: FieldList = proto3.util.newFieldList(() => [
    { no: 1, name: "selector", kind: "scalar", T: 9 /* ScalarType.STRING */ },
    { no: 2, name: "restriction", kind: "scalar", T: 9 /* ScalarType.STRING */ },
  ]);

  static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): VisibilityRule {
    return new VisibilityRule().fromBinary(bytes, options);
  }

  static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): VisibilityRule {
    return new VisibilityRule().fromJson(jsonValue, options);
  }

  static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): VisibilityRule {
    return new VisibilityRule().fromJsonString(jsonString, options);
  }

  static equals(a: VisibilityRule | PlainMessage<VisibilityRule> | undefined, b: VisibilityRule | PlainMessage<VisibilityRule> | undefined): boolean {
    return proto3.util.equals(VisibilityRule, a, b);
  }
}

/**
 * See `VisibilityRule`.
 *
 * @generated from extension: google.api.VisibilityRule enum_visibility = 72295727;
 */
export const enum_visibility = proto3.makeExtension<EnumOptions, VisibilityRule>(
  "google.api.enum_visibility", 
  EnumOptions, 
  () => ({ no: 72295727, kind: "message", T: VisibilityRule }),
);

/**
 * See `VisibilityRule`.
 *
 * @generated from extension: google.api.VisibilityRule value_visibility = 72295727;
 */
export const value_visibility = proto3.makeExtension<EnumValueOptions, VisibilityRule>(
  "google.api.value_visibility", 
  EnumValueOptions, 
  () => ({ no: 72295727, kind: "message", T: VisibilityRule }),
);

/**
 * See `VisibilityRule`.
 *
 * @generated from extension: google.api.VisibilityRule field_visibility = 72295727;
 */
export const field_visibility = proto3.makeExtension<FieldOptions, VisibilityRule>(
  "google.api.field_visibility", 
  FieldOptions, 
  () => ({ no: 72295727, kind: "message", T: VisibilityRule }),
);

/**
 * See `VisibilityRule`.
 *
 * @generated from extension: google.api.VisibilityRule message_visibility = 72295727;
 */
export const message_visibility = proto3.makeExtension<MessageOptions, VisibilityRule>(
  "google.api.message_visibility", 
  MessageOptions, 
  () => ({ no: 72295727, kind: "message", T: VisibilityRule }),
);

/**
 * See `VisibilityRule`.
 *
 * @generated from extension: google.api.VisibilityRule method_visibility = 72295727;
 */
export const method_visibility = proto3.makeExtension<MethodOptions, VisibilityRule>(
  "google.api.method_visibility", 
  MethodOptions, 
  () => ({ no: 72295727, kind: "message", T: VisibilityRule }),
);

/**
 * See `VisibilityRule`.
 *
 * @generated from extension: google.api.VisibilityRule api_visibility = 72295727;
 */
export const api_visibility = proto3.makeExtension<ServiceOptions, VisibilityRule>(
  "google.api.api_visibility", 
  ServiceOptions, 
  () => ({ no: 72295727, kind: "message", T: VisibilityRule }),
);

