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

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

// GetProductsReader is a Reader for the GetProducts structure.
type GetProductsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetProductsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetProductsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewGetProductsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetProductsForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewGetProductsNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewGetProductsUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetProductsInternalServerError()
		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())
	}
}

// NewGetProductsOK creates a GetProductsOK with default headers values
func NewGetProductsOK() *GetProductsOK {
	return &GetProductsOK{}
}

/*GetProductsOK handles this case with default header values.

An array of Product objects
*/
type GetProductsOK struct {
	Payload *sf_gate_models.ProductResponse
}

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

func (o *GetProductsOK) GetPayload() *sf_gate_models.ProductResponse {
	return o.Payload
}

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

	o.Payload = new(sf_gate_models.ProductResponse)

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

	return nil
}

// NewGetProductsUnauthorized creates a GetProductsUnauthorized with default headers values
func NewGetProductsUnauthorized() *GetProductsUnauthorized {
	return &GetProductsUnauthorized{}
}

/*GetProductsUnauthorized handles this case with default header values.

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

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

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

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

// NewGetProductsForbidden creates a GetProductsForbidden with default headers values
func NewGetProductsForbidden() *GetProductsForbidden {
	return &GetProductsForbidden{}
}

/*GetProductsForbidden handles this case with default header values.

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

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

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

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

// NewGetProductsNotFound creates a GetProductsNotFound with default headers values
func NewGetProductsNotFound() *GetProductsNotFound {
	return &GetProductsNotFound{}
}

/*GetProductsNotFound handles this case with default header values.

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

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

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

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

// NewGetProductsUnprocessableEntity creates a GetProductsUnprocessableEntity with default headers values
func NewGetProductsUnprocessableEntity() *GetProductsUnprocessableEntity {
	return &GetProductsUnprocessableEntity{}
}

/*GetProductsUnprocessableEntity handles this case with default header values.

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

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

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

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

// NewGetProductsInternalServerError creates a GetProductsInternalServerError with default headers values
func NewGetProductsInternalServerError() *GetProductsInternalServerError {
	return &GetProductsInternalServerError{}
}

/*GetProductsInternalServerError handles this case with default header values.

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

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

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

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