// Copyright (C) 2014 The Android Open Source Project
//
// 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.

package com.google.gerrit.server.config;

import com.google.errorprone.annotations.Immutable;
import com.google.gerrit.entities.Project;

/**
 * Special name of the project in which meta data for all users is stored.
 *
 * <p>This class is immutable and thread safe.
 */
@Immutable
public record AllUsersName(String name) implements Project.NameKey {
  private static final long serialVersionUID = 1L;

  @Override
  public int hashCode() {
    return projectNameHashCode();
  }

  @Override
  public boolean equals(Object b) {
    return projectNameEquals(b);
  }

  @Override
  public String toString() {
    return projectNameToString();
  }
}
