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

// GetFavoritesReader is a Reader for the GetFavorites structure.
type GetFavoritesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetFavoritesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewGetFavoritesOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewGetFavoritesUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetFavoritesForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewGetFavoritesNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewGetFavoritesUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetFavoritesInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /favorites] getFavorites", response, response.Code())
	}
}

// NewGetFavoritesOK creates a GetFavoritesOK with default headers values
func NewGetFavoritesOK() *GetFavoritesOK {
	return &GetFavoritesOK{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewGetFavoritesUnauthorized creates a GetFavoritesUnauthorized with default headers values
func NewGetFavoritesUnauthorized() *GetFavoritesUnauthorized {
	return &GetFavoritesUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewGetFavoritesForbidden creates a GetFavoritesForbidden with default headers values
func NewGetFavoritesForbidden() *GetFavoritesForbidden {
	return &GetFavoritesForbidden{}
}

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

	Payload *members_models.Error
}

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

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

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

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

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

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

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

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

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

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

// NewGetFavoritesNotFound creates a GetFavoritesNotFound with default headers values
func NewGetFavoritesNotFound() *GetFavoritesNotFound {
	return &GetFavoritesNotFound{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewGetFavoritesUnprocessableEntity creates a GetFavoritesUnprocessableEntity with default headers values
func NewGetFavoritesUnprocessableEntity() *GetFavoritesUnprocessableEntity {
	return &GetFavoritesUnprocessableEntity{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewGetFavoritesInternalServerError creates a GetFavoritesInternalServerError with default headers values
func NewGetFavoritesInternalServerError() *GetFavoritesInternalServerError {
	return &GetFavoritesInternalServerError{}
}

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

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

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

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

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

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

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

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

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

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

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