package com.infoclinika.pdx.projection;

import com.infoclinika.pdx.domain.sample.SampleType;

import java.util.EnumMap;
import java.util.Map;
import java.util.Objects;

/**
 * Holder of experiment data statistics by primary site.
 */
public class AggregatePrimarySiteStatistics {
    private Long id;
    private String name;
    private Map<SampleType, ExperimentTypeCounts> counts = new EnumMap<>(SampleType.class);

    public AggregatePrimarySiteStatistics() {
    }

    public AggregatePrimarySiteStatistics(Long id, String name) {
        this.id = id;
        this.name = name;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Map<SampleType, ExperimentTypeCounts> getCounts() {
        return counts;
    }

    public void setCounts(Map<SampleType, ExperimentTypeCounts> counts) {
        this.counts = counts;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        final AggregatePrimarySiteStatistics that = (AggregatePrimarySiteStatistics) o;
        return Objects.equals(getId(), that.getId())
               && Objects.equals(getName(), that.getName())
               && Objects.equals(getCounts(), that.getCounts());
    }

    @Override
    public int hashCode() {
        return Objects.hash(getId(), getName(), getCounts());
    }

    @Override
    public String toString() {
        return "AggregatePrimarySiteStatistics{"
               + "id=" + id
               + ", name='" + name + '\''
               + ", counts=" + counts
               + '}';
    }
}
