/* ----------------------------------------
 * Origin  : GFI INFORMATIQUE 
 * Project : CDPP Propagation Tool 
 * ----------------------------------------
 * History 
 * Version : 01/05/2015 : SCA : V2.1
 * Version : 24/03/2016 : SCA : V2.2 (PSWS-H2020)
 * Version : 05/05/2021 : LBE
 * DM-ID : Redmine#7059 : 05/05/2021 : get orbits between 2 dates
 * ----------------------------------------
 */
package fr.tlse.irap.server.serviceDAO;

import java.util.Date;
import java.util.List;
import java.util.NoSuchElementException;

import javax.vecmath.Matrix3d;
import javax.xml.datatype.XMLGregorianCalendar;

import cdpp3dview.types.Frame;
import fr.tlse.irap.pos.Position;
import fr.tlse.irap.spaceElement.Camera;
import fr.tlse.irap.spaceElement.SpaceElement;
import fr.tlse.irap.spaceElement.SpaceElementWrapper;
import java.util.ArrayList;

public interface ISpiceDAO {

	/**
	 * Get all space elements from date d with orbits.
	 * @param time
	 * @return a list of space elements having positions defined between start time and start time + delta t
	 */
	SpaceElementWrapper getOrbits(Date d);
	
	/**
	 * Get orbit of selected elements from date d.
	 * @param spaceElementWrapper
	 * @param d
	 * @return the list of space element with orbit positions defined between start time and start time + delta t
	 */
	SpaceElementWrapper getOrbitElements(SpaceElementWrapper spaceElementWrapper, Date d);
	
	/**
	 * Get position of a space element at date d.
	 * @param e
	 * @param d
	 * @return the space element with its real coordinates.
	 * @throws NoSuchElementException
	 */
	SpaceElement getPositionElement(SpaceElement e, Date d) throws NoSuchElementException;
	
	/**
	 * Get position of a spacecraft at date d in HEEQ system using the new 3Dview 
	 * @param e
	 * @param d
	 * @return the space element with its real coordinates.
	 * @throws NoSuchElementException
	 */
	SpaceElement getHEEQPositionElement(SpaceElement e, Date d) throws NoSuchElementException;

	/**
	 * Get available comets in a region around a space element between 2 dates
	 * @param startTime
	 * @param endTime
	 * @param spaceElement
	 * @param distance
	 * @return
	 */
	SpaceElementWrapper getAvailableComets(Date startTime, Date endTime, SpaceElement spaceElement, long distance);
	
	/**
	 * Get positions of a probe at different dates in HAE system using the new 3Dview 
	 * @param frame
	 * @param times
	 * @return the space element with its real coordinates.
	 * @throws Exception
	 */
	List<Matrix3d> getMatAtt (Frame frame, List<XMLGregorianCalendar> times) throws Exception;

	/**
	 * Get positions of a body in Frame system using the new 3Dview service
	 * @param e with timeValues set for each desire position
	 * @param frame
	 * @return the space element with its real coordinates.
	 * @throws NoSuchElementException
	 */
	SpaceElement getPositionsElement(SpaceElement e, Frame frame) throws NoSuchElementException;

	/**
	 * Transform a list of orbit positions from a coordinate system to another  
	 * @param positions
	 * @param frameFrom
	 * @param centerFrom : element center naifID of the system coordinates from
	 * @param frameTo
	 * @param centerTo : element center naifID of the to system coordinates to
	 * @param times
	 * @return the list of positions in the new frame 
	 * @throws NoSuchElementException
	 */
	List<Position> transformPositions(List<Position> positions, String frameFrom, String centerFrom, String frameTo, String centerTo, List<XMLGregorianCalendar> times) throws NoSuchElementException;

	/**
	 * Get instruments list belonging to a probe
	 * @param naifId S/C
	 * @return 
	 */
	List<Camera> getProbeInstruments(int naifId);

}
