/*
 * Copyright (c) 2015 Prat Tanapaisankit
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *   * Redistributions of source code must retain the above copyright
 * notice, this list of conditions and the following disclaimer.
 *   * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 *   * Neither the name of The Intern nor the names of its contributors may
 * be used to endorse or promote products derived from this software
 * without specific prior written permission.
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE LISTED COPYRIGHT HOLDERS BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package com.pt2121.envi.model;

/**
 * Created by prt2121 on 9/27/14.
 */
public class Loc {

    public final String name;

    public final String address;

    public final double latitude;

    public final double longitude;

    //LocType
    public final int type;

    public String image;

    public Loc(String name, String address, double latitude, double longitude, int type) {
        this.name = name;
        this.address = address;
        this.latitude = latitude;
        this.longitude = longitude;
        this.type = type;
    }

    public static class Builder {

        private String name;

        private String address;

        private double latitude;

        private double longitude;

        private String image;

        private int type;

        public Builder(String name) {
            this.name = name;
        }

        public Builder address(String address) {
            this.address = address;
            return this;
        }

        public Builder latitude(double latitude) {
            this.latitude = latitude;
            return this;
        }

        public Builder longitude(double longitude) {
            this.longitude = longitude;
            return this;
        }

        public Builder image(String image) {
            this.image = image;
            return this;
        }

        /**
         * @param type LocType
         * @return the builder with this {@code LocType}
         * @see com.pt2121.envi.model.LocType
         */
        public Builder type(int type) {
            this.type = type;
            return this;
        }

        public Loc build() {
            Loc l = new Loc(this.name,
                    this.address,
                    this.latitude,
                    this.longitude,
                    this.type);
            l.image = this.image;
            return l;
        }
    }
}

// NYC
// Borough	Site type	Park/Site Name	Address	Latitude	Longitude
// [ 1, "09BA982F-E777-4D8F-BCAB-3A04D56FB719", 1, 1341003073, "392904", 1341003073, "392904", "{\n}", "Bronx", "Subproperty", "227th St. Plgd", "E 227 St/Bronx River Pkway", "40.890848989", "-73.864223918" ]

@@ -1546,16 +1546,73 @@
 model;%0A%0A
+import android.os.Parcel;%0Aimport android.os.Parcelable;%0A%0A
 /**%0A * C
@@ -1662,16 +1662,38 @@
 ass Loc 
+implements Parcelable 
 %7B%0A%0A    p
@@ -1832,16 +1832,60 @@
    /
-/LocType
+**%0A     * @see com.pt2121.envi.model.LocType%0A     */
 %0A   
@@ -2042,155 +2042,1227 @@
 this
-.name = name;%0A        this.address = address;%0A        this.latitude = latitude;%0A        this.longitude = longitude;%0A        this.type = type;%0A    %7D
+(name, address, latitude, longitude, type, null);%0A    %7D%0A%0A    public Loc(String name, String address, double latitude, double longitude, int type,%0A            String image) %7B%0A        this.name = name;%0A        this.address = address;%0A        this.latitude = latitude;%0A        this.longitude = longitude;%0A        this.type = type;%0A        this.image = image;%0A    %7D%0A%0A    private Loc(Parcel in) %7B%0A        name = in.readString();%0A        address = in.readString();%0A        latitude = in.readDouble();%0A        longitude = in.readDouble();%0A        type = in.readInt();%0A        image = in.readString();%0A    %7D%0A%0A    @Override%0A    public int describeContents() %7B%0A        return 0;%0A    %7D%0A%0A    @Override%0A    public void writeToParcel(Parcel dest, int flags) %7B%0A        dest.writeString(name);%0A        dest.writeString(address);%0A        dest.writeDouble(latitude);%0A        dest.writeDouble(longitude);%0A        dest.writeInt(type);%0A        dest.writeString(image);%0A    %7D%0A%0A    public static final Parcelable.Creator CREATOR = new Parcelable.Creator() %7B%0A        public Loc createFromParcel(Parcel in) %7B%0A            return new Loc(in);%0A        %7D%0A%0A        public Loc%5B%5D newArray(int size) %7B%0A            return new Loc%5Bsize%5D;%0A        %7D%0A    %7D;
 %0A%0A  

Make Loc Parcelable