// Code generated by go-swagger; DO NOT EDIT.

// (c) 2012-2020 by Taxnexus, Inc.
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed

package assets

import (
	"encoding/json"
	stderrors "errors"
	"fmt"
	"io"

	"code.tnxs.net/vernonkeenan/lib/api/crm/crm_models"
	"github.com/go-openapi/runtime"
	"github.com/go-openapi/strfmt"
)

// PutAssetReader is a Reader for the PutAsset structure.
type PutAssetReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PutAssetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewPutAssetOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPutAssetUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPutAssetForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPutAssetNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 409:
		result := NewPutAssetConflict()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPutAssetUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPutAssetInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[PUT /assets] putAsset", response, response.Code())
	}
}

// NewPutAssetOK creates a PutAssetOK with default headers values
func NewPutAssetOK() *PutAssetOK {
	return &PutAssetOK{}
}

// PutAssetOK describes a response with status code 200, with default header values.
//
// Response with Asset objects with Contacts
type PutAssetOK struct {
	AccessControlAllowOrigin string
	CacheControl             string

	Payload *crm_models.AssetResponse
}

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

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

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

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

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

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

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

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

func (o *PutAssetOK) GetPayload() *crm_models.AssetResponse {
	return o.Payload
}

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

	// hydrates response header Access-Control-Allow-Origin
	hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")

	if hdrAccessControlAllowOrigin != "" {
		o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
	}

	// hydrates response header Cache-Control
	hdrCacheControl := response.GetHeader("Cache-Control")

	if hdrCacheControl != "" {
		o.CacheControl = hdrCacheControl
	}

	o.Payload = new(crm_models.AssetResponse)

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

	return nil
}

// NewPutAssetUnauthorized creates a PutAssetUnauthorized with default headers values
func NewPutAssetUnauthorized() *PutAssetUnauthorized {
	return &PutAssetUnauthorized{}
}

// PutAssetUnauthorized describes a response with status code 401, with default header values.
//
// Access unauthorized, invalid API-KEY was used
type PutAssetUnauthorized struct {
	AccessControlAllowOrigin string

	Payload *crm_models.Error
}

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

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

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

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

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

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

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

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

func (o *PutAssetUnauthorized) GetPayload() *crm_models.Error {
	return o.Payload
}

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

	// hydrates response header Access-Control-Allow-Origin
	hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")

	if hdrAccessControlAllowOrigin != "" {
		o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
	}

	o.Payload = new(crm_models.Error)

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

	return nil
}

// NewPutAssetForbidden creates a PutAssetForbidden with default headers values
func NewPutAssetForbidden() *PutAssetForbidden {
	return &PutAssetForbidden{}
}

// PutAssetForbidden describes a response with status code 403, with default header values.
//
// Access forbidden, account lacks access
type PutAssetForbidden struct {
	AccessControlAllowOrigin string

	Payload *crm_models.Error
}

// IsSuccess returns true when this put asset forbidden response has a 2xx status code
func (o *PutAssetForbidden) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this put asset forbidden response has a 3xx status code
func (o *PutAssetForbidden) IsRedirect() bool {
	return false
}

// IsClientError returns true when this put asset forbidden response has a 4xx status code
func (o *PutAssetForbidden) IsClientError() bool {
	return true
}

// IsServerError returns true when this put asset forbidden response has a 5xx status code
func (o *PutAssetForbidden) IsServerError() bool {
	return false
}

// IsCode returns true when this put asset forbidden response a status code equal to that given
func (o *PutAssetForbidden) IsCode(code int) bool {
	return code == 403
}

// Code gets the status code for the put asset forbidden response
func (o *PutAssetForbidden) Code() int {
	return 403
}

func (o *PutAssetForbidden) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /assets][%d] putAssetForbidden %s", 403, payload)
}

func (o *PutAssetForbidden) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /assets][%d] putAssetForbidden %s", 403, payload)
}

func (o *PutAssetForbidden) GetPayload() *crm_models.Error {
	return o.Payload
}

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

	// hydrates response header Access-Control-Allow-Origin
	hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")

	if hdrAccessControlAllowOrigin != "" {
		o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
	}

	o.Payload = new(crm_models.Error)

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

	return nil
}

// NewPutAssetNotFound creates a PutAssetNotFound with default headers values
func NewPutAssetNotFound() *PutAssetNotFound {
	return &PutAssetNotFound{}
}

// PutAssetNotFound describes a response with status code 404, with default header values.
//
// Resource was not found
type PutAssetNotFound struct {
	AccessControlAllowOrigin string

	Payload *crm_models.Error
}

// IsSuccess returns true when this put asset not found response has a 2xx status code
func (o *PutAssetNotFound) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this put asset not found response has a 3xx status code
func (o *PutAssetNotFound) IsRedirect() bool {
	return false
}

// IsClientError returns true when this put asset not found response has a 4xx status code
func (o *PutAssetNotFound) IsClientError() bool {
	return true
}

// IsServerError returns true when this put asset not found response has a 5xx status code
func (o *PutAssetNotFound) IsServerError() bool {
	return false
}

// IsCode returns true when this put asset not found response a status code equal to that given
func (o *PutAssetNotFound) IsCode(code int) bool {
	return code == 404
}

// Code gets the status code for the put asset not found response
func (o *PutAssetNotFound) Code() int {
	return 404
}

func (o *PutAssetNotFound) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /assets][%d] putAssetNotFound %s", 404, payload)
}

func (o *PutAssetNotFound) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /assets][%d] putAssetNotFound %s", 404, payload)
}

func (o *PutAssetNotFound) GetPayload() *crm_models.Error {
	return o.Payload
}

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

	// hydrates response header Access-Control-Allow-Origin
	hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")

	if hdrAccessControlAllowOrigin != "" {
		o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
	}

	o.Payload = new(crm_models.Error)

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

	return nil
}

// NewPutAssetConflict creates a PutAssetConflict with default headers values
func NewPutAssetConflict() *PutAssetConflict {
	return &PutAssetConflict{}
}

// PutAssetConflict describes a response with status code 409, with default header values.
//
// Conflict
type PutAssetConflict struct {
	AccessControlAllowOrigin string

	Payload *crm_models.Error
}

// IsSuccess returns true when this put asset conflict response has a 2xx status code
func (o *PutAssetConflict) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this put asset conflict response has a 3xx status code
func (o *PutAssetConflict) IsRedirect() bool {
	return false
}

// IsClientError returns true when this put asset conflict response has a 4xx status code
func (o *PutAssetConflict) IsClientError() bool {
	return true
}

// IsServerError returns true when this put asset conflict response has a 5xx status code
func (o *PutAssetConflict) IsServerError() bool {
	return false
}

// IsCode returns true when this put asset conflict response a status code equal to that given
func (o *PutAssetConflict) IsCode(code int) bool {
	return code == 409
}

// Code gets the status code for the put asset conflict response
func (o *PutAssetConflict) Code() int {
	return 409
}

func (o *PutAssetConflict) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /assets][%d] putAssetConflict %s", 409, payload)
}

func (o *PutAssetConflict) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /assets][%d] putAssetConflict %s", 409, payload)
}

func (o *PutAssetConflict) GetPayload() *crm_models.Error {
	return o.Payload
}

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

	// hydrates response header Access-Control-Allow-Origin
	hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")

	if hdrAccessControlAllowOrigin != "" {
		o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
	}

	o.Payload = new(crm_models.Error)

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

	return nil
}

// NewPutAssetUnprocessableEntity creates a PutAssetUnprocessableEntity with default headers values
func NewPutAssetUnprocessableEntity() *PutAssetUnprocessableEntity {
	return &PutAssetUnprocessableEntity{}
}

// PutAssetUnprocessableEntity describes a response with status code 422, with default header values.
//
// Unprocessable Entity, likely a bad parameter
type PutAssetUnprocessableEntity struct {
	AccessControlAllowOrigin string

	Payload *crm_models.Error
}

// IsSuccess returns true when this put asset unprocessable entity response has a 2xx status code
func (o *PutAssetUnprocessableEntity) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this put asset unprocessable entity response has a 3xx status code
func (o *PutAssetUnprocessableEntity) IsRedirect() bool {
	return false
}

// IsClientError returns true when this put asset unprocessable entity response has a 4xx status code
func (o *PutAssetUnprocessableEntity) IsClientError() bool {
	return true
}

// IsServerError returns true when this put asset unprocessable entity response has a 5xx status code
func (o *PutAssetUnprocessableEntity) IsServerError() bool {
	return false
}

// IsCode returns true when this put asset unprocessable entity response a status code equal to that given
func (o *PutAssetUnprocessableEntity) IsCode(code int) bool {
	return code == 422
}

// Code gets the status code for the put asset unprocessable entity response
func (o *PutAssetUnprocessableEntity) Code() int {
	return 422
}

func (o *PutAssetUnprocessableEntity) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /assets][%d] putAssetUnprocessableEntity %s", 422, payload)
}

func (o *PutAssetUnprocessableEntity) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /assets][%d] putAssetUnprocessableEntity %s", 422, payload)
}

func (o *PutAssetUnprocessableEntity) GetPayload() *crm_models.Error {
	return o.Payload
}

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

	// hydrates response header Access-Control-Allow-Origin
	hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")

	if hdrAccessControlAllowOrigin != "" {
		o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
	}

	o.Payload = new(crm_models.Error)

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

	return nil
}

// NewPutAssetInternalServerError creates a PutAssetInternalServerError with default headers values
func NewPutAssetInternalServerError() *PutAssetInternalServerError {
	return &PutAssetInternalServerError{}
}

// PutAssetInternalServerError describes a response with status code 500, with default header values.
//
// Server Internal Error
type PutAssetInternalServerError struct {
	AccessControlAllowOrigin string

	Payload *crm_models.Error
}

// IsSuccess returns true when this put asset internal server error response has a 2xx status code
func (o *PutAssetInternalServerError) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this put asset internal server error response has a 3xx status code
func (o *PutAssetInternalServerError) IsRedirect() bool {
	return false
}

// IsClientError returns true when this put asset internal server error response has a 4xx status code
func (o *PutAssetInternalServerError) IsClientError() bool {
	return false
}

// IsServerError returns true when this put asset internal server error response has a 5xx status code
func (o *PutAssetInternalServerError) IsServerError() bool {
	return true
}

// IsCode returns true when this put asset internal server error response a status code equal to that given
func (o *PutAssetInternalServerError) IsCode(code int) bool {
	return code == 500
}

// Code gets the status code for the put asset internal server error response
func (o *PutAssetInternalServerError) Code() int {
	return 500
}

func (o *PutAssetInternalServerError) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /assets][%d] putAssetInternalServerError %s", 500, payload)
}

func (o *PutAssetInternalServerError) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /assets][%d] putAssetInternalServerError %s", 500, payload)
}

func (o *PutAssetInternalServerError) GetPayload() *crm_models.Error {
	return o.Payload
}

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

	// hydrates response header Access-Control-Allow-Origin
	hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")

	if hdrAccessControlAllowOrigin != "" {
		o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
	}

	o.Payload = new(crm_models.Error)

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

	return nil
}
