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

// PostManifestSumsReader is a Reader for the PostManifestSums structure.
type PostManifestSumsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostManifestSumsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPostManifestSumsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewPostManifestSumsBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewPostManifestSumsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewPostManifestSumsServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /manifest/sums] PostManifestSums", response, response.Code())
	}
}

// NewPostManifestSumsOK creates a PostManifestSumsOK with default headers values
func NewPostManifestSumsOK() *PostManifestSumsOK {
	return &PostManifestSumsOK{}
}

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

OK
*/
type PostManifestSumsOK struct {
	Payload []*models.CommonSUMSVersion
}

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

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

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

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

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

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

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

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

func (o *PostManifestSumsOK) GetPayload() []*models.CommonSUMSVersion {
	return o.Payload
}

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

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

	return nil
}

// NewPostManifestSumsBadRequest creates a PostManifestSumsBadRequest with default headers values
func NewPostManifestSumsBadRequest() *PostManifestSumsBadRequest {
	return &PostManifestSumsBadRequest{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPostManifestSumsUnauthorized creates a PostManifestSumsUnauthorized with default headers values
func NewPostManifestSumsUnauthorized() *PostManifestSumsUnauthorized {
	return &PostManifestSumsUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewPostManifestSumsServiceUnavailable creates a PostManifestSumsServiceUnavailable with default headers values
func NewPostManifestSumsServiceUnavailable() *PostManifestSumsServiceUnavailable {
	return &PostManifestSumsServiceUnavailable{}
}

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

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

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

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

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

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

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

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

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

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

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

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