package org.itevents.model;

import javax.xml.bind.annotation.*;
import java.io.Serializable;
import java.util.Date;

@XmlRootElement(name = "event")
@XmlAccessorType(XmlAccessType.NONE)
@XmlType(propOrder={"id", "title", "eventDate", "createDate", "regLink", "address", "location", "contact", "price", "currency", "city"})
public class Event implements Serializable {

    private static final long serialVersionUID = 1L;

    @XmlElement
    private int id;
    @XmlElement
    private String title;
    @XmlElement
    private Date eventDate;
    @XmlElement
    private Date createDate;
    @XmlElement
    private String regLink;
    @XmlElement
    private String address;
    @XmlElement
    private Location location;
    @XmlElement
    private String contact;
    @XmlElement
    private boolean free;
    @XmlElement
    private Integer price;
    @XmlElement
    private Currency currency;
    @XmlElement
    private City city;

    public Event() {
    }

    public Event(int id, String title, Date eventDate, Date createDate, String regLink, String address,
                 Location location, String contact, boolean free, Integer price, Currency currency, City city) {
        this.id = id;
        this.title = title;
        this.eventDate = eventDate;
        this.createDate = createDate;
        this.regLink = regLink;
        this.address = address;
        this.location = location;
        this.contact = contact;
        this.free = free;
        this.price = price;
        this.currency = currency;
        this.city = city;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public Date getEventDate() {
        return eventDate;
    }

    public void setEventDate(Date eventDate) {
        this.eventDate = eventDate;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public String getRegLink() {
        return regLink;
    }

    public void setRegLink(String regLink) {
        this.regLink = regLink;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public Location getLocation() {
        return location;
    }

    public void setLocation(Location location) {
        this.location = location;
    }

    public String getContact() {
        return contact;
    }

    public void setContact(String contact) {
        this.contact = contact;
    }

    public boolean isFree() {
        return free;
    }

    public void setFree(boolean free) {
        this.free = free;
    }

    public int getPrice() {
        return price;
    }

    public void setPrice(int price) {
        this.price = price;
    }

    public Currency getCurrency() {
        return currency;
    }

    public void setCurrency(Currency currency) {
        this.currency = currency;
    }

    public City getCity() {
        return city;
    }

    public void setCity(City city) {
        this.city = city;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Event event = (Event) o;

        if (id != event.id) return false;
        if (free != event.free) return false;
        if (price != null ? !price.equals(event.price) : event.price != null) return false;
        if (title != null ? !title.equals(event.title) : event.title != null) return false;
        if (eventDate != null ? !eventDate.equals(event.eventDate) : event.eventDate != null) return false;
        if (createDate != null ? !createDate.equals(event.createDate) : event.createDate != null) return false;
        if (regLink != null ? !regLink.equals(event.regLink) : event.regLink != null) return false;
        if (address != null ? !address.equals(event.address) : event.address != null) return false;
        if (location != null ? !location.equals(event.location) : event.location != null) return false;
        if (contact != null ? !contact.equals(event.contact) : event.contact != null) return false;
        if (currency != null ? !currency.equals(event.currency) : event.currency != null) return false;
        return !(city != null ? !city.equals(event.city) : event.city != null);

    }

    @Override
    public int hashCode() {
        int result = id;
        result = 31 * result + (title != null ? title.hashCode() : 0);
        result = 31 * result + (eventDate != null ? eventDate.hashCode() : 0);
        result = 31 * result + (createDate != null ? createDate.hashCode() : 0);
        result = 31 * result + (regLink != null ? regLink.hashCode() : 0);
        result = 31 * result + (address != null ? address.hashCode() : 0);
        result = 31 * result + (location != null ? location.hashCode() : 0);
        result = 31 * result + (contact != null ? contact.hashCode() : 0);
        result = 31 * result + (free ? 1 : 0);
        result = 31 * result + (price != null ? price.hashCode() : 0);
        result = 31 * result + (currency != null ? currency.hashCode() : 0);
        result = 31 * result + (city != null ? city.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("Event{");
        sb.append("id=").append(id);
        sb.append(", title='").append(title).append('\'');
        sb.append(", eventDate=").append(eventDate);
        sb.append(", createDate=").append(createDate);
        sb.append(", regLink='").append(regLink).append('\'');
        sb.append(", address='").append(address).append('\'');
        sb.append(", location=").append(location);
        sb.append(", contact='").append(contact).append('\'');
        sb.append(", free=").append(free);
        sb.append(", price=").append(price);
        sb.append(", currency=").append(currency);
        sb.append(", city=").append(city);
        sb.append('}');
        return sb.toString();
    }
}

@@ -55,17 +55,173 @@
 otation.
-*
+XmlAccessType;%0Aimport javax.xml.bind.annotation.XmlAccessorType;%0Aimport javax.xml.bind.annotation.XmlElement;%0Aimport javax.xml.bind.annotation.XmlRootElement
 ;%0Aimport
@@ -287,22 +287,8 @@
 ent(
-name = %22event%22
 )%0A@X
@@ -326,145 +326,8 @@
 NE)%0A
-@XmlType(propOrder=%7B%22id%22, %22title%22, %22eventDate%22, %22createDate%22, %22regLink%22, %22address%22, %22location%22, %22contact%22, %22price%22, %22currency%22, %22city%22%7D)%0A
 publ
@@ -796,17 +796,17 @@
 private 
-b
+B
 oolean f
@@ -1124,17 +1124,17 @@
 ontact, 
-b
+B
 oolean f
@@ -2735,25 +2735,25 @@
 %0A    public 
-b
+B
 oolean isFre
@@ -2810,17 +2810,17 @@
 setFree(
-b
+B
 oolean f
@@ -2866,27 +2866,31 @@
 %0A    public 
-i
+I
 nt
+eger
  getPrice() 
@@ -2945,19 +2945,23 @@
 etPrice(
-i
+I
 nt
+eger
  price) 

fix Event