/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package TestRest.converter;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import java.util.Collection;
import java.util.List;
import java.util.ArrayList;
import java.net.URI;

import TestRest.Assocaro;
import TestRest.Arrival;

/**
 *
 * @author aparnab
 */
@XmlRootElement(name="pick")
public class PicksConverter {
    @XmlAttribute
    private String publicID = "smi:data.scec.org/pick/";
    private Collection<Assocaro> entities;
    private URI uri;

    private Assocaro entity;

    @XmlElement(name="time")
    private List<TimeConverter> time;

    @XmlElement(name="waveformID")
    private List<PickWaveformIDConverter> waveformID;

    public PicksConverter(){
    }

    public PicksConverter(Assocaro entity, URI uri){
        this.entity = entity;
        this.uri = uri;
        this.setPublicID(12324343L);
        Arrival arr = entity.getArrival();

        this.time = new ArrayList<TimeConverter>();
        TimeConverter temp = new TimeConverter();
        temp.setTime(arr.getDatetime().longValue());
        this.time.add(temp);

        this.waveformID = new ArrayList<PickWaveformIDConverter>();
        
        PickWaveformIDConverter tempWaveformID = new PickWaveformIDConverter(arr.getNet(), arr.getSta(), arr.getSeedchan());
        this.waveformID.add(tempWaveformID);
    }
    
    public void setPublicID(Long pickID){
        this.publicID = this.publicID + pickID;
    }

}
