// 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"
)

// PostFleetupdateReader is a Reader for the PostFleetupdate structure.
type PostFleetupdateReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostFleetupdateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPostFleetupdateOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewPostFleetupdateBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewPostFleetupdateUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewPostFleetupdateServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /fleetupdate] PostFleetupdate", response, response.Code())
	}
}

// NewPostFleetupdateOK creates a PostFleetupdateOK with default headers values
func NewPostFleetupdateOK() *PostFleetupdateOK {
	return &PostFleetupdateOK{}
}

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

Created car updates result
*/
type PostFleetupdateOK struct {
	Payload *models.CommonJSONDBQueryResult
}

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

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

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

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

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

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

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

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

func (o *PostFleetupdateOK) GetPayload() *models.CommonJSONDBQueryResult {
	return o.Payload
}

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

	o.Payload = new(models.CommonJSONDBQueryResult)

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

	return nil
}

// NewPostFleetupdateBadRequest creates a PostFleetupdateBadRequest with default headers values
func NewPostFleetupdateBadRequest() *PostFleetupdateBadRequest {
	return &PostFleetupdateBadRequest{}
}

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

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

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

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

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

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

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

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

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

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

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

func (o *PostFleetupdateBadRequest) 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
}

// NewPostFleetupdateUnauthorized creates a PostFleetupdateUnauthorized with default headers values
func NewPostFleetupdateUnauthorized() *PostFleetupdateUnauthorized {
	return &PostFleetupdateUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

func (o *PostFleetupdateUnauthorized) 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
}

// NewPostFleetupdateServiceUnavailable creates a PostFleetupdateServiceUnavailable with default headers values
func NewPostFleetupdateServiceUnavailable() *PostFleetupdateServiceUnavailable {
	return &PostFleetupdateServiceUnavailable{}
}

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

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

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

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

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

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

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

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

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

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

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

func (o *PostFleetupdateServiceUnavailable) 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
}
