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

// PostManifestReader is a Reader for the PostManifest structure.
type PostManifestReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostManifestReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPostManifestOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewPostManifestBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewPostManifestUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewPostManifestServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /manifest] PostManifest", response, response.Code())
	}
}

// NewPostManifestOK creates a PostManifestOK with default headers values
func NewPostManifestOK() *PostManifestOK {
	return &PostManifestOK{}
}

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

OK
*/
type PostManifestOK struct {
	Payload *models.CommonCreateUpdateManifest
}

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

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

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

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

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

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

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

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

func (o *PostManifestOK) GetPayload() *models.CommonCreateUpdateManifest {
	return o.Payload
}

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

	o.Payload = new(models.CommonCreateUpdateManifest)

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

	return nil
}

// NewPostManifestBadRequest creates a PostManifestBadRequest with default headers values
func NewPostManifestBadRequest() *PostManifestBadRequest {
	return &PostManifestBadRequest{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPostManifestUnauthorized creates a PostManifestUnauthorized with default headers values
func NewPostManifestUnauthorized() *PostManifestUnauthorized {
	return &PostManifestUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPostManifestServiceUnavailable creates a PostManifestServiceUnavailable with default headers values
func NewPostManifestServiceUnavailable() *PostManifestServiceUnavailable {
	return &PostManifestServiceUnavailable{}
}

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

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

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

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

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

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

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

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

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

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

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

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