package com.atlassian.bitbucket.mesh.git.batch;

import com.atlassian.bitbucket.mesh.rpc.v1.RpcBatchChangeType;

import static com.atlassian.bitbucket.mesh.rpc.v1.RpcBatchChangeType.*;

/**
 * Describes how a file has changed in a batch content command.
 */
public enum BatchChangeType {

    /**
     * File was added. In case the parameters for the batch content command didn't specify a "since" commit ID, all files
     * will have this status.
     */
    ADD,

    /**
     * File was deleted compared to the "since" commit ID.
     */
    DELETE,

    /**
     * File was modified compared to the "since" commit ID.
     */
    MODIFY;

    public RpcBatchChangeType toRpc() {
        switch (this) {
            case DELETE:
                return BATCH_CHANGE_DELETE;
            case MODIFY:
                return BATCH_CHANGE_MODIFY;
            default:
                return BATCH_CHANGE_ADD;
        }
    }
}
