package com.infoclinika.pdx.projection;

import com.infoclinika.pdx.domain.sample.SampleType;

import java.util.Objects;

/**
 * Holds statistics for mutations grouped by gene, primary site and sample type.
 */
public class MutationStatistics extends BaseStatistics {
    private String primarySite;
    private SampleType type;

    /**
     * Constructor with all fields.
     */
    public MutationStatistics(String name, String primarySite, SampleType type, long count) {
        super(name, count);
        this.primarySite = primarySite;
        this.type = type;
    }

    public String getPrimarySite() {
        return primarySite;
    }

    public void setPrimarySite(String primarySite) {
        this.primarySite = primarySite;
    }

    public SampleType getType() {
        return type;
    }

    public void setType(SampleType type) {
        this.type = type;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        final MutationStatistics that = (MutationStatistics) o;
        return getCount() == that.getCount()
               && Objects.equals(getName(), that.getName())
               && Objects.equals(getPrimarySite(), that.getPrimarySite())
               && getType() == that.getType();
    }

    @Override
    public int hashCode() {
        return Objects.hash(getName(), getPrimarySite(), getType(), getCount());
    }

    @Override
    public String toString() {
        return "MutationStatistics{"
               + "gene='" + getName() + '\''
               + ", primarySite='" + primarySite + '\''
               + ", type=" + type
               + ", count=" + getCount()
               + '}';
    }
}
