package com.atlassian.bitbucket.internal.branch.automerge.rest;

import com.atlassian.bitbucket.internal.branch.automerge.AutoMergeStatus;
import com.atlassian.bitbucket.rest.RestMapEntity;
import com.atlassian.bitbucket.rest.annotation.JsonSurrogate;
import org.codehaus.jackson.map.annotate.JsonSerialize;

import javax.annotation.Nonnull;

import static com.google.common.base.Preconditions.checkNotNull;

/**
 * @since 2.8
 */
@JsonSerialize
@JsonSurrogate(AutoMergeStatus.class)
public class RestAutoMergeStatus extends RestMapEntity {

    public static final String ID = "id";
    public static final String AVAILABLE = "available";

    public RestAutoMergeStatus(@Nonnull AutoMergeStatus status) {
        checkNotNull(status, "status");
        put(ID, status.getId());
        put(AVAILABLE, status.isAvailable());
    }
}
