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

import com.atlassian.bitbucket.rest.RestMapEntity;
import com.atlassian.bitbucket.scm.git.command.tag.GitTagType;
import org.codehaus.jackson.map.annotate.JsonSerialize;

@JsonSerialize
public class RestGitTagCreateRequest extends RestMapEntity {

    public static final String FORCE = "force";
    public static final String MESSAGE = "message";
    public static final String NAME = "name";
    public static final String START_POINT = "startPoint";
    public static final String TYPE = "type";

    @SuppressWarnings("unused") //Required for Jersey
    public RestGitTagCreateRequest() {
    }

    // Required for REST documentation
    private RestGitTagCreateRequest(String force, String message, String name, String startPoint, String type) {
        putIfNotNull(FORCE, force);
        putIfNotNull(MESSAGE, message);
        putIfNotNull(NAME, name);
        putIfNotNull(START_POINT, startPoint);
        putIfNotNull(TYPE, type);
    }

    public String getMessage() {
        return getStringProperty(MESSAGE);
    }

    public String getName() {
        return getStringProperty(NAME);
    }

    public String getStartPoint() {
        return getStringProperty(START_POINT);
    }

    public GitTagType getType() {
        return getEnumProperty(TYPE, GitTagType.class);
    }

    public Boolean isForce() {
        return getBoolProperty(FORCE, false);
    }

    // REST Documentation Examples

    public static final RestGitTagCreateRequest ANNOTATED_EXAMPLE = new RestGitTagCreateRequest("true", "A new release tag", "release-tag",
            "refs/heads/master", "ANNOTATED");

    public static final RestGitTagCreateRequest LIGHTWEIGHT_EXAMPLE = new RestGitTagCreateRequest("false", null, "bamboo-tag",
            "refs/heads/master", "LIGHTWEIGHT");
}