package ch.spherIC.recurvebowsight.logic;

import android.annotation.SuppressLint;
import android.os.Parcel;
import android.os.Parcelable;

@SuppressLint("ParcelCreator")
public class BallisticResults implements Parcelable {

    private Double[][] flightCurve;
    private Double startAngle;
    private Double[] maxHCurve;
    private Double flightDuration;

    /**
     * Constructor for ballistic results.
     *
     * @param flightCurve flight curve values array
     * @param startAngle  flight curve start angle
     * @param maxHCurve   max height of flight curve
     */
    public BallisticResults(Double[][] flightCurve, Double startAngle, Double[] maxHCurve, Double flightDuration) {
        this.flightCurve = flightCurve;
        this.startAngle = startAngle;
        this.maxHCurve = maxHCurve;
        this.flightDuration = flightDuration;
    }

    public Double[][] getFlightCurve() {
        return flightCurve;
    }

    public void setFlightCurve(Double[][] flightCurve) {
        this.flightCurve = flightCurve;
    }

    public Double getStartAngle() {
        return startAngle;
    }

    public void setStartAngle(Double startAngle) {
        this.startAngle = startAngle;
    }

    public Double[] getMaxHCurve() {
        return maxHCurve;
    }

    public void setMaxHCurve(Double[] maxHCurve) {
        this.maxHCurve = maxHCurve;
    }

    public Double getFlightDuration() {
        return flightDuration;
    }

    public void setFlightDuration(Double flightDuration) {
        this.flightDuration = flightDuration;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        if (startAngle == null) {
            dest.writeByte((byte) 0);
        } else {
            dest.writeByte((byte) 1);
            dest.writeDouble(startAngle);
        }
    }
}
