package com.atlassian.stash.internal.scm.git;

import com.atlassian.bitbucket.repository.Repository;

import java.io.Serializable;

class GarbageCollectionRequest implements Serializable {
    private final int repositoryId;
    private final String hierarchyId;

    public GarbageCollectionRequest(Repository repository) {
        this(repository.getId(), repository.getHierarchyId());
    }

    public GarbageCollectionRequest(int repositoryId, String hierarchyId) {
        this.hierarchyId = hierarchyId;
        this.repositoryId = repositoryId;
    }

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

        GarbageCollectionRequest other = (GarbageCollectionRequest) o;
        return repositoryId == other.repositoryId;
    }

    public String getHierarchyId() {
        return hierarchyId;
    }

    public int getRepositoryId() {
        return repositoryId;
    }

    @Override
    public int hashCode() {
        return repositoryId;
    }
}
