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

// PutCustomerOtaEmailsReader is a Reader for the PutCustomerOtaEmails structure.
type PutCustomerOtaEmailsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PutCustomerOtaEmailsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPutCustomerOtaEmailsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 400:
		result := NewPutCustomerOtaEmailsBadRequest()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 401:
		result := NewPutCustomerOtaEmailsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 503:
		result := NewPutCustomerOtaEmailsServiceUnavailable()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[PUT /customer_ota_emails] PutCustomerOtaEmails", response, response.Code())
	}
}

// NewPutCustomerOtaEmailsOK creates a PutCustomerOtaEmailsOK with default headers values
func NewPutCustomerOtaEmailsOK() *PutCustomerOtaEmailsOK {
	return &PutCustomerOtaEmailsOK{}
}

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

Customer Ota Emails
*/
type PutCustomerOtaEmailsOK struct {
	Payload map[string]bool
}

// IsSuccess returns true when this put customer ota emails o k response has a 2xx status code
func (o *PutCustomerOtaEmailsOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this put customer ota emails o k response has a 3xx status code
func (o *PutCustomerOtaEmailsOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this put customer ota emails o k response has a 4xx status code
func (o *PutCustomerOtaEmailsOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this put customer ota emails o k response has a 5xx status code
func (o *PutCustomerOtaEmailsOK) IsServerError() bool {
	return false
}

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

// Code gets the status code for the put customer ota emails o k response
func (o *PutCustomerOtaEmailsOK) Code() int {
	return 200
}

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

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

func (o *PutCustomerOtaEmailsOK) GetPayload() map[string]bool {
	return o.Payload
}

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

// NewPutCustomerOtaEmailsBadRequest creates a PutCustomerOtaEmailsBadRequest with default headers values
func NewPutCustomerOtaEmailsBadRequest() *PutCustomerOtaEmailsBadRequest {
	return &PutCustomerOtaEmailsBadRequest{}
}

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

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

// IsSuccess returns true when this put customer ota emails bad request response has a 2xx status code
func (o *PutCustomerOtaEmailsBadRequest) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this put customer ota emails bad request response has a 3xx status code
func (o *PutCustomerOtaEmailsBadRequest) IsRedirect() bool {
	return false
}

// IsClientError returns true when this put customer ota emails bad request response has a 4xx status code
func (o *PutCustomerOtaEmailsBadRequest) IsClientError() bool {
	return true
}

// IsServerError returns true when this put customer ota emails bad request response has a 5xx status code
func (o *PutCustomerOtaEmailsBadRequest) IsServerError() bool {
	return false
}

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

// Code gets the status code for the put customer ota emails bad request response
func (o *PutCustomerOtaEmailsBadRequest) Code() int {
	return 400
}

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

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

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

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

// NewPutCustomerOtaEmailsUnauthorized creates a PutCustomerOtaEmailsUnauthorized with default headers values
func NewPutCustomerOtaEmailsUnauthorized() *PutCustomerOtaEmailsUnauthorized {
	return &PutCustomerOtaEmailsUnauthorized{}
}

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

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

// IsSuccess returns true when this put customer ota emails unauthorized response has a 2xx status code
func (o *PutCustomerOtaEmailsUnauthorized) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this put customer ota emails unauthorized response has a 3xx status code
func (o *PutCustomerOtaEmailsUnauthorized) IsRedirect() bool {
	return false
}

// IsClientError returns true when this put customer ota emails unauthorized response has a 4xx status code
func (o *PutCustomerOtaEmailsUnauthorized) IsClientError() bool {
	return true
}

// IsServerError returns true when this put customer ota emails unauthorized response has a 5xx status code
func (o *PutCustomerOtaEmailsUnauthorized) IsServerError() bool {
	return false
}

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

// Code gets the status code for the put customer ota emails unauthorized response
func (o *PutCustomerOtaEmailsUnauthorized) Code() int {
	return 401
}

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

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

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

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

// NewPutCustomerOtaEmailsServiceUnavailable creates a PutCustomerOtaEmailsServiceUnavailable with default headers values
func NewPutCustomerOtaEmailsServiceUnavailable() *PutCustomerOtaEmailsServiceUnavailable {
	return &PutCustomerOtaEmailsServiceUnavailable{}
}

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

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

// IsSuccess returns true when this put customer ota emails service unavailable response has a 2xx status code
func (o *PutCustomerOtaEmailsServiceUnavailable) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this put customer ota emails service unavailable response has a 3xx status code
func (o *PutCustomerOtaEmailsServiceUnavailable) IsRedirect() bool {
	return false
}

// IsClientError returns true when this put customer ota emails service unavailable response has a 4xx status code
func (o *PutCustomerOtaEmailsServiceUnavailable) IsClientError() bool {
	return false
}

// IsServerError returns true when this put customer ota emails service unavailable response has a 5xx status code
func (o *PutCustomerOtaEmailsServiceUnavailable) IsServerError() bool {
	return true
}

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

// Code gets the status code for the put customer ota emails service unavailable response
func (o *PutCustomerOtaEmailsServiceUnavailable) Code() int {
	return 503
}

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

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

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

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