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

// GetManifestSumsReader is a Reader for the GetManifestSums structure.
type GetManifestSumsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetManifestSumsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetManifestSumsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewGetManifestSumsBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewGetManifestSumsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewGetManifestSumsServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /manifest/sums] GetManifestSums", response, response.Code())
	}
}

// NewGetManifestSumsOK creates a GetManifestSumsOK with default headers values
func NewGetManifestSumsOK() *GetManifestSumsOK {
	return &GetManifestSumsOK{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewGetManifestSumsBadRequest creates a GetManifestSumsBadRequest with default headers values
func NewGetManifestSumsBadRequest() *GetManifestSumsBadRequest {
	return &GetManifestSumsBadRequest{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewGetManifestSumsUnauthorized creates a GetManifestSumsUnauthorized with default headers values
func NewGetManifestSumsUnauthorized() *GetManifestSumsUnauthorized {
	return &GetManifestSumsUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewGetManifestSumsServiceUnavailable creates a GetManifestSumsServiceUnavailable with default headers values
func NewGetManifestSumsServiceUnavailable() *GetManifestSumsServiceUnavailable {
	return &GetManifestSumsServiceUnavailable{}
}

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

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

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

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

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

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

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

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

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

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

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

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