/*
 * 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
 *
 *     https://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.
 */

package com.google.android.gnd.persistence.local.room;

import androidx.annotation.NonNull;
import com.google.android.gnd.vo.Point;

/**
 * Defines how Room persists coordinates in the local db. By default, Room uses the name of object
 * fields and their respective types to determine database column names and types.
 */
public class Coordinates {

  @NonNull public double latitude;

  @NonNull public double longitude;

  /** Returns a new instance equivalent to the provided {@link Point}. */
  @NonNull
  public static Coordinates fromPoint(Point point) {
    Coordinates c = new Coordinates();
    c.latitude = point.getLatitude();
    c.longitude = point.getLongitude();
    return c;
  }
}

@@ -692,39 +692,168 @@
 ort 
-com.google.android.gnd.vo.Point
+androidx.room.ColumnInfo;%0Aimport com.google.android.gnd.vo.Point;%0Aimport com.google.auto.value.AutoValue;%0Aimport com.google.auto.value.AutoValue.CopyAnnotations
 ;%0A%0A/
@@ -1045,61 +1045,143 @@
  */%0A
-public class Coordinates %7B%0A%0A  @NonNull public
+@AutoValue%0Apublic abstract class Coordinates %7B%0A  @CopyAnnotations%0A  @NonNull%0A  @ColumnInfo(name = %22latitude%22)%0A  public abstract
  double 
 lati
@@ -1180,54 +1180,639 @@
 ble 
-l
+getL
 atitude
+()
 ;%0A%0A  @
-NonNull public double longitude;
+CopyAnnotations%0A  @NonNull%0A  @ColumnInfo(name = %22longitude%22)%0A  public abstract double getLongitude();%0A%0A  // Auto-generated boilerplate:%0A%0A  public static Coordinates create(double latitude, double longitude) %7B%0A    return builder().setLatitude(latitude).setLongitude(longitude).build();%0A  %7D%0A%0A  public static Builder builder() %7B%0A    return new AutoValue_Coordinates.Builder();%0A  %7D%0A%0A  @AutoValue.Builder%0A  public abstract static class Builder %7B%0A%0A    public abstract Builder setLatitude(double newLatitude);%0A%0A    public abstract Builder setLongitude(double newLongitude);%0A%0A    public abstract Coordinates build();%0A  %7D
 %0A%0A  
@@ -1955,60 +1955,58 @@
     
-Coordinates c = new Coordinates();%0A    c.l
+return Coordinates.builder()%0A        .setL
 atitude
- = 
+(
 poin
@@ -2024,25 +2024,31 @@
 de()
-;
+)
 %0A    
-c.l
+    .setL
 ongitude
  = p
@@ -2043,19 +2043,17 @@
 ongitude
- = 
+(
 point.ge
@@ -2068,22 +2068,26 @@
 de()
-;
+)
 %0A    
-return c
+    .build()
 ;%0A  

Revert Coordinate class back to AutoValue