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

// PostManifestfileReader is a Reader for the PostManifestfile structure.
type PostManifestfileReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostManifestfileReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPostManifestfileOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewPostManifestfileBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewPostManifestfileUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewPostManifestfileServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /manifestfile] PostManifestfile", response, response.Code())
	}
}

// NewPostManifestfileOK creates a PostManifestfileOK with default headers values
func NewPostManifestfileOK() *PostManifestfileOK {
	return &PostManifestfileOK{}
}

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

OK
*/
type PostManifestfileOK struct {
	Payload *models.CommonUpdateManifestFile
}

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

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

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

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

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

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

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

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

func (o *PostManifestfileOK) GetPayload() *models.CommonUpdateManifestFile {
	return o.Payload
}

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

	o.Payload = new(models.CommonUpdateManifestFile)

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

	return nil
}

// NewPostManifestfileBadRequest creates a PostManifestfileBadRequest with default headers values
func NewPostManifestfileBadRequest() *PostManifestfileBadRequest {
	return &PostManifestfileBadRequest{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPostManifestfileUnauthorized creates a PostManifestfileUnauthorized with default headers values
func NewPostManifestfileUnauthorized() *PostManifestfileUnauthorized {
	return &PostManifestfileUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPostManifestfileServiceUnavailable creates a PostManifestfileServiceUnavailable with default headers values
func NewPostManifestfileServiceUnavailable() *PostManifestfileServiceUnavailable {
	return &PostManifestfileServiceUnavailable{}
}

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

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

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

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

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

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

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

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

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

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

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

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