// Path: app/src/main/java/com/hitherejoe/pickr/data/model/PointOfInterest.java
// public class PointOfInterest implements Parcelable, Comparable<PointOfInterest> {
// 
//     public String id;
//     public String name;
//     public String address;
//     public LatLng latLng;
//     public String phoneNumber;
//     public LatLngBounds latLngBounds;
// 
//     public static PointOfInterest fromPlace(Place place) {
//         PointOfInterest pointOfInterest = new PointOfInterest();
//         pointOfInterest.id = place.getId();
//         pointOfInterest.name = place.getName().toString();
//         pointOfInterest.address = place.getAddress().toString();
//         pointOfInterest.latLng = place.getLatLng();
//         pointOfInterest.phoneNumber = place.getPhoneNumber().toString();
//         pointOfInterest.latLngBounds = place.getViewport();
//         return pointOfInterest;
//     }
// 
//     @Override
//     public int describeContents() {
//         return 0;
//     }
// 
//     @Override
//     public void writeToParcel(Parcel dest, int flags) {
//         dest.writeString(this.id);
//         dest.writeString(this.name);
//         dest.writeString(this.address);
//         dest.writeParcelable(this.latLng, 0);
//         dest.writeString(this.phoneNumber);
//         dest.writeParcelable(this.latLngBounds, 0);
//     }
// 
//     public PointOfInterest() { }
// 
//     protected PointOfInterest(Parcel in) {
//         this.id = in.readString();
//         this.name = in.readString();
//         this.address = in.readString();
//         this.latLng = in.readParcelable(LatLng.class.getClassLoader());
//         this.phoneNumber = in.readString();
//         this.latLngBounds = in.readParcelable(LatLngBounds.class.getClassLoader());
//     }
// 
//     public static final Parcelable.Creator<PointOfInterest> CREATOR = new Parcelable.Creator<PointOfInterest>() {
//         public PointOfInterest createFromParcel(Parcel source) {
//             return new PointOfInterest(source);
//         }
// 
//         public PointOfInterest[] newArray(int size) {
//             return new PointOfInterest[size];
//         }
//     };
// 
//     @Override
//     public int compareTo(PointOfInterest pointOfInterest) {
//         return name.compareToIgnoreCase(pointOfInterest.name);
//     }
// 
//     @Override
//     public boolean equals(Object o) {
//         if (this == o) return true;
//         if (o == null || getClass() != o.getClass()) return false;
// 
//         PointOfInterest that = (PointOfInterest) o;
// 
//         if (id != null ? !id.equals(that.id) : that.id != null) return false;
//         if (name != null ? !name.equals(that.name) : that.name != null) return false;
//         if (address != null ? !address.equals(that.address) : that.address != null) return false;
//         if (latLng != null ? !latLng.equals(that.latLng) : that.latLng != null) return false;
//         if (phoneNumber != null ? !phoneNumber.equals(that.phoneNumber) : that.phoneNumber != null)
//             return false;
//         return !(latLngBounds != null ? !latLngBounds.equals(that.latLngBounds) : that.latLngBounds != null);
// 
//     }
// 
//     @Override
//     public int hashCode() {
//         int result = id != null ? id.hashCode() : 0;
//         result = 31 * result + (name != null ? name.hashCode() : 0);
//         result = 31 * result + (address != null ? address.hashCode() : 0);
//         result = 31 * result + (latLng != null ? latLng.hashCode() : 0);
//         result = 31 * result + (phoneNumber != null ? phoneNumber.hashCode() : 0);
//         result = 31 * result + (latLngBounds != null ? latLngBounds.hashCode() : 0);
//         return result;
//     }
// }
// 
// Path: app/src/main/java/com/hitherejoe/pickr/util/DataUtils.java
// public class DataUtils {
// 
//     //TODO: Implement network checks
//     public static boolean isNetworkAvailable(Context context) {
//         ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
//         return connectivityManager.getActiveNetworkInfo() != null;
//     }
// 
//     public static Gson getGsonInstance() {
//         return new GsonBuilder()
//                 .setDateFormat("yyyy-MM-dd'T'HH:mm:ss:SSSz")
//                 .create();
//     }
// 
//     public static LatLngBounds latitudeLongitudeToBounds(LatLng center, double radius) {
//         LatLng southwest = SphericalUtil.computeOffset(center, radius * Math.sqrt(2.0), 225);
//         LatLng northeast = SphericalUtil.computeOffset(center, radius * Math.sqrt(2.0), 45);
//         return new LatLngBounds(southwest, northeast);
//     }
// 
// }


import android.content.ContentValues;
import android.database.Cursor;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.LatLngBounds;
import com.google.gson.Gson;
import com.hitherejoe.pickr.data.model.PointOfInterest;
import com.hitherejoe.pickr.util.DataUtils;
package com.hitherejoe.pickr.data.local;



public class Db {

    public Db() { }

    public static abstract class PointOfInterestTable {
        public static final String TABLE_NAME = "point_of_interests";
        public static final String COLUMN_ID = "id";
        public static final String COLUMN_NAME = "name";
        public static final String COLUMN_ADDRESS = "address";
        public static final String COLUMN_LAT_LNG = "lat_lng";
        public static final String COLUMN_PHONE = "phone";
        public static final String COLUMN_LAT_LNG_BOUNDS = "lat_lng_bounds";

        public static final String CREATE =
                "CREATE TABLE " + TABLE_NAME + " (" +
                        COLUMN_ID + " TEXT PRIMARY KEY NOT NULL," +
                        COLUMN_NAME + " TEXT NOT NULL," +
                        COLUMN_ADDRESS + " TEXT NOT NULL," +
                        COLUMN_LAT_LNG + " TEXT NOT NULL," +
                        COLUMN_PHONE + " TEXT NOT NULL," +
                        COLUMN_LAT_LNG_BOUNDS + " TEXT NOT NULL" +
                        " ); ";

        public static ContentValues toContentValues(PointOfInterest pointOfInterest) {
// Path: app/src/main/java/com/hitherejoe/pickr/data/model/PointOfInterest.java
// public class PointOfInterest implements Parcelable, Comparable<PointOfInterest> {
// 
//     public String id;
//     public String name;
//     public String address;
//     public LatLng latLng;
//     public String phoneNumber;
//     public LatLngBounds latLngBounds;
// 
//     public static PointOfInterest fromPlace(Place place) {
//         PointOfInterest pointOfInterest = new PointOfInterest();
//         pointOfInterest.id = place.getId();
//         pointOfInterest.name = place.getName().toString();
//         pointOfInterest.address = place.getAddress().toString();
//         pointOfInterest.latLng = place.getLatLng();
//         pointOfInterest.phoneNumber = place.getPhoneNumber().toString();
//         pointOfInterest.latLngBounds = place.getViewport();
//         return pointOfInterest;
//     }
// 
//     @Override
//     public int describeContents() {
//         return 0;
//     }
// 
//     @Override
//     public void writeToParcel(Parcel dest, int flags) {
//         dest.writeString(this.id);
//         dest.writeString(this.name);
//         dest.writeString(this.address);
//         dest.writeParcelable(this.latLng, 0);
//         dest.writeString(this.phoneNumber);
//         dest.writeParcelable(this.latLngBounds, 0);
//     }
// 
//     public PointOfInterest() { }
// 
//     protected PointOfInterest(Parcel in) {
//         this.id = in.readString();
//         this.name = in.readString();
//         this.address = in.readString();
//         this.latLng = in.readParcelable(LatLng.class.getClassLoader());
//         this.phoneNumber = in.readString();
//         this.latLngBounds = in.readParcelable(LatLngBounds.class.getClassLoader());
//     }
// 
//     public static final Parcelable.Creator<PointOfInterest> CREATOR = new Parcelable.Creator<PointOfInterest>() {
//         public PointOfInterest createFromParcel(Parcel source) {
//             return new PointOfInterest(source);
//         }
// 
//         public PointOfInterest[] newArray(int size) {
//             return new PointOfInterest[size];
//         }
//     };
// 
//     @Override
//     public int compareTo(PointOfInterest pointOfInterest) {
//         return name.compareToIgnoreCase(pointOfInterest.name);
//     }
// 
//     @Override
//     public boolean equals(Object o) {
//         if (this == o) return true;
//         if (o == null || getClass() != o.getClass()) return false;
// 
//         PointOfInterest that = (PointOfInterest) o;
// 
//         if (id != null ? !id.equals(that.id) : that.id != null) return false;
//         if (name != null ? !name.equals(that.name) : that.name != null) return false;
//         if (address != null ? !address.equals(that.address) : that.address != null) return false;
//         if (latLng != null ? !latLng.equals(that.latLng) : that.latLng != null) return false;
//         if (phoneNumber != null ? !phoneNumber.equals(that.phoneNumber) : that.phoneNumber != null)
//             return false;
//         return !(latLngBounds != null ? !latLngBounds.equals(that.latLngBounds) : that.latLngBounds != null);
// 
//     }
// 
//     @Override
//     public int hashCode() {
//         int result = id != null ? id.hashCode() : 0;
//         result = 31 * result + (name != null ? name.hashCode() : 0);
//         result = 31 * result + (address != null ? address.hashCode() : 0);
//         result = 31 * result + (latLng != null ? latLng.hashCode() : 0);
//         result = 31 * result + (phoneNumber != null ? phoneNumber.hashCode() : 0);
//         result = 31 * result + (latLngBounds != null ? latLngBounds.hashCode() : 0);
//         return result;
//     }
// }
// 
// Path: app/src/main/java/com/hitherejoe/pickr/util/DataUtils.java
// public class DataUtils {
// 
//     //TODO: Implement network checks
//     public static boolean isNetworkAvailable(Context context) {
//         ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
//         return connectivityManager.getActiveNetworkInfo() != null;
//     }
// 
//     public static Gson getGsonInstance() {
//         return new GsonBuilder()
//                 .setDateFormat("yyyy-MM-dd'T'HH:mm:ss:SSSz")
//                 .create();
//     }
// 
//     public static LatLngBounds latitudeLongitudeToBounds(LatLng center, double radius) {
//         LatLng southwest = SphericalUtil.computeOffset(center, radius * Math.sqrt(2.0), 225);
//         LatLng northeast = SphericalUtil.computeOffset(center, radius * Math.sqrt(2.0), 45);
//         return new LatLngBounds(southwest, northeast);
//     }
// 
// }


// Path: app/src/main/java/com/hitherejoe/pickr/data/local/Db.java
import android.content.ContentValues;
import android.database.Cursor;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.LatLngBounds;
import com.google.gson.Gson;
import com.hitherejoe.pickr.data.model.PointOfInterest;
import com.hitherejoe.pickr.util.DataUtils;

package com.hitherejoe.pickr.data.local;



public class Db {

    public Db() { }

    public static abstract class PointOfInterestTable {
        public static final String TABLE_NAME = "point_of_interests";
        public static final String COLUMN_ID = "id";
        public static final String COLUMN_NAME = "name";
        public static final String COLUMN_ADDRESS = "address";
        public static final String COLUMN_LAT_LNG = "lat_lng";
        public static final String COLUMN_PHONE = "phone";
        public static final String COLUMN_LAT_LNG_BOUNDS = "lat_lng_bounds";

        public static final String CREATE =
                "CREATE TABLE " + TABLE_NAME + " (" +
                        COLUMN_ID + " TEXT PRIMARY KEY NOT NULL," +
                        COLUMN_NAME + " TEXT NOT NULL," +
                        COLUMN_ADDRESS + " TEXT NOT NULL," +
                        COLUMN_LAT_LNG + " TEXT NOT NULL," +
                        COLUMN_PHONE + " TEXT NOT NULL," +
                        COLUMN_LAT_LNG_BOUNDS + " TEXT NOT NULL" +
                        " ); ";

        public static ContentValues toContentValues(PointOfInterest pointOfInterest) {
            Gson gson = DataUtils.getGsonInstance();