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

// GetManifestReader is a Reader for the GetManifest structure.
type GetManifestReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetManifestReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetManifestOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewGetManifestBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewGetManifestUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewGetManifestServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /manifest] GetManifest", response, response.Code())
	}
}

// NewGetManifestOK creates a GetManifestOK with default headers values
func NewGetManifestOK() *GetManifestOK {
	return &GetManifestOK{}
}

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

OK
*/
type GetManifestOK struct {
	Payload *models.CommonUpdateManifest
}

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

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

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

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

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

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

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

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

func (o *GetManifestOK) GetPayload() *models.CommonUpdateManifest {
	return o.Payload
}

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

	o.Payload = new(models.CommonUpdateManifest)

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

	return nil
}

// NewGetManifestBadRequest creates a GetManifestBadRequest with default headers values
func NewGetManifestBadRequest() *GetManifestBadRequest {
	return &GetManifestBadRequest{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewGetManifestUnauthorized creates a GetManifestUnauthorized with default headers values
func NewGetManifestUnauthorized() *GetManifestUnauthorized {
	return &GetManifestUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewGetManifestServiceUnavailable creates a GetManifestServiceUnavailable with default headers values
func NewGetManifestServiceUnavailable() *GetManifestServiceUnavailable {
	return &GetManifestServiceUnavailable{}
}

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

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

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

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

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

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

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

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

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

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

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

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