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

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

// GetUnitsOfMeasureReader is a Reader for the GetUnitsOfMeasure structure.
type GetUnitsOfMeasureReader struct {
	formats strfmt.Registry
}

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

// NewGetUnitsOfMeasureOK creates a GetUnitsOfMeasureOK with default headers values
func NewGetUnitsOfMeasureOK() *GetUnitsOfMeasureOK {
	return &GetUnitsOfMeasureOK{}
}

/*GetUnitsOfMeasureOK handles this case with default header values.

A list of Units of Measure was succefully retrieved
*/
type GetUnitsOfMeasureOK struct {
	Payload *metrc_gw_models.UnitsOfMeasureResponse
}

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

func (o *GetUnitsOfMeasureOK) GetPayload() *metrc_gw_models.UnitsOfMeasureResponse {
	return o.Payload
}

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

	o.Payload = new(metrc_gw_models.UnitsOfMeasureResponse)

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

	return nil
}

// NewGetUnitsOfMeasureUnauthorized creates a GetUnitsOfMeasureUnauthorized with default headers values
func NewGetUnitsOfMeasureUnauthorized() *GetUnitsOfMeasureUnauthorized {
	return &GetUnitsOfMeasureUnauthorized{}
}

/*GetUnitsOfMeasureUnauthorized handles this case with default header values.

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

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

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

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

// NewGetUnitsOfMeasureForbidden creates a GetUnitsOfMeasureForbidden with default headers values
func NewGetUnitsOfMeasureForbidden() *GetUnitsOfMeasureForbidden {
	return &GetUnitsOfMeasureForbidden{}
}

/*GetUnitsOfMeasureForbidden handles this case with default header values.

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

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

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

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

// NewGetUnitsOfMeasureNotFound creates a GetUnitsOfMeasureNotFound with default headers values
func NewGetUnitsOfMeasureNotFound() *GetUnitsOfMeasureNotFound {
	return &GetUnitsOfMeasureNotFound{}
}

/*GetUnitsOfMeasureNotFound handles this case with default header values.

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

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

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

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

// NewGetUnitsOfMeasureInternalServerError creates a GetUnitsOfMeasureInternalServerError with default headers values
func NewGetUnitsOfMeasureInternalServerError() *GetUnitsOfMeasureInternalServerError {
	return &GetUnitsOfMeasureInternalServerError{}
}

/*GetUnitsOfMeasureInternalServerError handles this case with default header values.

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

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

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

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