// Copyright 2020 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.cloud.gaming.v1;

import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/cloud/gaming/v1/common.proto";
import "google/protobuf/field_mask.proto";
import "google/protobuf/timestamp.proto";
import "google/api/annotations.proto";

option go_package = "google.golang.org/genproto/googleapis/cloud/gaming/v1;gaming";
option java_multiple_files = true;
option java_package = "com.google.cloud.gaming.v1";

// Request message for RealmsService.ListRealms.
message ListRealmsRequest {
  // Required. The parent resource name. Uses the form:
  // `projects/{project}/locations/{location}`.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "gameservices.googleapis.com/Realm"
    }
  ];

  // Optional. The maximum number of items to return.  If unspecified, server
  // will pick an appropriate default. Server may return fewer items than
  // requested. A caller should only rely on response's
  // [next_page_token][google.cloud.gaming.v1.ListRealmsResponse.next_page_token] to
  // determine if there are more realms left to be queried.
  int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The next_page_token value returned from a previous List request,
  // if any.
  string page_token = 3 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The filter to apply to list results.
  string filter = 4 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Specifies the ordering of results following syntax at
  // https://cloud.google.com/apis/design/design_patterns#sorting_order.
  string order_by = 5 [(google.api.field_behavior) = OPTIONAL];
}

// Response message for RealmsService.ListRealms.
message ListRealmsResponse {
  // The list of realms.
  repeated Realm realms = 1;

  // Token to retrieve the next page of results, or empty if there are no more
  // results in the list.
  string next_page_token = 2;

  // List of locations that could not be reached.
  repeated string unreachable = 3;
}

// Request message for RealmsService.GetRealm.
message GetRealmRequest {
  // Required. The name of the realm to retrieve. Uses the form:
  // `projects/{project}/locations/{location}/realms/{realm}`.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "gameservices.googleapis.com/Realm"
    }
  ];
}

// Request message for RealmsService.CreateRealm.
message CreateRealmRequest {
  // Required. The parent resource name. Uses the form:
  // `projects/{project}/locations/{location}`.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      child_type: "gameservices.googleapis.com/Realm"
    }
  ];

  // Required. The ID of the realm resource to be created.
  string realm_id = 2 [(google.api.field_behavior) = REQUIRED];

  // Required. The realm resource to be created.
  Realm realm = 3 [(google.api.field_behavior) = REQUIRED];
}

// Request message for RealmsService.DeleteRealm.
message DeleteRealmRequest {
  // Required. The name of the realm to delete. Uses the form:
  // `projects/{project}/locations/{location}/realms/{realm}`.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "gameservices.googleapis.com/Realm"
    }
  ];
}

// Request message for RealmsService.UpdateRealm.
message UpdateRealmRequest {
  // Required. The realm to be updated.
  // Only fields specified in update_mask are updated.
  Realm realm = 1 [(google.api.field_behavior) = REQUIRED];

  // Required. The update mask applies to the resource. For the `FieldMask`
  // definition, see
  //
  // https:
  // //developers.google.com/protocol-buffers
  // // /docs/reference/google.protobuf#fieldmask
  google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED];
}

// Request message for RealmsService.PreviewRealmUpdate.
message PreviewRealmUpdateRequest {
  // Required. The realm to be updated.
  // Only fields specified in update_mask are updated.
  Realm realm = 1 [(google.api.field_behavior) = REQUIRED];

  // Required. The update mask applies to the resource. For the `FieldMask`
  // definition, see
  //
  // https:
  // //developers.google.com/protocol-buffers
  // // /docs/reference/google.protobuf#fieldmask
  google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED];

  // Optional. The target timestamp to compute the preview.
  google.protobuf.Timestamp preview_time = 3 [(google.api.field_behavior) = OPTIONAL];
}

// Response message for RealmsService.PreviewRealmUpdate.
message PreviewRealmUpdateResponse {
  // ETag of the realm.
  string etag = 2;

  // The target state.
  TargetState target_state = 3;
}

// A realm resource.
message Realm {
  option (google.api.resource) = {
    type: "gameservices.googleapis.com/Realm"
    pattern: "projects/{project}/locations/{location}/realms/{realm}"
  };

  // The resource name of the realm. Uses the form:
  // `projects/{project}/locations/{location}/realms/{realm}`. For
  // example, `projects/my-project/locations/{location}/realms/my-realm`.
  string name = 1;

  // Output only. The creation time.
  google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The last-modified time.
  google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY];

  // The labels associated with this realm. Each label is a key-value pair.
  map<string, string> labels = 4;

  // Required. Time zone where all policies targeting this realm are evaluated. The value
  // of this field must be from the IANA time zone database:
  // https://www.iana.org/time-zones.
  string time_zone = 6 [(google.api.field_behavior) = REQUIRED];

  // ETag of the resource.
  string etag = 7;

  // Human readable description of the realm.
  string description = 8;
}
