package leigh.astro.fits;

import java.time.Duration;
import java.util.ArrayList;

/**
 * A manifest of {@link AstroSub} objects.
 *
 * @author Alex Leigh
 */
public class SubManifest {
    private final ArrayList<AstroSub> subs;

    public SubManifest(ArrayList<AstroSub> subs) {
        this.subs = subs;
    }

    public Duration duration() {
        long exp = 0;
        for (AstroSub s : subs) {
            exp += (long) s.getLengthSeconds();
        }
        return Duration.ofSeconds(exp);
    }

    public int count() {
        return subs.size();
    }

    public ExposureCounter filterCount() {
        ExposureCounter fc = new ExposureCounter();
        fc.count(subs);
        return fc;
    }

    public int size() {
        return subs.size();
    }

    @Override
    public String toString() {
        return "SubManifest{" +
                "subs=" + subs +
                '}';
    }
}
