// 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.maps.mapsplatformdatasets.v1alpha;

import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/maps/mapsplatformdatasets/v1alpha/dataset.proto";
import "google/protobuf/field_mask.proto";

option csharp_namespace = "Google.Maps.MapsPlatformDatasets.V1Alpha";
option go_package = "cloud.google.com/go/maps/mapsplatformdatasets/apiv1alpha/mapsplatformdatasetspb;mapsplatformdatasetspb";
option java_multiple_files = true;
option java_outer_classname = "MapsPlatformDatasetsProto";
option java_package = "com.google.maps.mapsplatformdatasets.v1alpha";
option php_namespace = "Google\\Maps\\MapsPlatformDatasets\\V1alpha";

// Request to create a maps dataset.
message CreateDatasetRequest {
  // Required. Parent project that will own the dataset.
  // Format: projects/{$project_number}
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "cloudresourcemanager.googleapis.com/Project"
    }
  ];

  // Required. The dataset version to create.
  Dataset dataset = 2 [(google.api.field_behavior) = REQUIRED];
}

// Request to update the metadata fields of the dataset.
message UpdateDatasetMetadataRequest {
  // Required. The dataset to update. The dataset's name is used to identify the dataset
  // to be updated. The name has the format:
  // projects/{project}/datasets/{dataset_id}
  Dataset dataset = 1 [(google.api.field_behavior) = REQUIRED];

  // The list of fields to be updated. Support the value "*" for full
  // replacement.
  google.protobuf.FieldMask update_mask = 2;
}

// Request to get the specified dataset.
message GetDatasetRequest {
  // Required. Resource name. Can also fetch a specified version
  // projects/{project}/datasets/{dataset_id}
  // projects/{project}/datasets/{dataset_id}@{version-id}
  //
  // In order to retrieve a previous version of the dataset, also provide
  // the version ID.
  // Example: projects/123/datasets/assisted-driving-preferences@c7cfa2a8
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "mapsplatformdatasets.googleapis.com/Dataset"
    }
  ];

  // If specified, will fetch the dataset details of the version published for
  // the specified use case rather than the latest, if one exists. If a
  // published version does not exist, will default to getting the dataset
  // details of the latest version.
  Usage published_usage = 2;
}

// Request to list of all versions of the dataset.
message ListDatasetVersionsRequest {
  // Required. The name of the dataset to list all the versions for.
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "mapsplatformdatasets.googleapis.com/Dataset"
    }
  ];

  // The maximum number of versions to return per page.
  // If unspecified (or zero), at most 1000 versions will be returned.
  // The maximum value is 1000; values above 1000 will be coerced to 1000.
  int32 page_size = 2;

  // The page token, received from a previous GetDatasetVersions call.
  // Provide this to retrieve the subsequent page.
  string page_token = 3;
}

// Response with list of all versions of the dataset.
message ListDatasetVersionsResponse {
  // All the versions of the dataset.
  repeated Dataset datasets = 1;

  // A token that can be sent as `page_token` to retrieve the next page.
  // If this field is omitted, there are no subsequent pages.
  string next_page_token = 2;
}

// Request to list datasets for the project.
message ListDatasetsRequest {
  // Required. The name of the project to list all the datasets for.
  string parent = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "cloudresourcemanager.googleapis.com/Project"
    }
  ];

  // The maximum number of versions to return per page.
  // If unspecified (or zero), at most 1000 datasets will be returned.
  // The maximum value is 1000; values above 1000 will be coerced to 1000.
  int32 page_size = 2;

  // The page token, received from a previous GetDatasetVersions call.
  // Provide this to retrieve the subsequent page.
  string page_token = 3;
}

// Response to list datasets for the project.
message ListDatasetsResponse {
  // All the datasets for the project.
  repeated Dataset datasets = 1;

  // A token that can be sent as `page_token` to retrieve the next page.
  // If this field is omitted, there are no subsequent pages.
  string next_page_token = 2;
}

// Request to delete a dataset.
//
// The dataset to be deleted.
message DeleteDatasetRequest {
  // Required. Format: projects/${project}/datasets/{dataset_id}
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "mapsplatformdatasets.googleapis.com/Dataset"
    }
  ];

  // If set to true, any dataset version for this dataset will also be deleted.
  // (Otherwise, the request will only work if the dataset has no versions.)
  bool force = 2;
}

// Request to delete a version of a dataset.
message DeleteDatasetVersionRequest {
  // Required. Format: projects/${project}/datasets/{dataset_id}@{version-id}
  string name = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = {
      type: "mapsplatformdatasets.googleapis.com/Dataset"
    }
  ];
}
