/* ----------------------------------------
 * Origin  : GFI INFORMATIQUE 
 * Project : CDPP Propagation Tool 
 * ----------------------------------------
 * History 
 * Version : 01/05/2015 : SCA : V2.1
 * Version : 17/10/2018 : SCA : V2.2.5
 *  Redmine #6119 
 * ----------------------------------------
 */
package fr.tlse.irap.tool.sep;

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

import fr.tlse.irap.spaceElement.SpaceElement;
import fr.tlse.irap.spaceElement.Sun;

/**
 * All input information useful for the COROTATION tool 
 */
public class Sep implements Serializable {

	private static final long serialVersionUID = 1L;
	public static double DEFAULT_SPEED = 500.0;
	public enum Particle {proton, electron;}

	/* START parameters */
	private Calendar sunTime;
	private Calendar startTime;		 	 
	private SpaceElement startElement;	
	private SpaceElement endElement;
//	private Double timeError = 0.0; 			// error in time t, expressed in hours
	private Double speedSolarWind = DEFAULT_SPEED; 		// speed at time t at START point, expressed in km/s
	private Double speedError = 0.0; 			// error in speed, expressed in km/s
	private Double rotationPeriod = 25.38; 		// Rotation period of the Sun, expressed in days
	private Double spreadCIR = 22.50; 			// CIR source longitude, expressed in degrees [0,360[
	private Double spiralLengthStart;			// Length of the Parker spiral between the Sun and the probe given in START expressed in AU
	private Double particleEnergy = 30.0;		// energy of particle, expressed in MeV
	private Particle particle = Particle.proton;

	/* Position information at time t */
	private double[] sunAttitudeT= new double[2];	// HAE longitude of CARRINGTON meridian 0 at time tSun, expressed in degrees 
	private Double radialDistanceStart;			// radial distance at time t of START point, expressed in km
	private Double radialDistStartXY;			// projection XY of radial distance at time t of START point, expressed in km
	private Double longStartT;					// HAE longitude of START at time t, expressed in degrees
	private Double latStartT;					// HAE latitude of START at time t, expressed in degrees
	private Double longSourceT;					// HAE longitude of spiral source at time t, expressed in degrees
	private Double latSourceT;					// HAE latitude of spiral source at time t, expressed in degrees

	/* Position information at time tSun */
	private double longSource;					// CARRINGTON longitude of spiral, expressed in degrees [0,360[
	private double latSource;					// CARRINGTON latitude of spiral, expressed in degrees [0,360[

	public Sep() {
		this.startTime = new GregorianCalendar();
		this.startTime.set(GregorianCalendar.MILLISECOND, 0);
		this.sunTime = new GregorianCalendar();
		this.sunTime.set(GregorianCalendar.MILLISECOND, 0);
	}
	
	public Calendar getStartTime() {
		return startTime;
	}

	public void setStartTime(Calendar c) {
		this.startTime = c;
	}

	public void setStartTime(Date d) {
		this.startTime.setTime(d);
	}

//	public Double getTimeError() {
//		return timeError;
//	}
//
//	public void setTimeError(Double timeError) {
//		this.timeError = timeError;
//	}

	public Double getSpeedError() {
		return speedError;
	}

	public void setSpeedError(Double speedError) {
		this.speedError = speedError;
	}

	public Double getRadialDistanceStart() {
		return radialDistanceStart;
	}

	public void setRadialDistanceStart(Double radialDistanceStart) {
		this.radialDistanceStart = radialDistanceStart;
	}

	public Calendar getSunTime() {
		return sunTime;
	}

	public void setSunTime(Calendar sunTime) {
		this.sunTime = sunTime;
	}

	public void setSunTime(Date d) {
		this.sunTime.setTime(d);
	}

	public double getLongSource() {
		return longSource;
	}

	public void setLongSource(double longSource) {
		this.longSource = longSource;
	}

	public Double getLatSource() {
		return latSource;
	}

	public void setLatSource(Double latSource) {
		this.latSource = latSource;
	}

	public SpaceElement getStartElement() {
		return startElement;
	}

	public void setStartElement(SpaceElement startElement) {
		this.startElement = startElement;
	}

	public SpaceElement getEndElement() {
		return endElement;
	}

	public void setEndElement(SpaceElement endElement) {
		this.endElement = endElement;
	}

	public Double getSpeedSolarWind() {
		return speedSolarWind;
	}

	public void setSpeedSolarWind(Double speedSolarWind) {
		this.speedSolarWind = speedSolarWind;
	}

	public Boolean startIsSun() {
		if (startElement == null) {
			return false;
		}
		return (startElement.getClass().equals(Sun.class));
	}

	public Double getLongStartT() {
		return longStartT;
	}

	public void setLongStartT(Double longStartT) {
		this.longStartT = longStartT;
	}
	public Double getRotationPeriod() {
		return rotationPeriod;
	}

	public void setRotationPeriod(Double rotationPeriod) {
		this.rotationPeriod = rotationPeriod;
	}

	public Double getSpreadCIR() {
		return spreadCIR;
	}

	public void setSpreadCIR(Double spreadCIR) {
		this.spreadCIR = spreadCIR;
	}

	public double[] getSunAttitudeT() {
		return sunAttitudeT;
	}

	public void setSunAttitudeT(double[] sunAttitudeT) {
		this.sunAttitudeT = sunAttitudeT;
	}

	public Double getLongSourceT() {
		return longSourceT;
	}

	public void setLongSourceT(Double longSourceT) {
		this.longSourceT = longSourceT;
	}

	public Double getParticleEnergy() {
		return particleEnergy;
	}

	public void setParticleEnergy(Double particleEnergy) {
		this.particleEnergy = particleEnergy;
	}

	public Particle getParticle() {
		return particle;
	}

	public void setParticle(Particle particle) {
		this.particle = particle;
	}

	public Double getSpiralLengthStart() {
		return spiralLengthStart;
	}

	public void setSpiralLengthStart(Double spiralLengthStart) {
		this.spiralLengthStart = spiralLengthStart;
	}

	public Double getLatStartT() {
		return latStartT;
	}

	public void setLatStartT(Double latStartT) {
		this.latStartT = latStartT;
	}

	public Double getLatSourceT() {
		return latSourceT;
	}

	public void setLatSourceT(Double latSourceT) {
		this.latSourceT = latSourceT;
	}

	public Double getRadialDistStartXY() {
		return radialDistStartXY;
	}

	public void setRadialDistStartXY(Double radialDistStartXY) {
		this.radialDistStartXY = radialDistStartXY;
	}

}
