/*
 * OpenAPI Petstore
 * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
 *
 * OpenAPI spec version: 1.0.0
 * 
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


package org.openapitools.client.api;

import com.google.gson.reflect.TypeToken;
import org.openapitools.client.model.Client;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import io.restassured.RestAssured;
import io.restassured.builder.RequestSpecBuilder;
import io.restassured.builder.ResponseSpecBuilder;
import io.restassured.http.Method;
import io.restassured.response.Response;
import io.swagger.annotations.*;

import java.lang.reflect.Type;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
import org.openapitools.client.JSON;

import static io.restassured.http.Method.*;

@Api(value = "FakeClassnameTags123")
public class FakeClassnameTags123Api {

    private RequestSpecBuilder reqSpec;

    private FakeClassnameTags123Api(RequestSpecBuilder reqSpec) {
        this.reqSpec = reqSpec;
    }

    public static FakeClassnameTags123Api fakeClassnameTags123(RequestSpecBuilder reqSpec) {
        return new FakeClassnameTags123Api(reqSpec);
    }


    @ApiOperation(value = "To test class name in snake case",
            notes = "To test class name in snake case",
            nickname = "testClassname",
            tags = { "fake_classname_tags 123#$%^" })
    @ApiResponses(value = { 
            @ApiResponse(code = 200, message = "successful operation")  })
    public TestClassnameOper testClassname() {
        return new TestClassnameOper(reqSpec);
    }

    /**
     * Customise request specification
     * @param consumer consumer
     * @return api
     */
    public FakeClassnameTags123Api reqSpec(Consumer<RequestSpecBuilder> consumer) {
        consumer.accept(reqSpec);
        return this;
    }

    /**
     * To test class name in snake case
     * To test class name in snake case
     *
     * @see #body client model (required)
     * return Client
     */
    public static class TestClassnameOper {

        public static final Method REQ_METHOD = PATCH;
        public static final String REQ_URI = "/fake_classname_test";

        private RequestSpecBuilder reqSpec;
        private ResponseSpecBuilder respSpec;

        public TestClassnameOper(RequestSpecBuilder reqSpec) {
            this.reqSpec = reqSpec;
            reqSpec.setContentType("application/json");
            reqSpec.setAccept("application/json");
            this.respSpec = new ResponseSpecBuilder();
        }

        /**
         * PATCH /fake_classname_test
         * @param handler handler
         * @param <T> type
         * @return type
         */
        public <T> T execute(Function<Response, T> handler) {
            return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI));
        }

        /**
         * PATCH /fake_classname_test
         * @param handler handler
         * @return Client
         */
        public Client executeAs(Function<Response, Response> handler) {
            Type type = new TypeToken<Client>(){}.getType();
            return execute(handler).as(type);
        }

         /**
         * @param body (Client) client model (required)
         * @return operation
         */
        public TestClassnameOper body(Client body) {
            reqSpec.setBody(body);
            return this;
        }

        /**
         * Customise request specification
         * @param consumer consumer
         * @return operation
         */
        public TestClassnameOper reqSpec(Consumer<RequestSpecBuilder> consumer) {
            consumer.accept(reqSpec);
            return this;
        }

        /**
         * Customise response specification
         * @param consumer consumer
         * @return operation
         */
        public TestClassnameOper respSpec(Consumer<ResponseSpecBuilder> consumer) {
            consumer.accept(respSpec);
            return this;
        }
    }
}
