// Code generated by go-swagger; DO NOT EDIT.

// All Code Copyright(c) 2018-2020 by Taxnexus, Inc.
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed

package backends

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

	"github.com/taxnexus/go/lib/api/sf-gate/sf_gate_models"
)

// GetBackendsReader is a Reader for the GetBackends structure.
type GetBackendsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetBackendsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetBackendsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewGetBackendsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetBackendsForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewGetBackendsNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewGetBackendsUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetBackendsInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result

	default:
		return nil, runtime.NewAPIError("unknown error", response, response.Code())
	}
}

// NewGetBackendsOK creates a GetBackendsOK with default headers values
func NewGetBackendsOK() *GetBackendsOK {
	return &GetBackendsOK{}
}

/*GetBackendsOK handles this case with default header values.

Taxnexus Response with Backend objects
*/
type GetBackendsOK struct {
	Payload *sf_gate_models.BackendResponse
}

func (o *GetBackendsOK) Error() string {
	return fmt.Sprintf("[GET /backends][%d] getBackendsOK  %+v", 200, o.Payload)
}

func (o *GetBackendsOK) GetPayload() *sf_gate_models.BackendResponse {
	return o.Payload
}

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

	o.Payload = new(sf_gate_models.BackendResponse)

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

	return nil
}

// NewGetBackendsUnauthorized creates a GetBackendsUnauthorized with default headers values
func NewGetBackendsUnauthorized() *GetBackendsUnauthorized {
	return &GetBackendsUnauthorized{}
}

/*GetBackendsUnauthorized handles this case with default header values.

Access unauthorized, invalid API-KEY was used
*/
type GetBackendsUnauthorized struct {
	Payload *sf_gate_models.Error
}

func (o *GetBackendsUnauthorized) Error() string {
	return fmt.Sprintf("[GET /backends][%d] getBackendsUnauthorized  %+v", 401, o.Payload)
}

func (o *GetBackendsUnauthorized) GetPayload() *sf_gate_models.Error {
	return o.Payload
}

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

	o.Payload = new(sf_gate_models.Error)

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

	return nil
}

// NewGetBackendsForbidden creates a GetBackendsForbidden with default headers values
func NewGetBackendsForbidden() *GetBackendsForbidden {
	return &GetBackendsForbidden{}
}

/*GetBackendsForbidden handles this case with default header values.

Access forbidden, account lacks access
*/
type GetBackendsForbidden struct {
	Payload *sf_gate_models.Error
}

func (o *GetBackendsForbidden) Error() string {
	return fmt.Sprintf("[GET /backends][%d] getBackendsForbidden  %+v", 403, o.Payload)
}

func (o *GetBackendsForbidden) GetPayload() *sf_gate_models.Error {
	return o.Payload
}

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

	o.Payload = new(sf_gate_models.Error)

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

	return nil
}

// NewGetBackendsNotFound creates a GetBackendsNotFound with default headers values
func NewGetBackendsNotFound() *GetBackendsNotFound {
	return &GetBackendsNotFound{}
}

/*GetBackendsNotFound handles this case with default header values.

Resource was not found
*/
type GetBackendsNotFound struct {
	Payload *sf_gate_models.Error
}

func (o *GetBackendsNotFound) Error() string {
	return fmt.Sprintf("[GET /backends][%d] getBackendsNotFound  %+v", 404, o.Payload)
}

func (o *GetBackendsNotFound) GetPayload() *sf_gate_models.Error {
	return o.Payload
}

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

	o.Payload = new(sf_gate_models.Error)

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

	return nil
}

// NewGetBackendsUnprocessableEntity creates a GetBackendsUnprocessableEntity with default headers values
func NewGetBackendsUnprocessableEntity() *GetBackendsUnprocessableEntity {
	return &GetBackendsUnprocessableEntity{}
}

/*GetBackendsUnprocessableEntity handles this case with default header values.

Unprocessable Entity, likely a bad parameter
*/
type GetBackendsUnprocessableEntity struct {
	Payload *sf_gate_models.Error
}

func (o *GetBackendsUnprocessableEntity) Error() string {
	return fmt.Sprintf("[GET /backends][%d] getBackendsUnprocessableEntity  %+v", 422, o.Payload)
}

func (o *GetBackendsUnprocessableEntity) GetPayload() *sf_gate_models.Error {
	return o.Payload
}

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

	o.Payload = new(sf_gate_models.Error)

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

	return nil
}

// NewGetBackendsInternalServerError creates a GetBackendsInternalServerError with default headers values
func NewGetBackendsInternalServerError() *GetBackendsInternalServerError {
	return &GetBackendsInternalServerError{}
}

/*GetBackendsInternalServerError handles this case with default header values.

Server Internal Error
*/
type GetBackendsInternalServerError struct {
	Payload *sf_gate_models.Error
}

func (o *GetBackendsInternalServerError) Error() string {
	return fmt.Sprintf("[GET /backends][%d] getBackendsInternalServerError  %+v", 500, o.Payload)
}

func (o *GetBackendsInternalServerError) GetPayload() *sf_gate_models.Error {
	return o.Payload
}

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

	o.Payload = new(sf_gate_models.Error)

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

	return nil
}
