package com.atlassian.bitbucket.test.rest.commit;

import com.atlassian.bitbucket.test.rest.HasBody;
import net.sf.json.JSONObject;

import javax.annotation.Nonnull;

public class RestUpdateCommitCommentRequest extends AbstractRestCommitCommentRequest implements HasBody {

    private final JSONObject body;

    private RestUpdateCommitCommentRequest(Builder builder) {
        super(builder);

        body = builder.body;
    }

    @Nonnull
    @Override
    public JSONObject getBody() {
        return body;
    }

    public static class Builder extends AbstractCommitCommentBuilder<Builder, RestUpdateCommitCommentRequest> {

        private final JSONObject body;

        public Builder(long id, JSONObject body) {
            super(id);

            this.body = body;
        }

        public Builder(@Nonnull RestUpdateCommitCommentRequest request) {
            super(request);

            body = request.getBody();
        }

        @Nonnull
        @Override
        public RestUpdateCommitCommentRequest build() {
            return new RestUpdateCommitCommentRequest(this);
        }

        @Nonnull
        @Override
        protected Builder self() {
            return this;
        }
    }
}
