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

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

// GetFacilitiesReader is a Reader for the GetFacilities structure.
type GetFacilitiesReader struct {
	formats strfmt.Registry
}

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

// NewGetFacilitiesOK creates a GetFacilitiesOK with default headers values
func NewGetFacilitiesOK() *GetFacilitiesOK {
	return &GetFacilitiesOK{}
}

/*GetFacilitiesOK handles this case with default header values.

A list of Facilities was retrieved successfully
*/
type GetFacilitiesOK struct {
	Payload *metrc_gw_models.FacilityResponse
}

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

func (o *GetFacilitiesOK) GetPayload() *metrc_gw_models.FacilityResponse {
	return o.Payload
}

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

	o.Payload = new(metrc_gw_models.FacilityResponse)

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

	return nil
}

// NewGetFacilitiesUnauthorized creates a GetFacilitiesUnauthorized with default headers values
func NewGetFacilitiesUnauthorized() *GetFacilitiesUnauthorized {
	return &GetFacilitiesUnauthorized{}
}

/*GetFacilitiesUnauthorized handles this case with default header values.

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

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

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

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

// NewGetFacilitiesForbidden creates a GetFacilitiesForbidden with default headers values
func NewGetFacilitiesForbidden() *GetFacilitiesForbidden {
	return &GetFacilitiesForbidden{}
}

/*GetFacilitiesForbidden handles this case with default header values.

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

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

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

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

// NewGetFacilitiesNotFound creates a GetFacilitiesNotFound with default headers values
func NewGetFacilitiesNotFound() *GetFacilitiesNotFound {
	return &GetFacilitiesNotFound{}
}

/*GetFacilitiesNotFound handles this case with default header values.

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

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

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

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

// NewGetFacilitiesInternalServerError creates a GetFacilitiesInternalServerError with default headers values
func NewGetFacilitiesInternalServerError() *GetFacilitiesInternalServerError {
	return &GetFacilitiesInternalServerError{}
}

/*GetFacilitiesInternalServerError handles this case with default header values.

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

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

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

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