// Copyright 2017 Google 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 google.streetview.publish.v1;

import "google/api/annotations.proto";
import "google/protobuf/timestamp.proto";
import "google/type/latlng.proto";

option go_package = "google.golang.org/genproto/googleapis/streetview/publish/v1;publish";
option java_outer_classname = "StreetViewPublishResources";
option java_package = "com.google.geo.ugc.streetview.publish.v1";


// Upload reference for media files.
message UploadRef {
  // Required. An upload reference should be unique for each user. It follows
  // the form:
  // "https://streetviewpublish.googleapis.com/media/user/<account_id>/photo/<upload_reference>"
  string upload_url = 1;
}

// Identifier for a photo.
message PhotoId {
  // Required. A base64 encoded identifier.
  string id = 1;
}

// Level information containing level number and its corresponding name.
message Level {
  // Floor number, used for ordering. 0 indicates the ground level, 1 indicates
  // the first level above ground level, -1 indicates the first level under
  // ground level. Non-integer values are OK.
  double number = 1;

  // Required. A name assigned to this Level, restricted to 3 characters.
  // Consider how the elevator buttons would be labeled for this level if there
  // was an elevator.
  string name = 2;
}

// Raw pose measurement for an entity.
message Pose {
  // Latitude and longitude pair of the pose, as explained here:
  // https://cloud.google.com/datastore/docs/reference/rest/Shared.Types/LatLng
  // When creating a photo, if the latitude and longitude pair are not provided
  // here, the geolocation from the exif header will be used.
  // If the latitude and longitude pair is not provided and cannot be found in
  // the exif header, the create photo process will fail.
  google.type.LatLng lat_lng_pair = 1;

  // Altitude of the pose in meters above ground level (as defined by WGS84).
  // NaN indicates an unmeasured quantity.
  double altitude = 2;

  // The following pose parameters pertain to the center of the photo. They
  // match https://developers.google.com/streetview/spherical-metadata.

  // Compass heading, measured at the center of the photo in degrees clockwise
  // from North. Value must be >=0 and <360.
  // NaN indicates an unmeasured quantity.
  double heading = 3;

  // Pitch, measured at the center of the photo in degrees. Value must be >=-90
  // and <= 90. A value of -90 means looking directly down, and a value of 90
  // means looking directly up.
  // NaN indicates an unmeasured quantity.
  double pitch = 4;

  // Roll, measured in degrees. Value must be >= 0 and <360. A value of 0
  // means level with the horizon.
  // NaN indicates an unmeasured quantity.
  double roll = 5;

  // Level (the floor in a building) used to configure vertical navigation.
  Level level = 7;
}

// Place metadata for an entity.
message Place {
  // Required. Place identifier, as described in
  // https://developers.google.com/places/place-id.
  string place_id = 1;
}

// A connection is the link from a source photo to a destination photo.
message Connection {
  // Required. The destination of the connection from the containing photo to
  // another photo.
  PhotoId target = 1;
}

// Photo is used to store 360 photos along with photo metadata.
message Photo {
  // Output only. Identifier for the photo, which is unique among all photos in
  // Google.
  PhotoId photo_id = 1;

  // Required (when creating photo). Input only. The resource URL where the
  // photo bytes are uploaded to.
  UploadRef upload_reference = 2;

  // Output only. The download URL for the photo bytes. This field is set only
  // when the `view` parameter in a `GetPhotoRequest` is set to
  // `INCLUDE_DOWNLOAD_URL`.
  string download_url = 3;

  // Output only. The thumbnail URL for showing a preview of the given photo.
  string thumbnail_url = 9;

  // Output only. The share link for the photo.
  string share_link = 11;

  // Pose of the photo.
  Pose pose = 4;

  // Connections to other photos. A connection represents the link from this
  // photo to another photo.
  repeated Connection connections = 5;

  // Absolute time when the photo was captured.
  // When the photo has no exif timestamp, this is used to set a timestamp in
  // the photo metadata.
  google.protobuf.Timestamp capture_time = 6;

  // Places where this photo belongs.
  repeated Place places = 7;

  // Output only. View count of the photo.
  int64 view_count = 10;
}
