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

// (c) 2012-2023 by Vernon Keenan
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed

package favorites

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"fmt"
	"io"

	"github.com/go-openapi/runtime"
	"github.com/go-openapi/strfmt"

	"code.tnxs.net/work/lib/api/members/members_models"
)

// PostFavoritesReader is a Reader for the PostFavorites structure.
type PostFavoritesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostFavoritesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPostFavoritesOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPostFavoritesUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPostFavoritesForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPostFavoritesNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPostFavoritesUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPostFavoritesInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
	}
}

// NewPostFavoritesOK creates a PostFavoritesOK with default headers values
func NewPostFavoritesOK() *PostFavoritesOK {
	return &PostFavoritesOK{}
}

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

Favorite Response Object
*/
type PostFavoritesOK struct {
	Payload *members_models.FavoriteResponse
}

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

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

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

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

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

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

func (o *PostFavoritesOK) Error() string {
	return fmt.Sprintf("[POST /favorites][%d] postFavoritesOK  %+v", 200, o.Payload)
}

func (o *PostFavoritesOK) String() string {
	return fmt.Sprintf("[POST /favorites][%d] postFavoritesOK  %+v", 200, o.Payload)
}

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

func (o *PostFavoritesOK) 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 && err != io.EOF {
		return err
	}

	return nil
}

// NewPostFavoritesUnauthorized creates a PostFavoritesUnauthorized with default headers values
func NewPostFavoritesUnauthorized() *PostFavoritesUnauthorized {
	return &PostFavoritesUnauthorized{}
}

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

Access Unauthorized, invalid API-KEY was used
*/
type PostFavoritesUnauthorized struct {
	Payload *members_models.Error
}

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

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

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

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

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

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

func (o *PostFavoritesUnauthorized) Error() string {
	return fmt.Sprintf("[POST /favorites][%d] postFavoritesUnauthorized  %+v", 401, o.Payload)
}

func (o *PostFavoritesUnauthorized) String() string {
	return fmt.Sprintf("[POST /favorites][%d] postFavoritesUnauthorized  %+v", 401, o.Payload)
}

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

func (o *PostFavoritesUnauthorized) 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 && err != io.EOF {
		return err
	}

	return nil
}

// NewPostFavoritesForbidden creates a PostFavoritesForbidden with default headers values
func NewPostFavoritesForbidden() *PostFavoritesForbidden {
	return &PostFavoritesForbidden{}
}

/*
PostFavoritesForbidden describes a response with status code 403, with default header values.

Access forbidden, account lacks access
*/
type PostFavoritesForbidden struct {
	AccessControlAllowOrigin string

	Payload *members_models.Error
}

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

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

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

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

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

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

func (o *PostFavoritesForbidden) Error() string {
	return fmt.Sprintf("[POST /favorites][%d] postFavoritesForbidden  %+v", 403, o.Payload)
}

func (o *PostFavoritesForbidden) String() string {
	return fmt.Sprintf("[POST /favorites][%d] postFavoritesForbidden  %+v", 403, o.Payload)
}

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

func (o *PostFavoritesForbidden) 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 && err != io.EOF {
		return err
	}

	return nil
}

// NewPostFavoritesNotFound creates a PostFavoritesNotFound with default headers values
func NewPostFavoritesNotFound() *PostFavoritesNotFound {
	return &PostFavoritesNotFound{}
}

/*
PostFavoritesNotFound describes a response with status code 404, with default header values.

Resource was not found
*/
type PostFavoritesNotFound struct {
	Payload *members_models.Error
}

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

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

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

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

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

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

func (o *PostFavoritesNotFound) Error() string {
	return fmt.Sprintf("[POST /favorites][%d] postFavoritesNotFound  %+v", 404, o.Payload)
}

func (o *PostFavoritesNotFound) String() string {
	return fmt.Sprintf("[POST /favorites][%d] postFavoritesNotFound  %+v", 404, o.Payload)
}

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

func (o *PostFavoritesNotFound) 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 && err != io.EOF {
		return err
	}

	return nil
}

// NewPostFavoritesUnprocessableEntity creates a PostFavoritesUnprocessableEntity with default headers values
func NewPostFavoritesUnprocessableEntity() *PostFavoritesUnprocessableEntity {
	return &PostFavoritesUnprocessableEntity{}
}

/*
PostFavoritesUnprocessableEntity describes a response with status code 422, with default header values.

Unprocessable Entity, likely a bad parameter
*/
type PostFavoritesUnprocessableEntity struct {
	Payload *members_models.Error
}

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

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

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

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

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

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

func (o *PostFavoritesUnprocessableEntity) Error() string {
	return fmt.Sprintf("[POST /favorites][%d] postFavoritesUnprocessableEntity  %+v", 422, o.Payload)
}

func (o *PostFavoritesUnprocessableEntity) String() string {
	return fmt.Sprintf("[POST /favorites][%d] postFavoritesUnprocessableEntity  %+v", 422, o.Payload)
}

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

func (o *PostFavoritesUnprocessableEntity) 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 && err != io.EOF {
		return err
	}

	return nil
}

// NewPostFavoritesInternalServerError creates a PostFavoritesInternalServerError with default headers values
func NewPostFavoritesInternalServerError() *PostFavoritesInternalServerError {
	return &PostFavoritesInternalServerError{}
}

/*
PostFavoritesInternalServerError describes a response with status code 500, with default header values.

Server Internal Error
*/
type PostFavoritesInternalServerError struct {
	Payload *members_models.Error
}

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

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

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

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

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

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

func (o *PostFavoritesInternalServerError) Error() string {
	return fmt.Sprintf("[POST /favorites][%d] postFavoritesInternalServerError  %+v", 500, o.Payload)
}

func (o *PostFavoritesInternalServerError) String() string {
	return fmt.Sprintf("[POST /favorites][%d] postFavoritesInternalServerError  %+v", 500, o.Payload)
}

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

func (o *PostFavoritesInternalServerError) 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 && err != io.EOF {
		return err
	}

	return nil
}
