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

// PutSupplierEmailReader is a Reader for the PutSupplierEmail structure.
type PutSupplierEmailReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PutSupplierEmailReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPutSupplierEmailOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewPutSupplierEmailBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewPutSupplierEmailUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewPutSupplierEmailServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[PUT /supplier/{email}] PutSupplierEmail", response, response.Code())
	}
}

// NewPutSupplierEmailOK creates a PutSupplierEmailOK with default headers values
func NewPutSupplierEmailOK() *PutSupplierEmailOK {
	return &PutSupplierEmailOK{}
}

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

OK
*/
type PutSupplierEmailOK struct {
	Payload *models.CommonSupplierAccount
}

// IsSuccess returns true when this put supplier email o k response has a 2xx status code
func (o *PutSupplierEmailOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this put supplier email o k response has a 3xx status code
func (o *PutSupplierEmailOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this put supplier email o k response has a 4xx status code
func (o *PutSupplierEmailOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this put supplier email o k response has a 5xx status code
func (o *PutSupplierEmailOK) IsServerError() bool {
	return false
}

// IsCode returns true when this put supplier email o k response a status code equal to that given
func (o *PutSupplierEmailOK) IsCode(code int) bool {
	return code == 200
}

// Code gets the status code for the put supplier email o k response
func (o *PutSupplierEmailOK) Code() int {
	return 200
}

func (o *PutSupplierEmailOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /supplier/{email}][%d] putSupplierEmailOK %s", 200, payload)
}

func (o *PutSupplierEmailOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /supplier/{email}][%d] putSupplierEmailOK %s", 200, payload)
}

func (o *PutSupplierEmailOK) GetPayload() *models.CommonSupplierAccount {
	return o.Payload
}

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

	o.Payload = new(models.CommonSupplierAccount)

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

	return nil
}

// NewPutSupplierEmailBadRequest creates a PutSupplierEmailBadRequest with default headers values
func NewPutSupplierEmailBadRequest() *PutSupplierEmailBadRequest {
	return &PutSupplierEmailBadRequest{}
}

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

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

// IsSuccess returns true when this put supplier email bad request response has a 2xx status code
func (o *PutSupplierEmailBadRequest) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this put supplier email bad request response has a 3xx status code
func (o *PutSupplierEmailBadRequest) IsRedirect() bool {
	return false
}

// IsClientError returns true when this put supplier email bad request response has a 4xx status code
func (o *PutSupplierEmailBadRequest) IsClientError() bool {
	return true
}

// IsServerError returns true when this put supplier email bad request response has a 5xx status code
func (o *PutSupplierEmailBadRequest) IsServerError() bool {
	return false
}

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

// Code gets the status code for the put supplier email bad request response
func (o *PutSupplierEmailBadRequest) Code() int {
	return 400
}

func (o *PutSupplierEmailBadRequest) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /supplier/{email}][%d] putSupplierEmailBadRequest %s", 400, payload)
}

func (o *PutSupplierEmailBadRequest) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /supplier/{email}][%d] putSupplierEmailBadRequest %s", 400, payload)
}

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

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

// NewPutSupplierEmailUnauthorized creates a PutSupplierEmailUnauthorized with default headers values
func NewPutSupplierEmailUnauthorized() *PutSupplierEmailUnauthorized {
	return &PutSupplierEmailUnauthorized{}
}

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

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

// IsSuccess returns true when this put supplier email unauthorized response has a 2xx status code
func (o *PutSupplierEmailUnauthorized) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this put supplier email unauthorized response has a 3xx status code
func (o *PutSupplierEmailUnauthorized) IsRedirect() bool {
	return false
}

// IsClientError returns true when this put supplier email unauthorized response has a 4xx status code
func (o *PutSupplierEmailUnauthorized) IsClientError() bool {
	return true
}

// IsServerError returns true when this put supplier email unauthorized response has a 5xx status code
func (o *PutSupplierEmailUnauthorized) IsServerError() bool {
	return false
}

// IsCode returns true when this put supplier email unauthorized response a status code equal to that given
func (o *PutSupplierEmailUnauthorized) IsCode(code int) bool {
	return code == 401
}

// Code gets the status code for the put supplier email unauthorized response
func (o *PutSupplierEmailUnauthorized) Code() int {
	return 401
}

func (o *PutSupplierEmailUnauthorized) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /supplier/{email}][%d] putSupplierEmailUnauthorized %s", 401, payload)
}

func (o *PutSupplierEmailUnauthorized) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /supplier/{email}][%d] putSupplierEmailUnauthorized %s", 401, payload)
}

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

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

// NewPutSupplierEmailServiceUnavailable creates a PutSupplierEmailServiceUnavailable with default headers values
func NewPutSupplierEmailServiceUnavailable() *PutSupplierEmailServiceUnavailable {
	return &PutSupplierEmailServiceUnavailable{}
}

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

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

// IsSuccess returns true when this put supplier email service unavailable response has a 2xx status code
func (o *PutSupplierEmailServiceUnavailable) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this put supplier email service unavailable response has a 3xx status code
func (o *PutSupplierEmailServiceUnavailable) IsRedirect() bool {
	return false
}

// IsClientError returns true when this put supplier email service unavailable response has a 4xx status code
func (o *PutSupplierEmailServiceUnavailable) IsClientError() bool {
	return false
}

// IsServerError returns true when this put supplier email service unavailable response has a 5xx status code
func (o *PutSupplierEmailServiceUnavailable) IsServerError() bool {
	return true
}

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

// Code gets the status code for the put supplier email service unavailable response
func (o *PutSupplierEmailServiceUnavailable) Code() int {
	return 503
}

func (o *PutSupplierEmailServiceUnavailable) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /supplier/{email}][%d] putSupplierEmailServiceUnavailable %s", 503, payload)
}

func (o *PutSupplierEmailServiceUnavailable) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /supplier/{email}][%d] putSupplierEmailServiceUnavailable %s", 503, payload)
}

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

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