// Copyright (c) 2020 UWB & LESP.
// The UWB & LESP license this file to you under the MIT license.

package cz.senslog.connector.model.v1;

import cz.senslog.connector.model.api.AbstractModel;

import java.time.OffsetDateTime;
import java.util.Collections;
import java.util.List;
import java.util.Map;

/**
 * The class {@code SenslogV1Model} represents a model which contains
 * transfer data for Senslog V1 pusher.
 *
 * @author Lukas Cerny
 * @version 1.0
 * @since 1.0
 */
public class SenslogV1Model extends AbstractModel {

    /** List of observations */
    private final List<Record> observations;

    /** Map of units related to the observations  */
    private final Map<Long, UnitInfo> unitInfos;

    /**
     * Constructor of the class sets all attributes.
     * @param observations - list of observations.
     * @param from - start of the time range.
     * @param to - end of the time range.
     */
    public SenslogV1Model(List<Record> observations, OffsetDateTime from, OffsetDateTime to) {
        super(from, to);
        this.observations = observations;
        this.unitInfos = Collections.emptyMap();
    }

    public SenslogV1Model(Map<Long, UnitInfo> unitInfos, List<Record> observations, OffsetDateTime from, OffsetDateTime to) {
        super(from, to);
        this.observations = observations;
        this.unitInfos = unitInfos;
    }

    public Map<Long, UnitInfo> getUnitInfos() {
        return unitInfos;
    }

    public List<Record> getObservations() {
        return  observations;
    }
}
