// Code generated by go-swagger; DO NOT EDIT.

package operations

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"encoding/json"
	"fmt"
	"io"

	"github.com/go-openapi/runtime"
	"github.com/go-openapi/strfmt"

	"github.com/fiskerinc/cloud-services/pkg/ota_api/models"
)

// PostFleetReader is a Reader for the PostFleet structure.
type PostFleetReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostFleetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPostFleetOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewPostFleetBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewPostFleetUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewPostFleetServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /fleet] PostFleet", response, response.Code())
	}
}

// NewPostFleetOK creates a PostFleetOK with default headers values
func NewPostFleetOK() *PostFleetOK {
	return &PostFleetOK{}
}

/*
PostFleetOK describes a response with status code 200, with default header values.

OK
*/
type PostFleetOK struct {
	Payload *models.HandlersFleetRequest
}

// IsSuccess returns true when this post fleet o k response has a 2xx status code
func (o *PostFleetOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this post fleet o k response has a 3xx status code
func (o *PostFleetOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this post fleet o k response has a 4xx status code
func (o *PostFleetOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this post fleet o k response has a 5xx status code
func (o *PostFleetOK) IsServerError() bool {
	return false
}

// IsCode returns true when this post fleet o k response a status code equal to that given
func (o *PostFleetOK) IsCode(code int) bool {
	return code == 200
}

// Code gets the status code for the post fleet o k response
func (o *PostFleetOK) Code() int {
	return 200
}

func (o *PostFleetOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /fleet][%d] postFleetOK %s", 200, payload)
}

func (o *PostFleetOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /fleet][%d] postFleetOK %s", 200, payload)
}

func (o *PostFleetOK) GetPayload() *models.HandlersFleetRequest {
	return o.Payload
}

func (o *PostFleetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(models.HandlersFleetRequest)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
		return err
	}

	return nil
}

// NewPostFleetBadRequest creates a PostFleetBadRequest with default headers values
func NewPostFleetBadRequest() *PostFleetBadRequest {
	return &PostFleetBadRequest{}
}

/*
PostFleetBadRequest describes a response with status code 400, with default header values.

Bad request
*/
type PostFleetBadRequest struct {
	Payload *models.CommonJSONError
}

// IsSuccess returns true when this post fleet bad request response has a 2xx status code
func (o *PostFleetBadRequest) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this post fleet bad request response has a 3xx status code
func (o *PostFleetBadRequest) IsRedirect() bool {
	return false
}

// IsClientError returns true when this post fleet bad request response has a 4xx status code
func (o *PostFleetBadRequest) IsClientError() bool {
	return true
}

// IsServerError returns true when this post fleet bad request response has a 5xx status code
func (o *PostFleetBadRequest) IsServerError() bool {
	return false
}

// IsCode returns true when this post fleet bad request response a status code equal to that given
func (o *PostFleetBadRequest) IsCode(code int) bool {
	return code == 400
}

// Code gets the status code for the post fleet bad request response
func (o *PostFleetBadRequest) Code() int {
	return 400
}

func (o *PostFleetBadRequest) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /fleet][%d] postFleetBadRequest %s", 400, payload)
}

func (o *PostFleetBadRequest) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /fleet][%d] postFleetBadRequest %s", 400, payload)
}

func (o *PostFleetBadRequest) GetPayload() *models.CommonJSONError {
	return o.Payload
}

func (o *PostFleetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(models.CommonJSONError)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
		return err
	}

	return nil
}

// NewPostFleetUnauthorized creates a PostFleetUnauthorized with default headers values
func NewPostFleetUnauthorized() *PostFleetUnauthorized {
	return &PostFleetUnauthorized{}
}

/*
PostFleetUnauthorized describes a response with status code 401, with default header values.

Unauthorized
*/
type PostFleetUnauthorized struct {
	Payload *models.CommonJSONError
}

// IsSuccess returns true when this post fleet unauthorized response has a 2xx status code
func (o *PostFleetUnauthorized) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this post fleet unauthorized response has a 3xx status code
func (o *PostFleetUnauthorized) IsRedirect() bool {
	return false
}

// IsClientError returns true when this post fleet unauthorized response has a 4xx status code
func (o *PostFleetUnauthorized) IsClientError() bool {
	return true
}

// IsServerError returns true when this post fleet unauthorized response has a 5xx status code
func (o *PostFleetUnauthorized) IsServerError() bool {
	return false
}

// IsCode returns true when this post fleet unauthorized response a status code equal to that given
func (o *PostFleetUnauthorized) IsCode(code int) bool {
	return code == 401
}

// Code gets the status code for the post fleet unauthorized response
func (o *PostFleetUnauthorized) Code() int {
	return 401
}

func (o *PostFleetUnauthorized) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /fleet][%d] postFleetUnauthorized %s", 401, payload)
}

func (o *PostFleetUnauthorized) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /fleet][%d] postFleetUnauthorized %s", 401, payload)
}

func (o *PostFleetUnauthorized) GetPayload() *models.CommonJSONError {
	return o.Payload
}

func (o *PostFleetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(models.CommonJSONError)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
		return err
	}

	return nil
}

// NewPostFleetServiceUnavailable creates a PostFleetServiceUnavailable with default headers values
func NewPostFleetServiceUnavailable() *PostFleetServiceUnavailable {
	return &PostFleetServiceUnavailable{}
}

/*
PostFleetServiceUnavailable describes a response with status code 503, with default header values.

Service unavailable
*/
type PostFleetServiceUnavailable struct {
	Payload *models.CommonJSONError
}

// IsSuccess returns true when this post fleet service unavailable response has a 2xx status code
func (o *PostFleetServiceUnavailable) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this post fleet service unavailable response has a 3xx status code
func (o *PostFleetServiceUnavailable) IsRedirect() bool {
	return false
}

// IsClientError returns true when this post fleet service unavailable response has a 4xx status code
func (o *PostFleetServiceUnavailable) IsClientError() bool {
	return false
}

// IsServerError returns true when this post fleet service unavailable response has a 5xx status code
func (o *PostFleetServiceUnavailable) IsServerError() bool {
	return true
}

// IsCode returns true when this post fleet service unavailable response a status code equal to that given
func (o *PostFleetServiceUnavailable) IsCode(code int) bool {
	return code == 503
}

// Code gets the status code for the post fleet service unavailable response
func (o *PostFleetServiceUnavailable) Code() int {
	return 503
}

func (o *PostFleetServiceUnavailable) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /fleet][%d] postFleetServiceUnavailable %s", 503, payload)
}

func (o *PostFleetServiceUnavailable) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /fleet][%d] postFleetServiceUnavailable %s", 503, payload)
}

func (o *PostFleetServiceUnavailable) GetPayload() *models.CommonJSONError {
	return o.Payload
}

func (o *PostFleetServiceUnavailable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(models.CommonJSONError)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
		return err
	}

	return nil
}
