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

// 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/metrc-gw/metrc_gw_models"
)

// GetItemsReader is a Reader for the GetItems structure.
type GetItemsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetItemsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetItemsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewGetItemsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetItemsForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewGetItemsNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetItemsInternalServerError()
		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())
	}
}

// NewGetItemsOK creates a GetItemsOK with default headers values
func NewGetItemsOK() *GetItemsOK {
	return &GetItemsOK{}
}

/*GetItemsOK handles this case with default header values.

An item was successfully retrieved
*/
type GetItemsOK struct {
	Payload *metrc_gw_models.ItemResponse
}

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

func (o *GetItemsOK) GetPayload() *metrc_gw_models.ItemResponse {
	return o.Payload
}

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

	o.Payload = new(metrc_gw_models.ItemResponse)

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

	return nil
}

// NewGetItemsUnauthorized creates a GetItemsUnauthorized with default headers values
func NewGetItemsUnauthorized() *GetItemsUnauthorized {
	return &GetItemsUnauthorized{}
}

/*GetItemsUnauthorized handles this case with default header values.

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

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

func (o *GetItemsUnauthorized) GetPayload() *metrc_gw_models.Error {
	return o.Payload
}

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

	o.Payload = new(metrc_gw_models.Error)

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

	return nil
}

// NewGetItemsForbidden creates a GetItemsForbidden with default headers values
func NewGetItemsForbidden() *GetItemsForbidden {
	return &GetItemsForbidden{}
}

/*GetItemsForbidden handles this case with default header values.

Access forbidden, account lacks access
*/
type GetItemsForbidden struct {
	Payload *metrc_gw_models.Error
}

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

func (o *GetItemsForbidden) GetPayload() *metrc_gw_models.Error {
	return o.Payload
}

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

	o.Payload = new(metrc_gw_models.Error)

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

	return nil
}

// NewGetItemsNotFound creates a GetItemsNotFound with default headers values
func NewGetItemsNotFound() *GetItemsNotFound {
	return &GetItemsNotFound{}
}

/*GetItemsNotFound handles this case with default header values.

Resource was not found
*/
type GetItemsNotFound struct {
	Payload *metrc_gw_models.Error
}

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

func (o *GetItemsNotFound) GetPayload() *metrc_gw_models.Error {
	return o.Payload
}

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

	o.Payload = new(metrc_gw_models.Error)

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

	return nil
}

// NewGetItemsInternalServerError creates a GetItemsInternalServerError with default headers values
func NewGetItemsInternalServerError() *GetItemsInternalServerError {
	return &GetItemsInternalServerError{}
}

/*GetItemsInternalServerError handles this case with default header values.

Server Internal Error
*/
type GetItemsInternalServerError struct {
	Payload *metrc_gw_models.Error
}

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

func (o *GetItemsInternalServerError) GetPayload() *metrc_gw_models.Error {
	return o.Payload
}

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

	o.Payload = new(metrc_gw_models.Error)

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

	return nil
}
