package model;

import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.collections.ObservableList;

/**
 * Created by Gondr on 5/04/2017.
 */
public class TripStop{

    private transient StringProperty time;
    private transient StringProperty name;
    private String serialiseTime;
    private String serialiseName;

    public TripStop(String name, String time){
        this.name = new SimpleStringProperty(name);
        this.time = new SimpleStringProperty(time);
    }

    public String getTime() {
        return time.get();
    }

    public StringProperty timeProperty() {
        return time;
    }

    public void setTime(String time) {
        this.time.set(time);
    }

    public String getName() {
        return name.get();
    }

    public StringProperty nameProperty() {
        return name;
    }

    protected boolean equals(TripStop trip){
        if (getTime().equals(trip.getTime()) && getName().equals(trip.getName())){
            return true;
        }
        return false;
    }

    public boolean equals(Stop stop){
        return name.getValue().equals(stop.getAddress());
    }

    public void serialise(){
        serialiseTime = time.getValue();
        serialiseName = name.getValue();
    }
    public void deserialise(){
        time = new SimpleStringProperty(serialiseTime);
        name = new SimpleStringProperty(serialiseName);
    }

    public String toString(){
        return getName();
    }
}
