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

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

// GetPackageTypesReader is a Reader for the GetPackageTypes structure.
type GetPackageTypesReader struct {
	formats strfmt.Registry
}

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

// NewGetPackageTypesOK creates a GetPackageTypesOK with default headers values
func NewGetPackageTypesOK() *GetPackageTypesOK {
	return &GetPackageTypesOK{}
}

/*GetPackageTypesOK handles this case with default header values.

A list of Package Types was succefully retrieved
*/
type GetPackageTypesOK struct {
	Payload *metrc_gw_models.PackageTypeResponse
}

func (o *GetPackageTypesOK) Error() string {
	return fmt.Sprintf("[GET /packages/types][%d] getPackageTypesOK  %+v", 200, o.Payload)
}

func (o *GetPackageTypesOK) GetPayload() *metrc_gw_models.PackageTypeResponse {
	return o.Payload
}

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

	o.Payload = new(metrc_gw_models.PackageTypeResponse)

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

	return nil
}

// NewGetPackageTypesUnauthorized creates a GetPackageTypesUnauthorized with default headers values
func NewGetPackageTypesUnauthorized() *GetPackageTypesUnauthorized {
	return &GetPackageTypesUnauthorized{}
}

/*GetPackageTypesUnauthorized handles this case with default header values.

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

func (o *GetPackageTypesUnauthorized) Error() string {
	return fmt.Sprintf("[GET /packages/types][%d] getPackageTypesUnauthorized  %+v", 401, o.Payload)
}

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

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

// NewGetPackageTypesForbidden creates a GetPackageTypesForbidden with default headers values
func NewGetPackageTypesForbidden() *GetPackageTypesForbidden {
	return &GetPackageTypesForbidden{}
}

/*GetPackageTypesForbidden handles this case with default header values.

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

func (o *GetPackageTypesForbidden) Error() string {
	return fmt.Sprintf("[GET /packages/types][%d] getPackageTypesForbidden  %+v", 403, o.Payload)
}

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

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

// NewGetPackageTypesNotFound creates a GetPackageTypesNotFound with default headers values
func NewGetPackageTypesNotFound() *GetPackageTypesNotFound {
	return &GetPackageTypesNotFound{}
}

/*GetPackageTypesNotFound handles this case with default header values.

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

func (o *GetPackageTypesNotFound) Error() string {
	return fmt.Sprintf("[GET /packages/types][%d] getPackageTypesNotFound  %+v", 404, o.Payload)
}

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

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

// NewGetPackageTypesInternalServerError creates a GetPackageTypesInternalServerError with default headers values
func NewGetPackageTypesInternalServerError() *GetPackageTypesInternalServerError {
	return &GetPackageTypesInternalServerError{}
}

/*GetPackageTypesInternalServerError handles this case with default header values.

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

func (o *GetPackageTypesInternalServerError) Error() string {
	return fmt.Sprintf("[GET /packages/types][%d] getPackageTypesInternalServerError  %+v", 500, o.Payload)
}

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

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