func (r CancelTrainingResponse) StatusCode() int {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.StatusCode
	}
	return 0
}
StatusCode returns HTTPResponse.StatusCode
package trainings
import (
	"bytes"
	"context"
	"encoding/json"
	"fmt"
	"io"
	"io/ioutil"
	"net/http"
	"net/url"
	"strings"
	"github.com/deepmap/oapi-codegen/pkg/runtime"
)
type RequestEditorFn func(ctx context.Context, req *http.Request) error
type HttpRequestDoer interface {
	Do(req *http.Request) (*http.Response, error)
}
type Client struct {
	Server string
	Client HttpRequestDoer
	RequestEditor RequestEditorFn
}
type ClientOption func(*Client) error
func NewClient(server string, opts ...ClientOption) (*Client, error) {
	client := Client{
		Server: server,
	}
	for _, o := range opts {
		if err := o(&client); err != nil {
			return nil, err
		}
	}
	if !strings.HasSuffix(client.Server, "/") {
		client.Server += "/"
	}
	if client.Client == nil {
		client.Client = http.DefaultClient
	}
	return &client, nil
}
func WithHTTPClient(doer HttpRequestDoer) ClientOption {
	return func(c *Client) error {
		c.Client = doer
		return nil
	}
}
func WithRequestEditorFn(fn RequestEditorFn) ClientOption {
	return func(c *Client) error {
		c.RequestEditor = fn
		return nil
	}
}
type ClientInterface interface {
	GetTrainings(ctx context.Context) (*http.Response, error)
	CreateTrainingWithBody(ctx context.Context, contentType string, body io.Reader) (*http.Response, error)
	CreateTraining(ctx context.Context, body CreateTrainingJSONRequestBody) (*http.Response, error)
	CancelTraining(ctx context.Context, trainingUUID string) (*http.Response, error)
	ApproveRescheduleTraining(ctx context.Context, trainingUUID string) (*http.Response, error)
	RejectRescheduleTraining(ctx context.Context, trainingUUID string) (*http.Response, error)
	RequestRescheduleTrainingWithBody(ctx context.Context, trainingUUID string, contentType string, body io.Reader) (*http.Response, error)
	RequestRescheduleTraining(ctx context.Context, trainingUUID string, body RequestRescheduleTrainingJSONRequestBody) (*http.Response, error)
	RescheduleTrainingWithBody(ctx context.Context, trainingUUID string, contentType string, body io.Reader) (*http.Response, error)
	RescheduleTraining(ctx context.Context, trainingUUID string, body RescheduleTrainingJSONRequestBody) (*http.Response, error)
}
func (c *Client) GetTrainings(ctx context.Context) (*http.Response, error) {
	req, err := NewGetTrainingsRequest(c.Server)
	if err != nil {
		return nil, err
	}
	req = req.WithContext(ctx)
	if c.RequestEditor != nil {
		err = c.RequestEditor(ctx, req)
		if err != nil {
			return nil, err
		}
	}
	return c.Client.Do(req)
}
func (c *Client) CreateTrainingWithBody(ctx context.Context, contentType string, body io.Reader) (*http.Response, error) {
	req, err := NewCreateTrainingRequestWithBody(c.Server, contentType, body)
	if err != nil {
		return nil, err
	}
	req = req.WithContext(ctx)
	if c.RequestEditor != nil {
		err = c.RequestEditor(ctx, req)
		if err != nil {
			return nil, err
		}
	}
	return c.Client.Do(req)
}
func (c *Client) CreateTraining(ctx context.Context, body CreateTrainingJSONRequestBody) (*http.Response, error) {
	req, err := NewCreateTrainingRequest(c.Server, body)
	if err != nil {
		return nil, err
	}
	req = req.WithContext(ctx)
	if c.RequestEditor != nil {
		err = c.RequestEditor(ctx, req)
		if err != nil {
			return nil, err
		}
	}
	return c.Client.Do(req)
}
func (c *Client) CancelTraining(ctx context.Context, trainingUUID string) (*http.Response, error) {
	req, err := NewCancelTrainingRequest(c.Server, trainingUUID)
	if err != nil {
		return nil, err
	}
	req = req.WithContext(ctx)
	if c.RequestEditor != nil {
		err = c.RequestEditor(ctx, req)
		if err != nil {
			return nil, err
		}
	}
	return c.Client.Do(req)
}
func (c *Client) ApproveRescheduleTraining(ctx context.Context, trainingUUID string) (*http.Response, error) {
	req, err := NewApproveRescheduleTrainingRequest(c.Server, trainingUUID)
	if err != nil {
		return nil, err
	}
	req = req.WithContext(ctx)
	if c.RequestEditor != nil {
		err = c.RequestEditor(ctx, req)
		if err != nil {
			return nil, err
		}
	}
	return c.Client.Do(req)
}
func (c *Client) RejectRescheduleTraining(ctx context.Context, trainingUUID string) (*http.Response, error) {
	req, err := NewRejectRescheduleTrainingRequest(c.Server, trainingUUID)
	if err != nil {
		return nil, err
	}
	req = req.WithContext(ctx)
	if c.RequestEditor != nil {
		err = c.RequestEditor(ctx, req)
		if err != nil {
			return nil, err
		}
	}
	return c.Client.Do(req)
}
func (c *Client) RequestRescheduleTrainingWithBody(ctx context.Context, trainingUUID string, contentType string, body io.Reader) (*http.Response, error) {
	req, err := NewRequestRescheduleTrainingRequestWithBody(c.Server, trainingUUID, contentType, body)
	if err != nil {
		return nil, err
	}
	req = req.WithContext(ctx)
	if c.RequestEditor != nil {
		err = c.RequestEditor(ctx, req)
		if err != nil {
			return nil, err
		}
	}
	return c.Client.Do(req)
}
func (c *Client) RequestRescheduleTraining(ctx context.Context, trainingUUID string, body RequestRescheduleTrainingJSONRequestBody) (*http.Response, error) {
	req, err := NewRequestRescheduleTrainingRequest(c.Server, trainingUUID, body)
	if err != nil {
		return nil, err
	}
	req = req.WithContext(ctx)
	if c.RequestEditor != nil {
		err = c.RequestEditor(ctx, req)
		if err != nil {
			return nil, err
		}
	}
	return c.Client.Do(req)
}
func (c *Client) RescheduleTrainingWithBody(ctx context.Context, trainingUUID string, contentType string, body io.Reader) (*http.Response, error) {
	req, err := NewRescheduleTrainingRequestWithBody(c.Server, trainingUUID, contentType, body)
	if err != nil {
		return nil, err
	}
	req = req.WithContext(ctx)
	if c.RequestEditor != nil {
		err = c.RequestEditor(ctx, req)
		if err != nil {
			return nil, err
		}
	}
	return c.Client.Do(req)
}
func (c *Client) RescheduleTraining(ctx context.Context, trainingUUID string, body RescheduleTrainingJSONRequestBody) (*http.Response, error) {
	req, err := NewRescheduleTrainingRequest(c.Server, trainingUUID, body)
	if err != nil {
		return nil, err
	}
	req = req.WithContext(ctx)
	if c.RequestEditor != nil {
		err = c.RequestEditor(ctx, req)
		if err != nil {
			return nil, err
		}
	}
	return c.Client.Do(req)
}
func NewGetTrainingsRequest(server string) (*http.Request, error) {
	var err error
	queryUrl, err := url.Parse(server)
	if err != nil {
		return nil, err
	}
	basePath := fmt.Sprintf("/trainings")
	if basePath[0] == '/' {
		basePath = basePath[1:]
	}
	queryUrl, err = queryUrl.Parse(basePath)
	if err != nil {
		return nil, err
	}
	req, err := http.NewRequest("GET", queryUrl.String(), nil)
	if err != nil {
		return nil, err
	}
	return req, nil
}
func NewCreateTrainingRequest(server string, body CreateTrainingJSONRequestBody) (*http.Request, error) {
	var bodyReader io.Reader
	buf, err := json.Marshal(body)
	if err != nil {
		return nil, err
	}
	bodyReader = bytes.NewReader(buf)
	return NewCreateTrainingRequestWithBody(server, "application/json", bodyReader)
}
func NewCreateTrainingRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) {
	var err error
	queryUrl, err := url.Parse(server)
	if err != nil {
		return nil, err
	}
	basePath := fmt.Sprintf("/trainings")
	if basePath[0] == '/' {
		basePath = basePath[1:]
	}
	queryUrl, err = queryUrl.Parse(basePath)
	if err != nil {
		return nil, err
	}
	req, err := http.NewRequest("POST", queryUrl.String(), body)
	if err != nil {
		return nil, err
	}
	req.Header.Add("Content-Type", contentType)
	return req, nil
}
func NewCancelTrainingRequest(server string, trainingUUID string) (*http.Request, error) {
	var err error
	var pathParam0 string
	pathParam0, err = runtime.StyleParam("simple", false, "trainingUUID", trainingUUID)
	if err != nil {
		return nil, err
	}
	queryUrl, err := url.Parse(server)
	if err != nil {
		return nil, err
	}
	basePath := fmt.Sprintf("/trainings/%s", pathParam0)
	if basePath[0] == '/' {
		basePath = basePath[1:]
	}
	queryUrl, err = queryUrl.Parse(basePath)
	if err != nil {
		return nil, err
	}
	req, err := http.NewRequest("DELETE", queryUrl.String(), nil)
	if err != nil {
		return nil, err
	}
	return req, nil
}
func NewApproveRescheduleTrainingRequest(server string, trainingUUID string) (*http.Request, error) {
	var err error
	var pathParam0 string
	pathParam0, err = runtime.StyleParam("simple", false, "trainingUUID", trainingUUID)
	if err != nil {
		return nil, err
	}
	queryUrl, err := url.Parse(server)
	if err != nil {
		return nil, err
	}
	basePath := fmt.Sprintf("/trainings/%s/approve-reschedule", pathParam0)
	if basePath[0] == '/' {
		basePath = basePath[1:]
	}
	queryUrl, err = queryUrl.Parse(basePath)
	if err != nil {
		return nil, err
	}
	req, err := http.NewRequest("PUT", queryUrl.String(), nil)
	if err != nil {
		return nil, err
	}
	return req, nil
}
func NewRejectRescheduleTrainingRequest(server string, trainingUUID string) (*http.Request, error) {
	var err error
	var pathParam0 string
	pathParam0, err = runtime.StyleParam("simple", false, "trainingUUID", trainingUUID)
	if err != nil {
		return nil, err
	}
	queryUrl, err := url.Parse(server)
	if err != nil {
		return nil, err
	}
	basePath := fmt.Sprintf("/trainings/%s/reject-reschedule", pathParam0)
	if basePath[0] == '/' {
		basePath = basePath[1:]
	}
	queryUrl, err = queryUrl.Parse(basePath)
	if err != nil {
		return nil, err
	}
	req, err := http.NewRequest("PUT", queryUrl.String(), nil)
	if err != nil {
		return nil, err
	}
	return req, nil
}
func NewRequestRescheduleTrainingRequest(server string, trainingUUID string, body RequestRescheduleTrainingJSONRequestBody) (*http.Request, error) {
	var bodyReader io.Reader
	buf, err := json.Marshal(body)
	if err != nil {
		return nil, err
	}
	bodyReader = bytes.NewReader(buf)
	return NewRequestRescheduleTrainingRequestWithBody(server, trainingUUID, "application/json", bodyReader)
}
func NewRequestRescheduleTrainingRequestWithBody(server string, trainingUUID string, contentType string, body io.Reader) (*http.Request, error) {
	var err error
	var pathParam0 string
	pathParam0, err = runtime.StyleParam("simple", false, "trainingUUID", trainingUUID)
	if err != nil {
		return nil, err
	}
	queryUrl, err := url.Parse(server)
	if err != nil {
		return nil, err
	}
	basePath := fmt.Sprintf("/trainings/%s/request-reschedule", pathParam0)
	if basePath[0] == '/' {
		basePath = basePath[1:]
	}
	queryUrl, err = queryUrl.Parse(basePath)
	if err != nil {
		return nil, err
	}
	req, err := http.NewRequest("PUT", queryUrl.String(), body)
	if err != nil {
		return nil, err
	}
	req.Header.Add("Content-Type", contentType)
	return req, nil
}
func NewRescheduleTrainingRequest(server string, trainingUUID string, body RescheduleTrainingJSONRequestBody) (*http.Request, error) {
	var bodyReader io.Reader
	buf, err := json.Marshal(body)
	if err != nil {
		return nil, err
	}
	bodyReader = bytes.NewReader(buf)
	return NewRescheduleTrainingRequestWithBody(server, trainingUUID, "application/json", bodyReader)
}
func NewRescheduleTrainingRequestWithBody(server string, trainingUUID string, contentType string, body io.Reader) (*http.Request, error) {
	var err error
	var pathParam0 string
	pathParam0, err = runtime.StyleParam("simple", false, "trainingUUID", trainingUUID)
	if err != nil {
		return nil, err
	}
	queryUrl, err := url.Parse(server)
	if err != nil {
		return nil, err
	}
	basePath := fmt.Sprintf("/trainings/%s/reschedule", pathParam0)
	if basePath[0] == '/' {
		basePath = basePath[1:]
	}
	queryUrl, err = queryUrl.Parse(basePath)
	if err != nil {
		return nil, err
	}
	req, err := http.NewRequest("PUT", queryUrl.String(), body)
	if err != nil {
		return nil, err
	}
	req.Header.Add("Content-Type", contentType)
	return req, nil
}
type ClientWithResponses struct {
	ClientInterface
}
func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error) {
	client, err := NewClient(server, opts...)
	if err != nil {
		return nil, err
	}
	return &ClientWithResponses{client}, nil
}
func WithBaseURL(baseURL string) ClientOption {
	return func(c *Client) error {
		newBaseURL, err := url.Parse(baseURL)
		if err != nil {
			return err
		}
		c.Server = newBaseURL.String()
		return nil
	}
}
type ClientWithResponsesInterface interface {
	GetTrainingsWithResponse(ctx context.Context) (*GetTrainingsResponse, error)
	CreateTrainingWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader) (*CreateTrainingResponse, error)
	CreateTrainingWithResponse(ctx context.Context, body CreateTrainingJSONRequestBody) (*CreateTrainingResponse, error)
	CancelTrainingWithResponse(ctx context.Context, trainingUUID string) (*CancelTrainingResponse, error)
	ApproveRescheduleTrainingWithResponse(ctx context.Context, trainingUUID string) (*ApproveRescheduleTrainingResponse, error)
	RejectRescheduleTrainingWithResponse(ctx context.Context, trainingUUID string) (*RejectRescheduleTrainingResponse, error)
	RequestRescheduleTrainingWithBodyWithResponse(ctx context.Context, trainingUUID string, contentType string, body io.Reader) (*RequestRescheduleTrainingResponse, error)
	RequestRescheduleTrainingWithResponse(ctx context.Context, trainingUUID string, body RequestRescheduleTrainingJSONRequestBody) (*RequestRescheduleTrainingResponse, error)
	RescheduleTrainingWithBodyWithResponse(ctx context.Context, trainingUUID string, contentType string, body io.Reader) (*RescheduleTrainingResponse, error)
	RescheduleTrainingWithResponse(ctx context.Context, trainingUUID string, body RescheduleTrainingJSONRequestBody) (*RescheduleTrainingResponse, error)
}
type GetTrainingsResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *Trainings
	JSONDefault  *Error
}
func (r GetTrainingsResponse) Status() string {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.Status
	}
	return http.StatusText(0)
}
func (r GetTrainingsResponse) StatusCode() int {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.StatusCode
	}
	return 0
}
type CreateTrainingResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSONDefault  *Error
}
func (r CreateTrainingResponse) Status() string {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.Status
	}
	return http.StatusText(0)
}
func (r CreateTrainingResponse) StatusCode() int {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.StatusCode
	}
	return 0
}
type CancelTrainingResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSONDefault  *Error
}
func (r CancelTrainingResponse) Status() string {
	if r.HTTPResponse != nil {
		return r.HTTPResponse.Status
	}
	return http.StatusText(0)
}