package com.example.GPS_DB01;

import java.text.SimpleDateFormat;
import java.util.Calendar;

public class TextReport 
{
    private String name, runid, report;
    private boolean isreported;
    private Calendar datetime;
    private double latitude, longitude, altitude, speed;

    public TextReport(String name, double latitude, double longitude, double altitude, double speed) 
    {
    	 
    	 this.name = name;
    	 this.latitude = latitude;
    	 this.longitude = longitude;
         this.altitude = altitude;
         this.speed = speed;
    }

    public TextReport(String runid, String report, double latitude, double longitude, double altitude, double speed) 
    {
    	 this.runid = runid;
    	 this.latitude = latitude;
    	 this.longitude = longitude;
         this.altitude = altitude;
         this.speed = speed;
         this.report = report;
         this.isreported = false;
    }

    public TextReport() 
    {
    }

    public void setReport(String report) 
    { 
    	this.report = report; 
    }
   
    public void setDatetime(Calendar datetime) 
    { 
    	this.datetime = datetime; 
    }

    public void setDatetime(long datetime)
    {
        Calendar cal = Calendar.getInstance();
        cal.setTimeInMillis(datetime);
        this.datetime = cal;
    }

    
    public String getName() { return name; }
    
    public void setName(String name) { this.name = name; }

    
    public String getRunid() { return runid; }
   
    public double getLatitude() { return latitude; }

    public boolean isIsreported() { return isreported; }

    public void setRunid(String runid) { this.runid = runid; }

    public String getReport() { return report; }

    public Calendar getDatetime() { return datetime; }

    public void setLongitude(double longitude) { this.longitude = longitude; }

    public double getLongitude() { return longitude; }
    
    public double getAltitude() { return altitude; }
    
    public double getSpeed() { return speed; }

    public void setLatitude(double latitude) { this.latitude = latitude; }
    
    public void setAltitude(double altitude) { this.altitude = altitude; }
    
    public void setSpeed(double speed) { this.speed = speed; }
    
    public void setIsreported(boolean isreported) { this.isreported = isreported; }

    @Override 
    public String toString() 
    {
    	SimpleDateFormat df = new SimpleDateFormat("dd-M-yyyy HH:mm:ss");
    	
        return "runid='" + runid +
                ",      isreported=" + isreported +
                "\nreport='" + report +
                "\ndatetime=" + df.format(datetime.getTime()) +
                "\nlatitude=" + latitude +
                ", longitude=" + longitude +
                "\naltitude=" + altitude +
                ", speed=" + speed    ;
    }

    //public SimpleDateFormat df = new SimpleDateFormat("EEEE, MMMM d, yyyy 'at' h:mm a"); // HH pour un format sur 24H
    
    
    // SimpleDateFormat sdf = new SimpleDateFormat("dd-M-yyyy hh:mm:ss");
}
