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

// PostManifestecuReader is a Reader for the PostManifestecu structure.
type PostManifestecuReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostManifestecuReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPostManifestecuOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewPostManifestecuBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewPostManifestecuUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewPostManifestecuServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /manifestecu] PostManifestecu", response, response.Code())
	}
}

// NewPostManifestecuOK creates a PostManifestecuOK with default headers values
func NewPostManifestecuOK() *PostManifestecuOK {
	return &PostManifestecuOK{}
}

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

OK
*/
type PostManifestecuOK struct {
	Payload *models.CommonUpdateManifestECU
}

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

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

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

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

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

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

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

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

func (o *PostManifestecuOK) GetPayload() *models.CommonUpdateManifestECU {
	return o.Payload
}

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

	o.Payload = new(models.CommonUpdateManifestECU)

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

	return nil
}

// NewPostManifestecuBadRequest creates a PostManifestecuBadRequest with default headers values
func NewPostManifestecuBadRequest() *PostManifestecuBadRequest {
	return &PostManifestecuBadRequest{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPostManifestecuUnauthorized creates a PostManifestecuUnauthorized with default headers values
func NewPostManifestecuUnauthorized() *PostManifestecuUnauthorized {
	return &PostManifestecuUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPostManifestecuServiceUnavailable creates a PostManifestecuServiceUnavailable with default headers values
func NewPostManifestecuServiceUnavailable() *PostManifestecuServiceUnavailable {
	return &PostManifestecuServiceUnavailable{}
}

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

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

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

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

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

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

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

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

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

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

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

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