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

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

// PostPlantBatchesReader is a Reader for the PostPlantBatches structure.
type PostPlantBatchesReader struct {
	formats strfmt.Registry
}

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

// NewPostPlantBatchesOK creates a PostPlantBatchesOK with default headers values
func NewPostPlantBatchesOK() *PostPlantBatchesOK {
	return &PostPlantBatchesOK{}
}

/*PostPlantBatchesOK handles this case with default header values.

An array of Plant Batches records with the new IDs
*/
type PostPlantBatchesOK struct {
	Payload *metrc_gw_models.PlantBatchResponse
}

func (o *PostPlantBatchesOK) Error() string {
	return fmt.Sprintf("[POST /plantbatches][%d] postPlantBatchesOK  %+v", 200, o.Payload)
}

func (o *PostPlantBatchesOK) GetPayload() *metrc_gw_models.PlantBatchResponse {
	return o.Payload
}

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

	o.Payload = new(metrc_gw_models.PlantBatchResponse)

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

	return nil
}

// NewPostPlantBatchesUnauthorized creates a PostPlantBatchesUnauthorized with default headers values
func NewPostPlantBatchesUnauthorized() *PostPlantBatchesUnauthorized {
	return &PostPlantBatchesUnauthorized{}
}

/*PostPlantBatchesUnauthorized handles this case with default header values.

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

func (o *PostPlantBatchesUnauthorized) Error() string {
	return fmt.Sprintf("[POST /plantbatches][%d] postPlantBatchesUnauthorized  %+v", 401, o.Payload)
}

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

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

// NewPostPlantBatchesForbidden creates a PostPlantBatchesForbidden with default headers values
func NewPostPlantBatchesForbidden() *PostPlantBatchesForbidden {
	return &PostPlantBatchesForbidden{}
}

/*PostPlantBatchesForbidden handles this case with default header values.

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

func (o *PostPlantBatchesForbidden) Error() string {
	return fmt.Sprintf("[POST /plantbatches][%d] postPlantBatchesForbidden  %+v", 403, o.Payload)
}

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

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

// NewPostPlantBatchesNotFound creates a PostPlantBatchesNotFound with default headers values
func NewPostPlantBatchesNotFound() *PostPlantBatchesNotFound {
	return &PostPlantBatchesNotFound{}
}

/*PostPlantBatchesNotFound handles this case with default header values.

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

func (o *PostPlantBatchesNotFound) Error() string {
	return fmt.Sprintf("[POST /plantbatches][%d] postPlantBatchesNotFound  %+v", 404, o.Payload)
}

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

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

// NewPostPlantBatchesInternalServerError creates a PostPlantBatchesInternalServerError with default headers values
func NewPostPlantBatchesInternalServerError() *PostPlantBatchesInternalServerError {
	return &PostPlantBatchesInternalServerError{}
}

/*PostPlantBatchesInternalServerError handles this case with default header values.

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

func (o *PostPlantBatchesInternalServerError) Error() string {
	return fmt.Sprintf("[POST /plantbatches][%d] postPlantBatchesInternalServerError  %+v", 500, o.Payload)
}

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

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