// 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 favorites

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

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

// PutFavoritesReader is a Reader for the PutFavorites structure.
type PutFavoritesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PutFavoritesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewPutFavoritesOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPutFavoritesUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPutFavoritesForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPutFavoritesNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPutFavoritesUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPutFavoritesInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[PUT /favorites] putFavorites", response, response.Code())
	}
}

// NewPutFavoritesOK creates a PutFavoritesOK with default headers values
func NewPutFavoritesOK() *PutFavoritesOK {
	return &PutFavoritesOK{}
}

// PutFavoritesOK describes a response with status code 200, with default header values.
//
// Favorite Response Object
type PutFavoritesOK struct {
	Payload *members_models.FavoriteResponse
}

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

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

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

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

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

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

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

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

func (o *PutFavoritesOK) GetPayload() *members_models.FavoriteResponse {
	return o.Payload
}

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

	o.Payload = new(members_models.FavoriteResponse)

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

	return nil
}

// NewPutFavoritesUnauthorized creates a PutFavoritesUnauthorized with default headers values
func NewPutFavoritesUnauthorized() *PutFavoritesUnauthorized {
	return &PutFavoritesUnauthorized{}
}

// PutFavoritesUnauthorized describes a response with status code 401, with default header values.
//
// Access Unauthorized, invalid API-KEY was used
type PutFavoritesUnauthorized struct {
	Payload *members_models.Error
}

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

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

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

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

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

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

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

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

func (o *PutFavoritesUnauthorized) GetPayload() *members_models.Error {
	return o.Payload
}

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

	o.Payload = new(members_models.Error)

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

	return nil
}

// NewPutFavoritesForbidden creates a PutFavoritesForbidden with default headers values
func NewPutFavoritesForbidden() *PutFavoritesForbidden {
	return &PutFavoritesForbidden{}
}

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

	Payload *members_models.Error
}

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

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

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

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

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

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

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

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

func (o *PutFavoritesForbidden) GetPayload() *members_models.Error {
	return o.Payload
}

func (o *PutFavoritesForbidden) 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(members_models.Error)

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

	return nil
}

// NewPutFavoritesNotFound creates a PutFavoritesNotFound with default headers values
func NewPutFavoritesNotFound() *PutFavoritesNotFound {
	return &PutFavoritesNotFound{}
}

// PutFavoritesNotFound describes a response with status code 404, with default header values.
//
// Resource was not found
type PutFavoritesNotFound struct {
	Payload *members_models.Error
}

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

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

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

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

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

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

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

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

func (o *PutFavoritesNotFound) GetPayload() *members_models.Error {
	return o.Payload
}

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

	o.Payload = new(members_models.Error)

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

	return nil
}

// NewPutFavoritesUnprocessableEntity creates a PutFavoritesUnprocessableEntity with default headers values
func NewPutFavoritesUnprocessableEntity() *PutFavoritesUnprocessableEntity {
	return &PutFavoritesUnprocessableEntity{}
}

// PutFavoritesUnprocessableEntity describes a response with status code 422, with default header values.
//
// Unprocessable Entity, likely a bad parameter
type PutFavoritesUnprocessableEntity struct {
	Payload *members_models.Error
}

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

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

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

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

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

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

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

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

func (o *PutFavoritesUnprocessableEntity) GetPayload() *members_models.Error {
	return o.Payload
}

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

	o.Payload = new(members_models.Error)

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

	return nil
}

// NewPutFavoritesInternalServerError creates a PutFavoritesInternalServerError with default headers values
func NewPutFavoritesInternalServerError() *PutFavoritesInternalServerError {
	return &PutFavoritesInternalServerError{}
}

// PutFavoritesInternalServerError describes a response with status code 500, with default header values.
//
// Server Internal Error
type PutFavoritesInternalServerError struct {
	Payload *members_models.Error
}

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

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

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

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

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

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

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

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

func (o *PutFavoritesInternalServerError) GetPayload() *members_models.Error {
	return o.Payload
}

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

	o.Payload = new(members_models.Error)

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

	return nil
}
