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

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

// PutProductsReader is a Reader for the PutProducts structure.
type PutProductsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PutProductsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPutProductsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPutProductsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPutProductsForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPutProductsNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPutProductsUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPutProductsInternalServerError()
		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())
	}
}

// NewPutProductsOK creates a PutProductsOK with default headers values
func NewPutProductsOK() *PutProductsOK {
	return &PutProductsOK{}
}

/*PutProductsOK handles this case with default header values.

Taxnexus Response with an array of Message objects in response to a PUT
*/
type PutProductsOK struct {
	AccessControlAllowOrigin string

	Payload *ops_models.PutResponse
}

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

func (o *PutProductsOK) GetPayload() *ops_models.PutResponse {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(ops_models.PutResponse)

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

	return nil
}

// NewPutProductsUnauthorized creates a PutProductsUnauthorized with default headers values
func NewPutProductsUnauthorized() *PutProductsUnauthorized {
	return &PutProductsUnauthorized{}
}

/*PutProductsUnauthorized handles this case with default header values.

Access unauthorized, invalid API-KEY was used
*/
type PutProductsUnauthorized struct {
	AccessControlAllowOrigin string

	Payload *ops_models.Error
}

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

func (o *PutProductsUnauthorized) GetPayload() *ops_models.Error {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(ops_models.Error)

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

	return nil
}

// NewPutProductsForbidden creates a PutProductsForbidden with default headers values
func NewPutProductsForbidden() *PutProductsForbidden {
	return &PutProductsForbidden{}
}

/*PutProductsForbidden handles this case with default header values.

Access forbidden, account lacks access
*/
type PutProductsForbidden struct {
	AccessControlAllowOrigin string

	Payload *ops_models.Error
}

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

func (o *PutProductsForbidden) GetPayload() *ops_models.Error {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(ops_models.Error)

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

	return nil
}

// NewPutProductsNotFound creates a PutProductsNotFound with default headers values
func NewPutProductsNotFound() *PutProductsNotFound {
	return &PutProductsNotFound{}
}

/*PutProductsNotFound handles this case with default header values.

Resource was not found
*/
type PutProductsNotFound struct {
	AccessControlAllowOrigin string

	Payload *ops_models.Error
}

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

func (o *PutProductsNotFound) GetPayload() *ops_models.Error {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(ops_models.Error)

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

	return nil
}

// NewPutProductsUnprocessableEntity creates a PutProductsUnprocessableEntity with default headers values
func NewPutProductsUnprocessableEntity() *PutProductsUnprocessableEntity {
	return &PutProductsUnprocessableEntity{}
}

/*PutProductsUnprocessableEntity handles this case with default header values.

Unprocessable Entity, likely a bad parameter
*/
type PutProductsUnprocessableEntity struct {
	AccessControlAllowOrigin string

	Payload *ops_models.Error
}

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

func (o *PutProductsUnprocessableEntity) GetPayload() *ops_models.Error {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(ops_models.Error)

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

	return nil
}

// NewPutProductsInternalServerError creates a PutProductsInternalServerError with default headers values
func NewPutProductsInternalServerError() *PutProductsInternalServerError {
	return &PutProductsInternalServerError{}
}

/*PutProductsInternalServerError handles this case with default header values.

Server Internal Error
*/
type PutProductsInternalServerError struct {
	AccessControlAllowOrigin string

	Payload *ops_models.Error
}

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

func (o *PutProductsInternalServerError) GetPayload() *ops_models.Error {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(ops_models.Error)

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

	return nil
}
