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

	"github.com/go-openapi/runtime"
	"github.com/go-openapi/strfmt"
)

// New creates a new plant batches API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
	return &Client{transport: transport, formats: formats}
}

/*
Client for plant batches API
*/
type Client struct {
	transport runtime.ClientTransport
	formats   strfmt.Registry
}

// ClientService is the interface for Client methods
type ClientService interface {
	DeletePlantBatch(params *DeletePlantBatchParams, authInfo runtime.ClientAuthInfoWriter) (*DeletePlantBatchOK, error)

	GetPlantBatches(params *GetPlantBatchesParams, authInfo runtime.ClientAuthInfoWriter) (*GetPlantBatchesOK, error)

	PostPlantBatches(params *PostPlantBatchesParams, authInfo runtime.ClientAuthInfoWriter) (*PostPlantBatchesOK, error)

	PutPlantBatches(params *PutPlantBatchesParams, authInfo runtime.ClientAuthInfoWriter) (*PutPlantBatchesOK, error)

	SetTransport(transport runtime.ClientTransport)
}

/*
  DeletePlantBatch plants for this user license

  Delete a plant for this User-License

*/
func (a *Client) DeletePlantBatch(params *DeletePlantBatchParams, authInfo runtime.ClientAuthInfoWriter) (*DeletePlantBatchOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewDeletePlantBatchParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "deletePlantBatch",
		Method:             "DELETE",
		PathPattern:        "/plantbatches",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &DeletePlantBatchReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	success, ok := result.(*DeletePlantBatchOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
	msg := fmt.Sprintf("unexpected success response for deletePlantBatch: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

/*
  GetPlantBatches plants batches for this user license

  Get Plant Batches for this User-License

*/
func (a *Client) GetPlantBatches(params *GetPlantBatchesParams, authInfo runtime.ClientAuthInfoWriter) (*GetPlantBatchesOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewGetPlantBatchesParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "getPlantBatches",
		Method:             "GET",
		PathPattern:        "/plantbatches",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &GetPlantBatchesReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	success, ok := result.(*GetPlantBatchesOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
	msg := fmt.Sprintf("unexpected success response for getPlantBatches: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

/*
  PostPlantBatches creates new plant batches

  Create new Plant Batches
*/
func (a *Client) PostPlantBatches(params *PostPlantBatchesParams, authInfo runtime.ClientAuthInfoWriter) (*PostPlantBatchesOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewPostPlantBatchesParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "postPlantBatches",
		Method:             "POST",
		PathPattern:        "/plantbatches",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &PostPlantBatchesReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	success, ok := result.(*PostPlantBatchesOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
	msg := fmt.Sprintf("unexpected success response for postPlantBatches: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

/*
  PutPlantBatches updates existing plant batches

  Update existing Plant Batches
*/
func (a *Client) PutPlantBatches(params *PutPlantBatchesParams, authInfo runtime.ClientAuthInfoWriter) (*PutPlantBatchesOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewPutPlantBatchesParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "putPlantBatches",
		Method:             "PUT",
		PathPattern:        "/plantbatches",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &PutPlantBatchesReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	success, ok := result.(*PutPlantBatchesOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
	msg := fmt.Sprintf("unexpected success response for putPlantBatches: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport runtime.ClientTransport) {
	a.transport = transport
}
