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

// 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 product API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
	return &Client{transport: transport, formats: formats}
}

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

// ClientService is the interface for Client methods
type ClientService interface {
	DeleteProduct(params *DeleteProductParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteProductOK, error)

	GetProducts(params *GetProductsParams, authInfo runtime.ClientAuthInfoWriter) (*GetProductsOK, error)

	GetProductsObservable(params *GetProductsObservableParams, authInfo runtime.ClientAuthInfoWriter) (*GetProductsObservableOK, error)

	PostProducts(params *PostProductsParams, authInfo runtime.ClientAuthInfoWriter) (*PostProductsOK, error)

	PutProducts(params *PutProductsParams, authInfo runtime.ClientAuthInfoWriter) (*PutProductsOK, error)

	SetTransport(transport runtime.ClientTransport)
}

/*
  DeleteProduct deletes a product

  Delete Taxnexus Product record
*/
func (a *Client) DeleteProduct(params *DeleteProductParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteProductOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewDeleteProductParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "deleteProduct",
		Method:             "DELETE",
		PathPattern:        "/products",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &DeleteProductReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	success, ok := result.(*DeleteProductOK)
	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 deleteProduct: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

/*
  GetProducts gets a list of products

  Return a list of all available Products
*/
func (a *Client) GetProducts(params *GetProductsParams, authInfo runtime.ClientAuthInfoWriter) (*GetProductsOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewGetProductsParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "getProducts",
		Method:             "GET",
		PathPattern:        "/products",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &GetProductsReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	success, ok := result.(*GetProductsOK)
	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 getProducts: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

/*
  GetProductsObservable gets a list of products

  Return a simplified list of all available Products
*/
func (a *Client) GetProductsObservable(params *GetProductsObservableParams, authInfo runtime.ClientAuthInfoWriter) (*GetProductsObservableOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewGetProductsObservableParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "getProductsObservable",
		Method:             "GET",
		PathPattern:        "/products/observable",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &GetProductsObservableReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	success, ok := result.(*GetProductsObservableOK)
	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 getProductsObservable: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

/*
  PostProducts adds new products

  Product records to be added
*/
func (a *Client) PostProducts(params *PostProductsParams, authInfo runtime.ClientAuthInfoWriter) (*PostProductsOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewPostProductsParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "postProducts",
		Method:             "POST",
		PathPattern:        "/products",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &PostProductsReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	success, ok := result.(*PostProductsOK)
	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 postProducts: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

/*
  PutProducts updates products

  Update Product records
*/
func (a *Client) PutProducts(params *PutProductsParams, authInfo runtime.ClientAuthInfoWriter) (*PutProductsOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewPutProductsParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "putProducts",
		Method:             "PUT",
		PathPattern:        "/products",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &PutProductsReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	success, ok := result.(*PutProductsOK)
	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 putProducts: 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
}
