package org.xbib.io.webdav.client.methods;

import org.xbib.io.webdav.common.OrderPatch;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

/**
 * Represents an HTTP ORDERPATCH request.
 *
 * @see <a href="http://webdav.org/specs/rfc3648.html#rfc.section.5">RFC 3648, Section 5</a>
 */
public class Orderpatch extends AbstractMethod {

    OrderPatch orderPatchInfo;

    public Orderpatch(OrderPatch orderPatchInfo) {
        this.orderPatchInfo = orderPatchInfo;
    }

    @Override
    public String method() {
        return "ORDERPATCH";
    }

    @Override
    public HttpRequest.BodyPublisher bodyPublisher() {
        return publish(orderPatchInfo);
    }

    @Override
    public boolean succeeded(HttpResponse<?> response) {
        return response.statusCode() == 200;
    }
}