package com.atlassian.bitbucket.scm.git.command.merge.conflict;

import com.atlassian.bitbucket.content.ChangeType;

import javax.annotation.Nonnull;

public abstract class AbstractGitMergeConflict implements GitMergeConflict {

    private final String message;
    private final ChangeType ourChange;
    private final ChangeType theirChange;
    private final GitMergeConflictType type;

    protected AbstractGitMergeConflict(@Nonnull GitMergeConflictType type, @Nonnull String message,
                                       @Nonnull ChangeType change) {
        this(type, message, change, change);
    }

    protected AbstractGitMergeConflict(@Nonnull GitMergeConflictType type, @Nonnull String message,
                                       @Nonnull ChangeType ourChange, @Nonnull ChangeType theirChange) {
        this.message = message;
        this.ourChange = ourChange;
        this.theirChange = theirChange;
        this.type = type;
    }

    @Nonnull
    @Override
    public String getMessage() {
        return message;
    }

    @Nonnull
    @Override
    public ChangeType getOurChange() {
        return ourChange;
    }

    @Nonnull
    @Override
    public ChangeType getTheirChange() {
        return theirChange;
    }

    @Nonnull
    @Override
    public GitMergeConflictType getType() {
        return type;
    }
}
