// Path: jres-core/src/main/java/com/blacklocus/jres/request/JresJsonRequest.java
// public abstract class JresJsonRequest<REPLY extends JresReply> implements JresRequest<REPLY> {
// 
//     private final Class<REPLY> responseClass;
// 
//     protected JresJsonRequest(Class<REPLY> responseClass) {
//         this.responseClass = responseClass;
//     }
// 
//     @Override
//     public final Class<REPLY> getResponseClass() {
//         return responseClass;
//     }
// }
// 
// Path: jres-core/src/main/java/com/blacklocus/jres/response/common/JresAcknowledgedReply.java
// public class JresAcknowledgedReply extends JresJsonReply {
// 
//     private Boolean acknowledged;
// 
//     public Boolean getAcknowledged() {
//         return acknowledged;
//     }
// }
// 
// Path: jres-core/src/main/java/com/blacklocus/jres/response/common/JresErrorReplyException.java
// public class JresErrorReplyException extends RuntimeException implements JresReply {
// 
//     private final String error;
//     private final Integer status;
//     private final JsonNode node;
// 
//     public JresErrorReplyException(String error, Integer status, JsonNode node) {
//         super(error);
//         this.error = error;
//         this.status = status;
//         this.node = node;
//     }
// 
//     @Override
//     public JsonNode node() {
//         return node;
//     }
// 
//     public String getError() {
//         return error;
//     }
// 
//     public Integer getStatus() {
//         return status;
//     }
// 
//     public <T> T asType(Class<T> klass) {
//         return ObjectMappers.fromJson(node, klass);
//     }
// 
//     public <T> T asType(TypeReference<T> typeReference) {
//         return ObjectMappers.fromJson(node, typeReference);
//     }
// }


import com.blacklocus.jres.request.JresJsonRequest;
import com.blacklocus.jres.response.common.JresAcknowledgedReply;
import com.blacklocus.jres.response.common.JresErrorReplyException;
import org.apache.http.client.methods.HttpPut;
/**
 * Copyright 2015 BlackLocus
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.blacklocus.jres.request.index;


/**
 * <a href="http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-create-index.html#indices-create-index">Create Index API</a>
 * <p>
 * Can throw {@link JresErrorReplyException}.
 */
public class JresCreateIndex extends JresJsonRequest<JresAcknowledgedReply> {

    private final String index;
    private final Object settings;

    public JresCreateIndex(String index) {
        this(index, null);
    }

    public JresCreateIndex(String index, String settingsJson) {
        super(JresAcknowledgedReply.class);
        this.index = index;
        this.settings = settingsJson;
    }

    @Override
// Path: jres-core/src/main/java/com/blacklocus/jres/request/JresJsonRequest.java
// public abstract class JresJsonRequest<REPLY extends JresReply> implements JresRequest<REPLY> {
// 
//     private final Class<REPLY> responseClass;
// 
//     protected JresJsonRequest(Class<REPLY> responseClass) {
//         this.responseClass = responseClass;
//     }
// 
//     @Override
//     public final Class<REPLY> getResponseClass() {
//         return responseClass;
//     }
// }
// 
// Path: jres-core/src/main/java/com/blacklocus/jres/response/common/JresAcknowledgedReply.java
// public class JresAcknowledgedReply extends JresJsonReply {
// 
//     private Boolean acknowledged;
// 
//     public Boolean getAcknowledged() {
//         return acknowledged;
//     }
// }
// 
// Path: jres-core/src/main/java/com/blacklocus/jres/response/common/JresErrorReplyException.java
// public class JresErrorReplyException extends RuntimeException implements JresReply {
// 
//     private final String error;
//     private final Integer status;
//     private final JsonNode node;
// 
//     public JresErrorReplyException(String error, Integer status, JsonNode node) {
//         super(error);
//         this.error = error;
//         this.status = status;
//         this.node = node;
//     }
// 
//     @Override
//     public JsonNode node() {
//         return node;
//     }
// 
//     public String getError() {
//         return error;
//     }
// 
//     public Integer getStatus() {
//         return status;
//     }
// 
//     public <T> T asType(Class<T> klass) {
//         return ObjectMappers.fromJson(node, klass);
//     }
// 
//     public <T> T asType(TypeReference<T> typeReference) {
//         return ObjectMappers.fromJson(node, typeReference);
//     }
// }


// Path: jres-core/src/main/java/com/blacklocus/jres/request/index/JresCreateIndex.java
import com.blacklocus.jres.request.JresJsonRequest;
import com.blacklocus.jres.response.common.JresAcknowledgedReply;
import com.blacklocus.jres.response.common.JresErrorReplyException;
import org.apache.http.client.methods.HttpPut;

/**
 * Copyright 2015 BlackLocus
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.blacklocus.jres.request.index;


/**
 * <a href="http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-create-index.html#indices-create-index">Create Index API</a>
 * <p>
 * Can throw {@link JresErrorReplyException}.
 */
public class JresCreateIndex extends JresJsonRequest<JresAcknowledgedReply> {

    private final String index;
    private final Object settings;

    public JresCreateIndex(String index) {
        this(index, null);
    }

    public JresCreateIndex(String index, String settingsJson) {
        super(JresAcknowledgedReply.class);
        this.index = index;
        this.settings = settingsJson;
    }

    @Override
    public String getHttpMethod() {