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

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

// PostFactorsReader is a Reader for the PostFactors structure.
type PostFactorsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostFactorsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 201:
		result := NewPostFactorsCreated()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPostFactorsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPostFactorsForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPostFactorsNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPostFactorsUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPostFactorsInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /factors] postFactors", response, response.Code())
	}
}

// NewPostFactorsCreated creates a PostFactorsCreated with default headers values
func NewPostFactorsCreated() *PostFactorsCreated {
	return &PostFactorsCreated{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewPostFactorsUnauthorized creates a PostFactorsUnauthorized with default headers values
func NewPostFactorsUnauthorized() *PostFactorsUnauthorized {
	return &PostFactorsUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewPostFactorsForbidden creates a PostFactorsForbidden with default headers values
func NewPostFactorsForbidden() *PostFactorsForbidden {
	return &PostFactorsForbidden{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewPostFactorsNotFound creates a PostFactorsNotFound with default headers values
func NewPostFactorsNotFound() *PostFactorsNotFound {
	return &PostFactorsNotFound{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewPostFactorsUnprocessableEntity creates a PostFactorsUnprocessableEntity with default headers values
func NewPostFactorsUnprocessableEntity() *PostFactorsUnprocessableEntity {
	return &PostFactorsUnprocessableEntity{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewPostFactorsInternalServerError creates a PostFactorsInternalServerError with default headers values
func NewPostFactorsInternalServerError() *PostFactorsInternalServerError {
	return &PostFactorsInternalServerError{}
}

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

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

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

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

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

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

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

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

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

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

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