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

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

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

// PostDocumentsReader is a Reader for the PostDocuments structure.
type PostDocumentsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostDocumentsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 201:
		result := NewPostDocumentsCreated()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPostDocumentsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPostDocumentsForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPostDocumentsNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPostDocumentsUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPostDocumentsInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /documents] postDocuments", response, response.Code())
	}
}

// NewPostDocumentsCreated creates a PostDocumentsCreated with default headers values
func NewPostDocumentsCreated() *PostDocumentsCreated {
	return &PostDocumentsCreated{}
}

// PostDocumentsCreated describes a response with status code 201, with default header values.
//
// Response from Salesforce
type PostDocumentsCreated struct {
	Payload *sfgate_models.SalesforcePostResponse
}

// IsSuccess returns true when this post documents created response has a 2xx status code
func (o *PostDocumentsCreated) IsSuccess() bool {
	return true
}

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

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

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

// IsCode returns true when this post documents created response a status code equal to that given
func (o *PostDocumentsCreated) IsCode(code int) bool {
	return code == 201
}

// Code gets the status code for the post documents created response
func (o *PostDocumentsCreated) Code() int {
	return 201
}

func (o *PostDocumentsCreated) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /documents][%d] postDocumentsCreated %s", 201, payload)
}

func (o *PostDocumentsCreated) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[POST /documents][%d] postDocumentsCreated %s", 201, payload)
}

func (o *PostDocumentsCreated) GetPayload() *sfgate_models.SalesforcePostResponse {
	return o.Payload
}

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

	o.Payload = new(sfgate_models.SalesforcePostResponse)

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

	return nil
}

// NewPostDocumentsUnauthorized creates a PostDocumentsUnauthorized with default headers values
func NewPostDocumentsUnauthorized() *PostDocumentsUnauthorized {
	return &PostDocumentsUnauthorized{}
}

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

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

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

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

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

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

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

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

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

func (o *PostDocumentsUnauthorized) GetPayload() *sfgate_models.Error {
	return o.Payload
}

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

	o.Payload = new(sfgate_models.Error)

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

	return nil
}

// NewPostDocumentsForbidden creates a PostDocumentsForbidden with default headers values
func NewPostDocumentsForbidden() *PostDocumentsForbidden {
	return &PostDocumentsForbidden{}
}

// PostDocumentsForbidden describes a response with status code 403, with default header values.
//
// Access forbidden, account lacks access
type PostDocumentsForbidden struct {
	Payload *sfgate_models.Error
}

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

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

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

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

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

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

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

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

func (o *PostDocumentsForbidden) GetPayload() *sfgate_models.Error {
	return o.Payload
}

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

	o.Payload = new(sfgate_models.Error)

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

	return nil
}

// NewPostDocumentsNotFound creates a PostDocumentsNotFound with default headers values
func NewPostDocumentsNotFound() *PostDocumentsNotFound {
	return &PostDocumentsNotFound{}
}

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

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

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

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

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

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

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

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

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

func (o *PostDocumentsNotFound) GetPayload() *sfgate_models.Error {
	return o.Payload
}

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

	o.Payload = new(sfgate_models.Error)

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

	return nil
}

// NewPostDocumentsUnprocessableEntity creates a PostDocumentsUnprocessableEntity with default headers values
func NewPostDocumentsUnprocessableEntity() *PostDocumentsUnprocessableEntity {
	return &PostDocumentsUnprocessableEntity{}
}

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

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

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

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

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

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

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

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

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

func (o *PostDocumentsUnprocessableEntity) GetPayload() *sfgate_models.Error {
	return o.Payload
}

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

	o.Payload = new(sfgate_models.Error)

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

	return nil
}

// NewPostDocumentsInternalServerError creates a PostDocumentsInternalServerError with default headers values
func NewPostDocumentsInternalServerError() *PostDocumentsInternalServerError {
	return &PostDocumentsInternalServerError{}
}

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

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

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

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

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

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

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

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

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

func (o *PostDocumentsInternalServerError) GetPayload() *sfgate_models.Error {
	return o.Payload
}

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

	o.Payload = new(sfgate_models.Error)

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

	return nil
}
