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

// PostManufactureCertsReader is a Reader for the PostManufactureCerts structure.
type PostManufactureCertsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostManufactureCertsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPostManufactureCertsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewPostManufactureCertsBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewPostManufactureCertsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewPostManufactureCertsServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /manufacture-certs] PostManufactureCerts", response, response.Code())
	}
}

// NewPostManufactureCertsOK creates a PostManufactureCertsOK with default headers values
func NewPostManufactureCertsOK() *PostManufactureCertsOK {
	return &PostManufactureCertsOK{}
}

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

Created public and private pems
*/
type PostManufactureCertsOK struct {
	Payload *models.CommonCertificate
}

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

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

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

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

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

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

func (o *PostManufactureCertsOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /manufacture-certs][%d] postManufactureCertsOK %s", 200, payload)
}

func (o *PostManufactureCertsOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /manufacture-certs][%d] postManufactureCertsOK %s", 200, payload)
}

func (o *PostManufactureCertsOK) GetPayload() *models.CommonCertificate {
	return o.Payload
}

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

	o.Payload = new(models.CommonCertificate)

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

	return nil
}

// NewPostManufactureCertsBadRequest creates a PostManufactureCertsBadRequest with default headers values
func NewPostManufactureCertsBadRequest() *PostManufactureCertsBadRequest {
	return &PostManufactureCertsBadRequest{}
}

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

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

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

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

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

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

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

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

func (o *PostManufactureCertsBadRequest) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /manufacture-certs][%d] postManufactureCertsBadRequest %s", 400, payload)
}

func (o *PostManufactureCertsBadRequest) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /manufacture-certs][%d] postManufactureCertsBadRequest %s", 400, payload)
}

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

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

// NewPostManufactureCertsUnauthorized creates a PostManufactureCertsUnauthorized with default headers values
func NewPostManufactureCertsUnauthorized() *PostManufactureCertsUnauthorized {
	return &PostManufactureCertsUnauthorized{}
}

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

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

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

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

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

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

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

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

func (o *PostManufactureCertsUnauthorized) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /manufacture-certs][%d] postManufactureCertsUnauthorized %s", 401, payload)
}

func (o *PostManufactureCertsUnauthorized) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /manufacture-certs][%d] postManufactureCertsUnauthorized %s", 401, payload)
}

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

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

// NewPostManufactureCertsServiceUnavailable creates a PostManufactureCertsServiceUnavailable with default headers values
func NewPostManufactureCertsServiceUnavailable() *PostManufactureCertsServiceUnavailable {
	return &PostManufactureCertsServiceUnavailable{}
}

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

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

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

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

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

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

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

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

func (o *PostManufactureCertsServiceUnavailable) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /manufacture-certs][%d] postManufactureCertsServiceUnavailable %s", 503, payload)
}

func (o *PostManufactureCertsServiceUnavailable) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /manufacture-certs][%d] postManufactureCertsServiceUnavailable %s", 503, payload)
}

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

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