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

// 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/vernonkeenan/lib/api/research/research_models"
)

// 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) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPostFactorsOK()
		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("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
	}
}

// NewPostFactorsOK creates a PostFactorsOK with default headers values
func NewPostFactorsOK() *PostFactorsOK {
	return &PostFactorsOK{}
}

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

Response with Factor objects
*/
type PostFactorsOK struct {
	Payload *research_models.FactorResponse
}

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

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

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

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

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

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

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

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

func (o *PostFactorsOK) GetPayload() *research_models.FactorResponse {
	return o.Payload
}

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

	o.Payload = new(research_models.FactorResponse)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && 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 {
	AccessControlAllowOrigin string

	Payload *research_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 {
	return fmt.Sprintf("[POST /factors][%d] postFactorsUnauthorized  %+v", 401, o.Payload)
}

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

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

func (o *PostFactorsUnauthorized) 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(research_models.Error)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && 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 {
	AccessControlAllowOrigin string

	Payload *research_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 {
	return fmt.Sprintf("[POST /factors][%d] postFactorsForbidden  %+v", 403, o.Payload)
}

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

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

func (o *PostFactorsForbidden) 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(research_models.Error)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && 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 {
	AccessControlAllowOrigin string

	Payload *research_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 {
	return fmt.Sprintf("[POST /factors][%d] postFactorsNotFound  %+v", 404, o.Payload)
}

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

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

func (o *PostFactorsNotFound) 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(research_models.Error)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && 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 {
	AccessControlAllowOrigin string

	Payload *research_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 {
	return fmt.Sprintf("[POST /factors][%d] postFactorsUnprocessableEntity  %+v", 422, o.Payload)
}

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

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

func (o *PostFactorsUnprocessableEntity) 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(research_models.Error)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && 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 {
	AccessControlAllowOrigin string

	Payload *research_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 {
	return fmt.Sprintf("[POST /factors][%d] postFactorsInternalServerError  %+v", 500, o.Payload)
}

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

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

func (o *PostFactorsInternalServerError) 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(research_models.Error)

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

	return nil
}
