// Copyright 2020-2026 Buf Technologies, Inc.
//
// 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 buf.alpha.registry.v1alpha1;

import "buf/alpha/registry/v1alpha1/organization.proto";
import "buf/alpha/registry/v1alpha1/user.proto";

message Owner {
  oneof owner {
    // The requested owner is a `User`.
    User user = 1;
    // The requested owner is a `Organization`.
    Organization organization = 2;
  }
}

// OwnerService is a service that provides RPCs that allow the BSR to query
// for owner information.
service OwnerService {
  // GetOwnerByName takes an owner name and returns the owner as
  // either a user or organization.
  rpc GetOwnerByName(GetOwnerByNameRequest) returns (GetOwnerByNameResponse) {
    option idempotency_level = NO_SIDE_EFFECTS;
  }
}

message GetOwnerByNameRequest {
  // Name of the requested owner.
  string name = 1;
}

message GetOwnerByNameResponse {
  Owner owner = 1;
}
