// Copyright 2019 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.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][google.streetview.publish.v1.Photo].
message PhotoId {
  // Required. A unique identifier for a photo.
  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][google.streetview.publish.v1.Photo], if the
  // latitude and longitude pair are not provided, the geolocation from the
  // exif header is used. A latitude and longitude pair not provided in the
  // photo or exif header causes the create photo process to fail.
  google.type.LatLng lat_lng_pair = 1;

  // Altitude of the pose in meters above WGS84 ellipsoid.
  // NaN indicates an unmeasured quantity.
  double altitude = 2;

  // 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;

  // The estimated horizontal accuracy of this pose in meters with 68%
  // confidence (one standard deviation). For example, on Android, this value is
  // available from this method:
  // https://developer.android.com/reference/android/location/Location#getAccuracy().
  // Other platforms have different methods of obtaining similar accuracy
  // estimations.
  float accuracy_meters = 9;
}

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

  // Output-only. The name of the place, localized to the language_code.
  string name = 2;

  // Output-only. The language_code that the name is localized with. This should
  // be the language_code specified in the request, but may be a fallback.
  string language_code = 3;
}

// 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 {
  // Required when updating a photo. Output only when creating a photo.
  // Identifier for the photo, which is unique among all photos in
  // Google.
  PhotoId photo_id = 1;

  // Required when creating a 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
  // [GetPhotoRequest.view][google.streetview.publish.v1.GetPhotoRequest.view]
  // is set to
  // [PhotoView.INCLUDE_DOWNLOAD_URL][google.streetview.publish.v1.PhotoView.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;

  // Status of rights transfer.
  enum TransferStatus {
    // The status of this transfer is unspecified.
    TRANSFER_STATUS_UNKNOWN = 0;

    // This photo has never been in a transfer.
    NEVER_TRANSFERRED = 1;

    // This photo transfer has been initiated, but the receiver has not yet
    // responded.
    PENDING = 2;

    // The photo transfer has been completed, and this photo has been
    // transferred to the recipient.
    COMPLETED = 3;

    // The recipient rejected this photo transfer.
    REJECTED = 4;

    // The photo transfer expired before the recipient took any action.
    EXPIRED = 5;

    // The sender cancelled this photo transfer.
    CANCELLED = 6;

    // The recipient owns this photo due to a rights transfer.
    RECEIVED_VIA_TRANSFER = 7;
  }

  // Output only. Status of rights transfer on this photo.
  TransferStatus transfer_status = 12;

  // Publication status of the photo in Google Maps.
  enum MapsPublishStatus {
    // The status of the photo is unknown.
    UNSPECIFIED_MAPS_PUBLISH_STATUS = 0;

    // The photo is published to the public through Google Maps.
    PUBLISHED = 1;

    // The photo has been rejected for an unknown reason.
    REJECTED_UNKNOWN = 2;
  }

  // Output only. Status in Google Maps, whether this photo was published or
  // rejected.
  MapsPublishStatus maps_publish_status = 13;
}
