package ch.epfl.sweng.swissaffinity.events;


import java.io.Serializable;
import java.util.Date;

import ch.epfl.sweng.swissaffinity.utilities.Location;

/**
 * Representation of an abstract event.
 */
public abstract class AbstractEvent implements Serializable {

    protected final int mId;
    protected final String mName;
    protected final Location mLocation;
    protected final int mMaxPeople;
    protected final Date mDateBegin;
    protected final Date mDateEnd;
    protected final double mBasePrice;
    protected final Event.State mState;
    protected final String mDescription;
    protected final String mImagePath;
    protected final Date mLastUpdate;

    protected AbstractEvent(Builder builder) {
        mId = builder.mId;
        mLocation = builder.mLocation;
        mName = builder.mName;
        mMaxPeople = builder.mMaxPeople;
        mDateBegin = builder.mDateBegin;
        mDateEnd = builder.mDateEnd;
        mBasePrice = builder.mBasePrice;
        mState = builder.mState;
        mDescription = builder.mDescription;
        mImagePath = builder.mImagePath;
        mLastUpdate = builder.mLastUpdate;
    }

    public static class Builder {

        private int mId;
        private String mName;
        private Location mLocation;
        private int mMaxPeople;
        private Date mDateBegin;
        private Date mDateEnd;
        private double mBasePrice;
        private Event.State mState;
        private String mDescription;
        private String mImagePath;
        private Date mLastUpdate;

        public Builder setId(int id) {
            mId = id;
            return this;
        }

        public Builder setName(String name) {
            mName = name;
            return this;
        }

        public Builder setLocation(Location location) {
            mLocation = location;
            return this;
        }

        public Builder setMaxPeople(int maxPeople) {
            mMaxPeople = maxPeople;
            return this;
        }

        public Builder setDateBegin(Date dateBegin) {
            mDateBegin = dateBegin;
            return this;
        }

        public Builder setDateEnd(Date dateEnd) {
            mDateEnd = dateEnd;
            return this;
        }

        public Builder setBasePrice(double basePrice) {
            mBasePrice = basePrice;
            return this;
        }

        public Builder setState(String state) {
            mState = Event.State.getState(state);
            return this;
        }

        public Builder setDescrition(String descrition) {
            mDescription = descrition;
            return this;
        }

        public Builder setImagePath(String imagePath) {
            mImagePath = imagePath;
            return this;
        }

        public Builder setLastUpdate(Date lastUpdate) {
            mLastUpdate = lastUpdate;
            return this;
        }
    }
}

@@ -1137,24 +1137,85 @@
 ate;%0A    %7D%0A%0A
+    /**%0A     * Builder for the abstract event class.%0A     */%0A
     public s
@@ -1236,16 +1236,16 @@
 ilder %7B%0A
-
 %0A       
@@ -1598,24 +1598,119 @@
 astUpdate;%0A%0A
+        /**%0A         * Setter for ID.%0A         * @param id%0A         * @return this%0A         */%0A
         publ
@@ -1786,32 +1786,131 @@
 his;%0A        %7D%0A%0A
+        /**%0A         * Setter for name.%0A         * @param name%0A         * @return this%0A         */%0A
         public B
@@ -1993,32 +1993,139 @@
 his;%0A        %7D%0A%0A
+        /**%0A         * Setter for location.%0A         * @param location%0A         * @return this%0A         */%0A
         public B
@@ -2226,32 +2226,156 @@
 his;%0A        %7D%0A%0A
+        /**%0A         * Setter for maximum number of people.%0A         * @param maxPeople%0A         * @return this%0A         */%0A
         public B
@@ -2475,32 +2475,154 @@
 his;%0A        %7D%0A%0A
+        /**%0A         * Setter for starting date and time.%0A         * @param dateBegin%0A         * @return this%0A         */%0A
         public B
@@ -2723,32 +2723,149 @@
 his;%0A        %7D%0A%0A
+        /**%0A         * Setter for ending date and time%0A         * @param dateEnd%0A         * @return this%0A         */%0A
         public B
@@ -2958,32 +2958,137 @@
 his;%0A        %7D%0A%0A
+        /**%0A         * Setter for price.%0A         * @param basePrice%0A         * @return this%0A         */%0A
         public B
@@ -3191,32 +3191,110 @@
 his;%0A        %7D%0A%0A
+        /**%0A         *%0A         * @param state%0A         * @return%0A         */%0A
         public B

add comments in events