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

// PostPromptsReader is a Reader for the PostPrompts structure.
type PostPromptsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostPromptsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewPostPromptsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPostPromptsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPostPromptsForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPostPromptsNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPostPromptsUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPostPromptsInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /prompts] postPrompts", response, response.Code())
	}
}

// NewPostPromptsOK creates a PostPromptsOK with default headers values
func NewPostPromptsOK() *PostPromptsOK {
	return &PostPromptsOK{}
}

// PostPromptsOK describes a response with status code 200, with default header values.
//
// Response with Prompt objects
type PostPromptsOK struct {
	Payload *members_models.PromptResponse
}

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

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

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

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

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

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

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

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

func (o *PostPromptsOK) GetPayload() *members_models.PromptResponse {
	return o.Payload
}

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

	o.Payload = new(members_models.PromptResponse)

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

	return nil
}

// NewPostPromptsUnauthorized creates a PostPromptsUnauthorized with default headers values
func NewPostPromptsUnauthorized() *PostPromptsUnauthorized {
	return &PostPromptsUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewPostPromptsForbidden creates a PostPromptsForbidden with default headers values
func NewPostPromptsForbidden() *PostPromptsForbidden {
	return &PostPromptsForbidden{}
}

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

	Payload *members_models.Error
}

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

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

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

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

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

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

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

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

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

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

// NewPostPromptsNotFound creates a PostPromptsNotFound with default headers values
func NewPostPromptsNotFound() *PostPromptsNotFound {
	return &PostPromptsNotFound{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewPostPromptsUnprocessableEntity creates a PostPromptsUnprocessableEntity with default headers values
func NewPostPromptsUnprocessableEntity() *PostPromptsUnprocessableEntity {
	return &PostPromptsUnprocessableEntity{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewPostPromptsInternalServerError creates a PostPromptsInternalServerError with default headers values
func NewPostPromptsInternalServerError() *PostPromptsInternalServerError {
	return &PostPromptsInternalServerError{}
}

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

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

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

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

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

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

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

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

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

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

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