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

// GetFactorsReader is a Reader for the GetFactors structure.
type GetFactorsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetFactorsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewGetFactorsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewGetFactorsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetFactorsForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewGetFactorsNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewGetFactorsUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetFactorsInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /factors] getFactors", response, response.Code())
	}
}

// NewGetFactorsOK creates a GetFactorsOK with default headers values
func NewGetFactorsOK() *GetFactorsOK {
	return &GetFactorsOK{}
}

// GetFactorsOK describes a response with status code 200, with default header values.
//
// Response with Factor objects
type GetFactorsOK struct {
	Payload *sfgate_models.FactorResponse
}

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

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

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

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

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

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

func (o *GetFactorsOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /factors][%d] getFactorsOK %s", 200, payload)
}

func (o *GetFactorsOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /factors][%d] getFactorsOK %s", 200, payload)
}

func (o *GetFactorsOK) GetPayload() *sfgate_models.FactorResponse {
	return o.Payload
}

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

	o.Payload = new(sfgate_models.FactorResponse)

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

	return nil
}

// NewGetFactorsUnauthorized creates a GetFactorsUnauthorized with default headers values
func NewGetFactorsUnauthorized() *GetFactorsUnauthorized {
	return &GetFactorsUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewGetFactorsForbidden creates a GetFactorsForbidden with default headers values
func NewGetFactorsForbidden() *GetFactorsForbidden {
	return &GetFactorsForbidden{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewGetFactorsNotFound creates a GetFactorsNotFound with default headers values
func NewGetFactorsNotFound() *GetFactorsNotFound {
	return &GetFactorsNotFound{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewGetFactorsUnprocessableEntity creates a GetFactorsUnprocessableEntity with default headers values
func NewGetFactorsUnprocessableEntity() *GetFactorsUnprocessableEntity {
	return &GetFactorsUnprocessableEntity{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewGetFactorsInternalServerError creates a GetFactorsInternalServerError with default headers values
func NewGetFactorsInternalServerError() *GetFactorsInternalServerError {
	return &GetFactorsInternalServerError{}
}

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

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

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

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

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

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

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

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

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

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

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