package com.atlassian.stash.internal.backup.liquibase;

import java.util.Objects;

class LiquibaseChangeSetMetaData implements LiquibaseChangeSet {

    private final long changeCount;
    /**
     * A measure of the relative size of the change set in terms of the number of changes it contains.
     * A value from 0 to 100. i.e. a percentage.
     */
    private final int weight;

    LiquibaseChangeSetMetaData(long changeCount, int weight) {
        this.changeCount = changeCount;
        this.weight = weight;
    }

    @Override
    public long getChangeCount() {
        return changeCount;
    }

    @Override
    public int getWeight() {
        return weight;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        LiquibaseChangeSetMetaData that = (LiquibaseChangeSetMetaData) o;
        return changeCount == that.changeCount && weight == that.weight;
    }

    @Override
    public int hashCode() {
        return Objects.hash(changeCount, weight);
    }

    @Override
    public String toString() {
        return "ChangeSetMetaData{" +
            "changeCount=" + changeCount +
            ", weight=" + weight +
            '}';
    }
}
