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

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

// PostPromptAnswersReader is a Reader for the PostPromptAnswers structure.
type PostPromptAnswersReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostPromptAnswersReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewPostPromptAnswersOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPostPromptAnswersUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPostPromptAnswersForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPostPromptAnswersNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPostPromptAnswersUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPostPromptAnswersInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /promptanswers] postPromptAnswers", response, response.Code())
	}
}

// NewPostPromptAnswersOK creates a PostPromptAnswersOK with default headers values
func NewPostPromptAnswersOK() *PostPromptAnswersOK {
	return &PostPromptAnswersOK{}
}

// PostPromptAnswersOK describes a response with status code 200, with default header values.
//
// Response with PromptAnswer objects
type PostPromptAnswersOK struct {
	Payload *members_models.PromptAnswerResponse
}

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

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

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

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

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

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

func (o *PostPromptAnswersOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /promptanswers][%d] postPromptAnswersOK %s", 200, payload)
}

func (o *PostPromptAnswersOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /promptanswers][%d] postPromptAnswersOK %s", 200, payload)
}

func (o *PostPromptAnswersOK) GetPayload() *members_models.PromptAnswerResponse {
	return o.Payload
}

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

	o.Payload = new(members_models.PromptAnswerResponse)

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

	return nil
}

// NewPostPromptAnswersUnauthorized creates a PostPromptAnswersUnauthorized with default headers values
func NewPostPromptAnswersUnauthorized() *PostPromptAnswersUnauthorized {
	return &PostPromptAnswersUnauthorized{}
}

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

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

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

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

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

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

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

func (o *PostPromptAnswersUnauthorized) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /promptanswers][%d] postPromptAnswersUnauthorized %s", 401, payload)
}

func (o *PostPromptAnswersUnauthorized) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /promptanswers][%d] postPromptAnswersUnauthorized %s", 401, payload)
}

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

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

// NewPostPromptAnswersForbidden creates a PostPromptAnswersForbidden with default headers values
func NewPostPromptAnswersForbidden() *PostPromptAnswersForbidden {
	return &PostPromptAnswersForbidden{}
}

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

	Payload *members_models.Error
}

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

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

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

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

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

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

func (o *PostPromptAnswersForbidden) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /promptanswers][%d] postPromptAnswersForbidden %s", 403, payload)
}

func (o *PostPromptAnswersForbidden) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /promptanswers][%d] postPromptAnswersForbidden %s", 403, payload)
}

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

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

// NewPostPromptAnswersNotFound creates a PostPromptAnswersNotFound with default headers values
func NewPostPromptAnswersNotFound() *PostPromptAnswersNotFound {
	return &PostPromptAnswersNotFound{}
}

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

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

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

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

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

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

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

func (o *PostPromptAnswersNotFound) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /promptanswers][%d] postPromptAnswersNotFound %s", 404, payload)
}

func (o *PostPromptAnswersNotFound) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /promptanswers][%d] postPromptAnswersNotFound %s", 404, payload)
}

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

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

// NewPostPromptAnswersUnprocessableEntity creates a PostPromptAnswersUnprocessableEntity with default headers values
func NewPostPromptAnswersUnprocessableEntity() *PostPromptAnswersUnprocessableEntity {
	return &PostPromptAnswersUnprocessableEntity{}
}

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

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

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

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

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

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

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

func (o *PostPromptAnswersUnprocessableEntity) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /promptanswers][%d] postPromptAnswersUnprocessableEntity %s", 422, payload)
}

func (o *PostPromptAnswersUnprocessableEntity) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /promptanswers][%d] postPromptAnswersUnprocessableEntity %s", 422, payload)
}

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

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

// NewPostPromptAnswersInternalServerError creates a PostPromptAnswersInternalServerError with default headers values
func NewPostPromptAnswersInternalServerError() *PostPromptAnswersInternalServerError {
	return &PostPromptAnswersInternalServerError{}
}

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

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

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

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

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

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

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

func (o *PostPromptAnswersInternalServerError) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /promptanswers][%d] postPromptAnswersInternalServerError %s", 500, payload)
}

func (o *PostPromptAnswersInternalServerError) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /promptanswers][%d] postPromptAnswersInternalServerError %s", 500, payload)
}

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

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