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

import com.atlassian.bitbucket.pull.PullRequest;

import javax.annotation.Nonnull;

/**
 * A task to trigger removing files for previous {@link PullRequest#getVersion() pull request versions}. The
 * {@link PullRequest} provided to the constructor is expected to be the <i>current version</i>.
 *
 * @since 3.4
 */
public class RemoveOldPullRequestVersionsTask extends AbstractPullRequestTask {

    private final int version;

    public RemoveOldPullRequestVersionsTask(@Nonnull PullRequest pullRequest) {
        super(pullRequest);

        version = pullRequest.getVersion();
    }

    @Override
    public <T> T accept(@Nonnull PullRequestTaskVisitor<T> visitor) {
        return visitor.visit(this);
    }

    public int getVersion() {
        return version;
    }
}
